  Monitoring software systems at runtime is key for understanding workloads,
debugging, and self-adaptation. It typically involves collecting and storing
observable software data, which can be analyzed online or offline. Despite the
usefulness of collecting system data, it may significantly impact the system
execution by delaying response times and competing with system resources. The
typical approach to cope with this is to filter portions of the system to be
monitored and to sample data. Although these approaches are a step towards
achieving a desired trade-off between the amount of collected information and
the impact on the system performance, they focus on collecting data of a
particular type or may capture a sample that does not correspond to the actual
system behavior. In response, we propose an adaptive runtime monitoring process
to dynamically adapt the sampling rate while monitoring software systems. It
includes algorithms with statistical foundations to improve the
representativeness of collected samples without compromising the system
performance. Our evaluation targets five applications of a widely used
benchmark. It shows that the error (RMSE) of the samples collected with our
approach is 9-54% lower than the main alternative strategy (sampling rate
inversely proportional to the throughput), with 1-6% higher performance impact.
