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

Use pdata for prometheus monitor #5545

Merged
merged 1 commit into from
Oct 24, 2024
Merged

Use pdata for prometheus monitor #5545

merged 1 commit into from
Oct 24, 2024

Conversation

atoulme
Copy link
Contributor

@atoulme atoulme commented Oct 24, 2024

No description provided.

@atoulme atoulme force-pushed the use_pdata_prometheus branch 3 times, most recently from 4eb0309 to 7cc3c74 Compare October 24, 2024 06:02
@atoulme atoulme marked this pull request as ready for review October 24, 2024 07:08
@atoulme atoulme requested review from a team as code owners October 24, 2024 07:08
Comment on lines +141 to +149
metric := pmetric.NewMetric()
metric.SetName(name + "_count")
sum := metric.SetEmptySum()
sum.SetIsMonotonic(true)
sum.SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
dp := sum.DataPoints().AppendEmpty()
dp.SetIntValue(int64(h.GetSampleCount())) //nolint:gosec // disable G115
_ = dp.Attributes().FromRaw(dims)
dps = append(dps, metric)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, we are creating one metric with one data point for each Prometheus time series. Is that correct? I don't see any combining logic down the road...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the existing sfxDatapointsToPDataMetrics implementation does pretty much the same though...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is a simple follow through to make sure we get the same behavior for now.

@dmitryax
Copy link
Contributor

Do we have any tests to confirm that the output hasn't changed?

Copy link
Contributor

@dmitryax dmitryax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM assuming we have tests covering the output

@atoulme
Copy link
Contributor Author

atoulme commented Oct 24, 2024

Yes, we have multiple tests that check with golden files that the prometheus metrics match. Both for simple gauges and counters and histograms.

@atoulme atoulme merged commit 759fba4 into main Oct 24, 2024
246 of 249 checks passed
@atoulme atoulme deleted the use_pdata_prometheus branch October 24, 2024 21:11
@github-actions github-actions bot locked and limited conversation to collaborators Oct 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants