I’m trying to add exemplars to the metrics generated in my Javascript based API. I’m using the opentelemetry JS API and SDK to instrument my code.
This is my counter.
/**
* Using a counter to measure the total number of posts received by the API
*/
exports.postCount = apiMeter.createCounter('api.posts.count.total', {
description: "Total number of posts received",
unit: "posts"
});
And I increment in conditionally
// inside the condition
postCount.add(1)
How do I add the exemplars using Opentelemetry API? I tried adding my Trace Context as labels like this
postCount.add(1, {trace_id: xxxxeeia});
but I figured later it’s the wrong way to do it.