Dynamic label for distribution metrics #564
Replies: 9 comments
-
@BlueSeaOcean one way to do what you're trying to do will be too use two eventmetrics with different labels:
|
Beta Was this translation helpful? Give feedback.
-
@manugarg My understanding is successEM and failEM in your comment refer to counter metrics.
|
Beta Was this translation helpful? Give feedback.
-
No, it's a way of segregating metrics by success and failures. Both EMs (EventMetrics -- things that you export) can contain "total", "success", "latency" metrics of their own.
Metrics (in cloudprober terms) don't have labels
I think you're getting confused here a bit (or maybe I am not understanding it properly). Having two EventMetrics doesn't mean you'll have two different metric names. See my example in the previous comment. With that you'll see prometheus metrics like this:
|
Beta Was this translation helpful? Give feedback.
-
@manugarg Thank you for clarification. I'll experiment more and let you know. |
Beta Was this translation helpful? Give feedback.
-
@BlueSeaOcean It depends on what you're counting -- what's the measurement here. If want to count status codes, you'll just have one metric say resp_code:
See this for example: cloudprober/probes/http/http.go Line 394 in 8f0685b If you're trying to count something else by numeric response code, then it becomes more complicated. |
Beta Was this translation helpful? Give feedback.
-
@BlueSeaOcean if you can share what you're trying to do, I can perhaps provide more useful feedback. Cheers, |
Beta Was this translation helpful? Give feedback.
-
@manugarg Thank you very much. Your suggestion is very close. Does the cloud prober support below where we don't get response code from the server?
|
Beta Was this translation helpful? Give feedback.
-
Simple counters are easy, e.g. total{..} in the example above is just a status counter. You could use a map for that: statusCount = metrics.NewMap(status)
Distributions don't support map values, so you cannot add a dimension to a distribution level. Note that in Cloudprober, latency is added only for successes. |
Beta Was this translation helpful? Give feedback.
-
@manugarg Thanks. That's what I explored so far before opened the topic as well. Do we have any plan for distributions to support map values? If not, may I know the justification behind? |
Beta Was this translation helpful? Give feedback.
-
I use cloudprober extension and expect to have following metrics with "status" label to indicate whether a response is success or fail.
Is there anyway to add the dynamic label for the distribution metric?
Beta Was this translation helpful? Give feedback.
All reactions