-
Notifications
You must be signed in to change notification settings - Fork 4
Allow passing labels in new/4
, add format/2
#12
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9d6e984
to
ae9f1a1
Compare
michaelklishin
approved these changes
Sep 3, 2024
ae9f1a1
to
2b09eab
Compare
2b09eab
to
d1dc676
Compare
c05be20
to
72b907c
Compare
72b907c
to
85f6091
Compare
785161d
to
a4ddeea
Compare
Currently the extra info is only returned by `seshat:format/1`: it's useful to attach information you might use for Prometheus labels. Previously we used the counter's name as passed to `seshat:new/3` in the place of this label. Attaching extra info is useful for QQs in RabbitMQ for example. They need to attach the queue name and vhost so that info can be exposed to Prometheus.
This will be useful in RabbitMQ to expose Khepri metrics for example: we want to select just Khepri's metrics out of the `ra` group.
A metrics without labels has a name which could be used as the label value, but it's not clear what label key should be in this case. For example, if a metric is declared like this: seshat:new(Group, ghost, [{foo, 1, counter, "Total foos given"}]), then what it'd look like in the Prometheus endpoint? ``` foo{...="ghost"} N ```
Rename things to more resemble how Seshat is used in real life.
Refactor to make variable names consistent: * Name sometimes referred to the metric name, and sometimes to the object emiting the metrics; going forward, it's either Id (object) or Name (metric) * counter index was sometimes referred to as Position (now, always Index) * metric help was sometiems referred to as Description (now, always Help) * Fields/FieldSpec/FieldName were used inconsistently (because Fields and FieldSpec can be the same thing); hopefully it's more clear now * counter referece was sometimes Ref and sometimes CRef (now, always CRef)
seshat:text_format/3 produces a binary that contains the text representation of the metrics in the Prometheus exposition format, so that it can be returned as-is by a Prometheus endpoint
c521040
to
0b08222
Compare
0b08222
to
98da67c
Compare
Given how much this PR has evolved (barely matches this description), closing this PR. A new one is coming soon |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These are some changes to make it easier to expose metrics stored in seshat via prometheus. Two changes:
label() :: term()
in a newseshat:new/4
function. This is exposed inseshat:format/1
as the key of thevalues
map. We can use this in RabbitMQ to attach the queue resource for a QQ to its counter so that we can switch from reading out of thera_metrics
ETS table to using Ra counters.seshat:new/3
uses theName
as the label which means there's no change in behavior for callers usingseshat:new/3
.seshat:format/2
function to format metrics for only one member of a group. We can use this in RabbitMQ to read and expose Khepri's metrics without scanning the whole ETS table for thera
group.