dbader / node-datadog-metrics

Buffered metrics reporting via the DataDog HTTP API
https://dbader.org/blog/monitoring-your-nodejs-app-with-datadog
MIT License
142 stars 58 forks source link

supplying units/metric metadata #33

Open d1manson opened 6 years ago

d1manson commented 6 years ago

I know you can change set metric metadata in the main datadog interface - as explained here, and there is a way of doing it with an api, but is there any way/plans to expose it in this module?

An optional argument to histogram (and friends) would be ideal..you could cache the last metadata values and only send them if there is a change?

csabapalfi commented 6 years ago

Sounds like a great addition to the module. Would you be interested in contributing this in a PR? 😄

d1manson commented 6 years ago

perhaps..we shall see!

Mr0grog commented 1 year ago

Noting for future reference: this comes with similar caveats as #81. The docs indicate that setting units as part of metric submission is only in the v2 API, which formats things differently, has shorter limits on metric names, and a smaller maximum payload size. There’s likely to be a fair amount that would have to change under the hood to make this work (which doesn’t mean it shouldn’t be done or isn’t worthwhile!).

Another oddity is that the v2 lets you set the unit, but not the per_unit, so it only goes halfway to matching what you can configure in Datadog’s UI.

(One alternative here might be some mechanism that uses the edit metric metadata endpoint, but that would only work if someone includes an appKey in addition to their apiKey, and increases potential security risks for users to consider. It’s probably not a good approach.)