Ignore routes without an id
dnlup opened this issue Β· comments
What happens if I don't pass an ID, but I use inside the route sendGaugeMetric
, do we need to metric it or not? I think in this case, we can don't decorate the request/reply with the methods.
π€ that's a good point. I think maybe we could either:
- handle this internally using the same strategy:
- use an util function to check if the route should be skipped and use it manually in each method that send a metric
- centralise this check somehow, maybe with a proxy approach or something that allows us to call those methods with the check baked in
- decorate req and reply with a boolean that says if the route should be ignored and let the user handle it
I need to think about it a little more, do you have something else in mind?
The problem is that the label function, in this case, has no id. Then if I allow using the function, I will enable the user to send a metric without an ID. From my view we have these possibilities:
- Make
sendMetrics
nope functions, but I don't like it. - do
sendMetrics
throw
WDYT?
Another point is that because we make ID required, can we evaluate the possibility of making it more visible?
The problem is that the label function, in this case, has no id.
π€ The label function should be able to access the routeId
from <request|reply>.context.config.metrics.routeId
or options.config.metrics.routeId
. Does that solves the problem for you?
sendMetrics
should not throw, it would be against the concept of ignoring a route.
Another point is that because we make ID required, can we evaluate the possibility of making it more visible?
What do you mean by "more visible"?
π This issue has been resolved in version 2.0.0 π
The release is available on:
Your semantic-release bot π¦π