Skip to content

chore(metrics): Introduce correctness tests using dynamically generated metrics

Ankit Bhatnagar requested to merge abhatnagar/metrics-correctness-tests into main

Related #2561

Building up to landing support for grouping searched metrics by attributes with !2510 (merged), this MR introduces a set of unit tests that ensure correctness for our metrics implementation using dynamically generated telemetry. This helps add proper tests coverage for metrics considering the surface area is sufficiently large for manually testing codepaths every time we introduce new changes.

The data generation is completely abstracted into data_generator.go which first creates a series of timestamps within the requested period, aggregated per second, minute, hour or day as the need be. Once generated, we add random datapoints corresponding to each timestamp in the generated time-series before persisting it. We then query this dataset as we would in production.

Edited by Ankit Bhatnagar

Merge request reports