Skip to content

Use last_over_time to fix build_info query #8

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

Merged
merged 1 commit into from
May 1, 2023
Merged

Conversation

emschwartz
Copy link
Contributor

When the version switches, we observed a problem where Prometheus would keep the value of the old gauge in memory and return it for the query using the build_info metric. This is a problem with our group_left query because Prometheus would complain that there are multiple matching label sets (the old and new version info).

Adding the last_over_time function seems to solve this because it seems to get rid of the old gauge value as soon as it no longer appears in the scrape.

@emschwartz emschwartz requested a review from flenter April 28, 2023 08:33
Copy link
Member

@flenter flenter left a comment

Choose a reason for hiding this comment

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

🎉

@emschwartz emschwartz merged commit b440a72 into main May 1, 2023
@flenter flenter deleted the fix-build-info branch May 10, 2023 20:52
brettimus added a commit to autometrics-dev/autometrics-py that referenced this pull request May 10, 2023
brettimus added a commit to autometrics-dev/autometrics-py that referenced this pull request May 11, 2023
* Add blurb to readme about identifying commits

* Remove "coming soon" from readme item on adding links to live Prom charts

* Initialize Prometheus Gauge for build_info

* Add updown counter for build info to otel tracker

* Implement set_build_info for OTEL and Prom, and call when we set the default tracker

* Move set_build_info call into create_tracker

* Update prometheus queries

* Update prometheus URL tests

* Add test for build_info gauge for prometheus tracker (skipped test for otel tracker)

* Update otel tracker and tracker tests after finding otel prometheus bug

* Ensure set_build_info is only called once

* Update changelog

* Add set_build_info to the TrackMetrics Protocol

* Fix build_info query based off of autometrics-dev/autometrics-shared#8

* Rename create_tracker to init_tracker

* Update pyright

* Update README to mention OpenTelemetry tracker does not work with build_info

---------

Co-authored-by: Brett Beutell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants