You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Aggregated histogram, distribution and timing values are all flushed with the first call's cardinality #999
With client side aggregation enabled and max_metric_samples_per_context set, histogram(), distribution() and timing() calls that share a name and tags but pass different cardinality values are stored in one context. On flush every sample is sent with the cardinality of whichever call created the context first.
#980 fixed the same problem for count, gauge and set by including the cardinality in the aggregation context key, but Aggregator.add_max_sample_metric still calls get_context(name, tags) without it.
What should happen
Each value should be flushed with the cardinality it was submitted with, as count, gauge and set already do.
Aggregator.add_max_sample_metric in datadog/dogstatsd/aggregator.py builds the context key with self.get_context(name, tags), leaving out the cardinality. MaxSampleMetricContexts.sample creates the MaxSampleMetric with the first call's cardinality and reuses it for later calls with the same key, so the later cardinalities are dropped.
Activity