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

[receiver/prometheus] Don't drop Histograms without buckets #23448

Merged

Conversation

swiatekm
Copy link
Contributor

@swiatekm swiatekm commented Jun 19, 2023

Description:
Prometheus receiver currently drops Histograms without any buckets. These are, however, explicitly allowed by the Otel spec, and can be quite useful. This change allows ingesting them. When we do so, we add an additional bucket at +Inf equal to the count attribute of the Histogram.

Link to tracking Issue: #22070

Testing:
Modified existing tests.

@github-actions github-actions bot added the receiver/prometheus Prometheus receiver label Jun 19, 2023
@github-actions github-actions bot requested review from Aneurysm9 and dashpole June 19, 2023 10:14
@swiatekm swiatekm marked this pull request as ready for review June 19, 2023 11:20
@swiatekm swiatekm requested a review from a team June 19, 2023 11:20
@github-actions
Copy link
Contributor

github-actions bot commented Jul 4, 2023

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@swiatekm swiatekm force-pushed the fix/prometheusreceiver/empty-histogram branch 2 times, most recently from 7739331 to e2eb25c Compare July 12, 2023 19:18
@swiatekm
Copy link
Contributor Author

I've changed the logic so we ignore the +Inf bucket and always emit at least one Otel bucket based on the total count. I tried to make the logic clearer, but not sure if this is any better in the end. Let me know what you think.

@swiatekm swiatekm requested a review from dashpole July 12, 2023 19:20
Copy link
Contributor

@dashpole dashpole left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM

@swiatekm swiatekm force-pushed the fix/prometheusreceiver/empty-histogram branch from e2eb25c to a2d36ad Compare July 17, 2023 08:43
@swiatekm swiatekm force-pushed the fix/prometheusreceiver/empty-histogram branch from a2d36ad to e2b9bb9 Compare July 17, 2023 18:06
@atoulme atoulme added the ready to merge Code review completed; ready to merge by maintainers label Jul 25, 2023
@mx-psi mx-psi merged commit 5d410bb into open-telemetry:main Aug 1, 2023
@github-actions github-actions bot added this to the next release milestone Aug 1, 2023
@swiatekm swiatekm deleted the fix/prometheusreceiver/empty-histogram branch August 1, 2023 12:15
mx-psi added a commit that referenced this pull request Aug 1, 2023
@mx-psi
Copy link
Member

mx-psi commented Aug 1, 2023

This broke unit tests on main, so I am reverting, see #24766. If you have a quick fix @swiatekm-sumo please share it with me and we can get it merged instead :)

@swiatekm
Copy link
Contributor Author

swiatekm commented Aug 1, 2023

Looks like this is because the original change wasn't rebased on #24032, which moved a bunch of tests around. Should be an easy fix.

djaglowski pushed a commit that referenced this pull request Aug 1, 2023
Fixes a failing test from #23448, which wasn't rebased on #24032 before
merging.

#24032 reorganized prometheus receiver tests for compliance with the
openmetrics spec, and in particular made a distinction between data
which Prometheus itself accepts, but the receiver doesn't, and data
which neither accept.

The failing test checks a histogram which wasn't accepted before #23448,
but should be accepted now, and this is an intentional consequence of
this change. This histogram has a bucket with an invalid label, which is
quietly dropped as a result of #24032, but a valid `count`, which makes
it a valid histogram due to #23448.

This change basically moves the test from the `invalid` group to the
`valid` group.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Code review completed; ready to merge by maintainers receiver/prometheus Prometheus receiver
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants