pinterest / elixometer

A light Elixir wrapper around exometer.
https://hexdocs.pm/elixometer
Apache License 2.0
827 stars 67 forks source link

Question: is there any way to set tags? #92

Open shengwu opened 7 years ago

shengwu commented 7 years ago

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.

fishcakez commented 7 years ago

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.

shengwu commented 7 years ago

@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?

fishcakez commented 7 years ago

I'm not immediately sure about this. Likely adding a tagged spiral would double the size of the code base 😨. It might be preferable for elixometer to support custom metrics, similar to the update or create feature of exometer.

On 26 Aug 2017 3:29 pm, "Sheng Wu" notifications@github.com wrote:

@fishcakez https://github.com/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?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pinterest/elixometer/issues/92#issuecomment-325165377, or mute the thread https://github.com/notifications/unsubscribe-auth/AB6JTfaaYw4RGxkm3B9nAxIgFjkky-OBks5scJxigaJpZM4PDky8 .

zorbash commented 7 years ago

I have a fork https://github.com/Zorbash/exometer/commit/ac6197b203258efe696b54c33e1ceb002eb09e38 which supports DataDog tags from configuration. I think that maybe exometer_report_statsd.erl can be changed to support dynamic (per metric update) tags.

Kukunin commented 5 years ago

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

Kukunin commented 5 years ago

Actually, the exometer_influxdb reporter already supports a feature to convert a chunk of metric as a tag: https://github.com/travelping/exometer_influxdb/issues/3

Someone might find this helpful, so I'm still posting the comment