Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

statsd exporter currently relies on LastValue for emitting gauge metrics #11

Closed
zlozano opened this issue Apr 14, 2020 · 1 comment
Closed
Labels
area: exporter Related to an exporter package
Milestone

Comments

@zlozano
Copy link

zlozano commented Apr 14, 2020

The new statsd exporter looks for a LastValue aggregator to emit gauge metrics. This is problematic because the NewExportPipeline factory uses simple.NewWithExactMeasure as its aggregator selector. This selector chooses the points aggregation for Observer types.

func (selectorExact) AggregatorFor(descriptor *metric.Descriptor) export.Aggregator {
	switch descriptor.MetricKind() {
	case metric.ObserverKind:
		fallthrough
	case metric.MeasureKind:
		return array.New()
	default:
		return sum.New()
	}
}

In most cases, I would imagine those using DataDog would expect Observer results to be output as traditional gauge metrics. The recommendation here says

This also allows aggregating over time to export a distribution, but the "last" value is still well defined in each collection interval for a given label set. I imagine that an exporter that wants traditional gauge semantics could just export the sum, under the assumption that count==1, and that would be all that's needed.

However, this exporter does not consider this. Also IIUC under certain circumstances (e.g. short push interval, and low traffic) there may be situations where true histogram values come in with a single count. In that case it would be impossible to determine what is desired to be exported as a gauge, vs. what is desired to be exported as a histogram.

In light of this, the two solutions I see are to make the ExactMeasure selector choose a LastValue aggregator for the metric.ObserverKind case, or provide the ability to construct our own export pipeline with out own selector. The latter is currently not possible because Exporter.labelEncoder is not present.

If a new selector is in fact required, I think it makes sense to add to this library since the exporter expects a LastValue aggregator to be used.

@jmacd I'll defer to you here on any options I probably missed since you're most familiar in this space.

@zlozano
Copy link
Author

zlozano commented Apr 20, 2020

This was fixed by #14. Thanks!

@zlozano zlozano closed this as completed Apr 20, 2020
@MrAlias MrAlias added the area: exporter Related to an exporter package label Jun 18, 2020
plantfansam referenced this issue in plantfansam/opentelemetry-go-contrib Mar 18, 2022
@pellared pellared added this to the untracked milestone Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: exporter Related to an exporter package
Projects
None yet
Development

No branches or pull requests

3 participants