Open mgoshorn opened 3 years ago
Hi @mgoshorn,
Thank you for the feature-request!
You are right that Guage metrics are not supported by the the agent (or any New Relic agent), currently. The only way to get Guage metrics is via the Metrics API. The newer metric dimensional types in the API are not currently integrated into the primary agents.
To work with current functionality, you can leverage the count
field on timeslice metrics. The incrementMetric(name, value)
API only increments the metric count. If you do not pass a value, it increments by 1. If you pass a value, it will increment the metric's count by that value. This requires you to remember/understand you'll retrieve these metrics as counts but can at least simulate what you want in a Guage. https://docs.newrelic.com/docs/apm/agents/nodejs-agent/api-guides/nodejs-agent-api/#increment_metric
Thank you for the recommendation, @michaelgoin.
Will this work for data that isn't strictly incrementing? In the case described above, I expect our currently connected user count to also decrement when users disconnect from the service.
@mgoshorn For the count, it does a simple addition so I believe using a negative value would result in decrementing. I have not tried this myself, though. It may be worth noting as well that these are sent up once a minute, so via this approach they will be capturing the current active count on that interval.
We are exploring Dimensional metrics support as part of this feature - https://new-relic.atlassian.net/browse/NR-191666
Is your feature request related to a problem? Please describe.
When working with custom metrics, it seems there is only support for timeslice metrics. This works well for metrics that should naturally be summed when looking at a timeslice (eg. requests during a period), but poorly for data that we would not naturally want summed (eg. reporting current total number of active websocket connections). Based on the documentation for Metric data structure, it seems like a Gauge metric would best fit the second case. As far as I can tell, there does not seem to be a way to report custom gauge metrics through the NodeJS agent. If this isn't the case, then I would be very happy to hear about the proper way to track this kind of data.
Feature Description
Use NodeJS agent to record and report custom metrics of the type Gauge (or of any type listed in documentation).
Describe Alternatives
Alternative would be a custom integration with the Metrics API, however this seems a bit clumsy when the agent is already configured to talk with NR.
Additional context
N/A
Priority
Please help us better understand this feature request by choosing a priority from the following options: [Nice to Have, Really Want, Must Have, Blocker]
Really Want