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

[processor/deltatocumulative] Incorrectly dropping gauge metrics #35284

Closed
sirianni opened this issue Sep 18, 2024 · 1 comment · Fixed by #35372
Closed

[processor/deltatocumulative] Incorrectly dropping gauge metrics #35284

sirianni opened this issue Sep 18, 2024 · 1 comment · Fixed by #35372
Labels
bug Something isn't working needs triage New item requiring triage processor/deltatocumulative

Comments

@sirianni
Copy link
Contributor

sirianni commented Sep 18, 2024

Component(s)

processor/deltatocumulative

What happened?

I expected the deltatocumulative to ignore gauge metrics, however it is filtering them.

This was previously a latent issue, but with #34979 it is now impacting functionality.

	metrics.Filter(md, func(m metrics.Metric) bool {
		var n int
		switch m.Type() {
		case pmetric.MetricTypeSum:
			sum := m.Sum()
			if sum.AggregationTemporality() == pmetric.AggregationTemporalityDelta {
				err := streams.Apply(metrics.Sum(m), p.sums.aggr.Aggregate)
				errs = errors.Join(errs, err)
				sum.SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
			}
			n = sum.DataPoints().Len()
		case pmetric.MetricTypeHistogram:
			hist := m.Histogram()
			if hist.AggregationTemporality() == pmetric.AggregationTemporalityDelta {
				err := streams.Apply(metrics.Histogram(m), p.hist.aggr.Aggregate)
				errs = errors.Join(errs, err)
				hist.SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
			}
			n = hist.DataPoints().Len()
		case pmetric.MetricTypeExponentialHistogram:
			expo := m.ExponentialHistogram()
			if expo.AggregationTemporality() == pmetric.AggregationTemporalityDelta {
				err := streams.Apply(metrics.ExpHistogram(m), p.expo.aggr.Aggregate)
				errs = errors.Join(errs, err)
				expo.SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
			}
			n = expo.DataPoints().Len()
		}
		return n > 0
	})

Collector version

v0.109.0

@sirianni sirianni added bug Something isn't working needs triage New item requiring triage labels Sep 18, 2024
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

jpkrohling added a commit that referenced this issue Sep 24, 2024
**Description:**
As an oversight,
#33286
not only started dropping metrics without datapoints, but also all
Gauges and Summaries.
This change correctly passes those types through unaltered.

**Link to tracking Issue:** Fixes #35284 

**Testing:** `TestIgnore` was added _before_ fixing. It fails on current
main, passes after this change

**Documentation:** not needed

---------

Co-authored-by: Juraci Paixão Kröhling <[email protected]>
jriguera pushed a commit to springernature/opentelemetry-collector-contrib that referenced this issue Oct 4, 2024
…etry#35372)

**Description:**
As an oversight,
open-telemetry#33286
not only started dropping metrics without datapoints, but also all
Gauges and Summaries.
This change correctly passes those types through unaltered.

**Link to tracking Issue:** Fixes open-telemetry#35284 

**Testing:** `TestIgnore` was added _before_ fixing. It fails on current
main, passes after this change

**Documentation:** not needed

---------

Co-authored-by: Juraci Paixão Kröhling <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage New item requiring triage processor/deltatocumulative
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant