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

feature request: support OpenMetrics text format and exemplar #143

Open
wangrzneu opened this issue Jul 5, 2022 · 2 comments
Open

feature request: support OpenMetrics text format and exemplar #143

wangrzneu opened this issue Jul 5, 2022 · 2 comments

Comments

@wangrzneu
Copy link

Exemplar can provide a correlation between metrics and traces. https://prometheus.io/docs/instrumenting/exposition_formats/#exemplars-experimental
If you think the feature can be accepted, I can work on it.

@knyar
Copy link
Owner

knyar commented Jul 8, 2022

Thank you for proposing this. This does seem like a useful addition.

In terms of the API, I think inc and observe can accept two additional optional arguments: one with a table for exemplar labels, the second for exemplar timestamp;

counter:inc(value, label_values, {trace_id='d97fc242f0'})
histogram:observe(value, label_values, {}, ngx.now())  -- exemplar with no labels, but a timestamp

In terms of storage, I think we can store exemplar values serialized in the main dictionary, namespaced separately via a reserved key prefix, akin to KEY_INDEX_PREFIX.

Any other design decisions we should discuss before implementing this?

@wangrzneu
Copy link
Author

I think a data storage like lua-resty-counter needs to be implemented. The exemplar labels and timestamp will be stored in it. The key have a suffix :exemplar, for example http_count{host="me.com",status="200"}:exemplar, and the value is just like {trace_id="d97fc242f0"},1657556919.

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

No branches or pull requests

2 participants