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

Add exemplar support #51

Merged
merged 1 commit into from
Jun 14, 2023
Merged

Add exemplar support #51

merged 1 commit into from
Jun 14, 2023

Conversation

actualwitch
Copy link
Contributor

No description provided.

@actualwitch actualwitch force-pushed the add-exemplars branch 3 times, most recently from 20ca9fa to f1fbf1d Compare June 13, 2023 14:16
@actualwitch actualwitch requested a review from flenter June 13, 2023 14:16
from ..objectives import Objective


prometheus_client.REGISTRY.unregister(prometheus_client.GC_COLLECTOR)
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you add a comment explaining these unregister calls? was this something we should've been doing all along?

not sure if this is what you read, but this thread seemed relevant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my bad, i set that when i was debugging exemplars but forgor 💀 to remove it. we probably shouldn't set these in autometrics.

Copy link
Collaborator

@brettimus brettimus left a comment

Choose a reason for hiding this comment

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

tested with your example + the modified version of quickmetrics! works like a charm

only change i'd request is a comment explaining the logic of unregistering some of the default collectors

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.

👍 nice!

README.md Outdated
@@ -130,6 +134,15 @@ The `version` is read from the `AUTOMETRICS_VERSION` environment variable, and t

This follows the method outlined in [Exposing the software version to Prometheus](https://www.robustperception.io/exposing-the-software-version-to-prometheus/).

## Exemplars

> **NOTE** - As of writing, aren't supported by the default tracker (`AUTOMETRICS_TRACKER=OPEN_TELEMETRY`).
Copy link
Member

Choose a reason for hiding this comment

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

I think the word exemplars is missing here:

As of writing, exemplars aren't supported...

Copy link
Member

Choose a reason for hiding this comment

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

I was also thinking that maybe it's better to first explain what exemplars are before mentioning the limitations/caveats

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good eye! indeed, the word was missing - fixed now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i added the note above for consistency with the previous paragraph, it would look like this:
Screenshot 2023-06-14 at 10 59 07

i think since it's quoted people can just look below, but the quoted part is quite big. if you think it's not obvious i will move the note below

Copy link
Member

Choose a reason for hiding this comment

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

It makes more sense to me to explain first and then mention what the caveats are especially if people aren't super familiar with what exemplars are even if you can skip, notes are typically important so for me (personally) I would still try to read it first., but that's just anecdotal (and also I don't feel that strongly about it) so i'm fine with leaving it the way you have it now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i ended up moving a bunch of text from the quoted part below, i think this should be fine now
Screenshot 2023-06-14 at 14 19 30

self.__count(function, module, caller, objective, result)
self.__histogram(function, module, start_time, objective)
exemplar = None
# Currently, exemplars are only supported by prometheus-client
Copy link
Member

Choose a reason for hiding this comment

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

I think it might be good to keep an issue open for this. So we can refer to it from our source code and also have a place to talk about how to deal/resolve this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we actually have one! i added a backlink there and also linked the issue from code

@actualwitch
Copy link
Contributor Author

i also updated the example to show we track exemplars for all autometrized functions inside the span, a la rust version

@actualwitch actualwitch force-pushed the add-exemplars branch 7 times, most recently from 016c8fe to 4e83474 Compare June 14, 2023 13:09
@actualwitch actualwitch merged commit aea0bce into main Jun 14, 2023
@actualwitch actualwitch deleted the add-exemplars branch July 12, 2023 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants