Question: is there any way to set tags?
shengwu opened this issue · comments
We are planning to use elixometer to send metrics to datadog (with exometer_datadog). I know it's possible with some of datadog's libraries to set tags on metrics. For example, the my_app_api_endpoint
metric could have a status_code
tag to record what code the method returned, a method
tag to record what the HTTP method was, and an endpoint
tag to record the endpoint.
Is there a way to record tags when updating a metric, maybe with optional parameters in a call like update_spiral("metrics_test.\#{thingie}.qps", 1)
? I looked through the source code, but it was not obvious whether this is supported.
Hi @shengwu, unfortunately tags are not supported when updating a metric. However you would be able to do to this by using exometer_core
directly and writing a :exometer_probe
with a version of :exometer_slide
that supports tagging values. While this may seem very complex, I do not think it would be as difficult as it sounds because exometer_core
contains a few examples of how do this, and the hardest parts can be copied from the existing :exometer_spiral
and :exometer_slide
.
Note that this would lose you the automatic creation/subscribing of metrics and thepobox
protection that elixometer
provides to prevent overloading a :exometer_probe
process. However again elixometer
also exposes enough to replicate this feature if you require it.
@fishcakez Thank you for responding so quickly! Glad to hear that it's possible with exometer.
By chance, would elixometer be open to a contribution adding this feature?
I have a fork zorbash/exometer@ac6197b which supports DataDog tags from configuration. I think that maybe exometer_report_statsd.erl can be changed to support dynamic (per metric update) tags.
How would you express the goal to capture response time metrics along with status code with elixometer
? Have a unique metric for each status code?
The information I would get is what response time is
and how many and what errors are there
?
Can I answer the second question with elixometer?
Thanks
Actually, the exometer_influxdb reporter already supports a feature to convert a chunk of metric as a tag: travelping/exometer_influxdb#3
Someone might find this helpful, so I'm still posting the comment