Reputation: 463
I'm having trouble figuring out how to append exemplars to my metrics. my code is in python and i'm using prometheus-client library. i have my code instrumented for metrics but i still haven't been able to integrate data as exemplars to it.
my ultimate goal is to visualize my trace data as exemplars on my metrics panel in grafana dashboards.
In my application i create a simple counter that keeps track of the number of http requests. I add a few labels to that counter. I can see the metrics prometheus pulls from the app and i can also visualize them on grafana but i can't find the way to append the trace data as an exemplar and also visualize it (yes i'm using grafana 8 and it supports exemplars)
this is my code for instrumentation using a counter
tasks_counter = Counter(
name='outgoing_x_http_requests',
documentation='counter for http requests from server x',
labelnames=['status_code', 'method', 'path']
)
def send_X():
// send request to server ...
// response_object = returned values from server
// my counter .. also adding labels to it
tasks_counter.labels(
status_code="some integer",
method="some method",
path="some path",
).inc(1)
i tried adding the trace id and span id as labels to the counter but it doesn't work. It's not how you create exemplars because they're not popping on my metrics graph ... what am i doing wrong?
Upvotes: 1
Views: 3102
Reputation: 40406
There's an example (using Counter) here:
But the PR is not yet merged.
Upvotes: 2