-
Notifications
You must be signed in to change notification settings - Fork 9
Add build_info metric and use it in generated queries #35
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
Conversation
|
Update: OTEL support will be dependent on resolution of open-telemetry/opentelemetry-python#3071 (I'm working on a PR) |
|
I think we can treat the OTEL support as non-blocking, since I'm not sure how long it will take for my PR on opentelemetry-python to get reviewed/merged/released |
flenter
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Nice!
However, I think it would be good to expand the TrackerType protocol (i.e. interaface) with a set_build_info function (defined in src/autometrics/tracker/tracker.py)
src/autometrics/prometheus_url.py
Outdated
| from typing import Optional | ||
| from dotenv import load_dotenv | ||
|
|
||
| ADD_BUILD_INFO_LABELS = "* on (instance, job) group_left(version, commit) build_info" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The grafana dashboards use a slightly different query:
* on(instance, job) group_left(version, commit) (
last_over_time(
build_info[1s]
) or on (instance, job) up
)
Perhaps we should do this here as well? Here's the PR with the related change on the autometrics-shared repo: autometrics-dev/autometrics-shared#8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah good catch! i updated the queries + tests
flenter
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 minor things, but in general LGTM! 👍
Implements #25
Description for Reviewers
We should discuss how we want to pull in the commit and version info, especially in relation to the expected behavior in VSCode.
What Changed
Add an instance method of
set_build_infoto both the Prometheus and Otel trackersset_build_infois only called once (per tracker instance)UpDownCounter.When
create_trackeris called, we will automatically callset_build_infowith theAUTOMETRICS_COMMITandAUTOMETRICS_VERSIONenvironment variablesUpdate PromQL queries to use commit and version info
TODO
build_infoset_build_infoonce