Closed vHanda closed 1 year ago
Thanks for the effort, but I don't really see the point of having this very specific behavior. In my opinion you can achieve the same result with customLabels
and transformLabels
.
Here you can see an example of adding a custom label (year): https://github.com/jochen-schweizer/express-prom-bundle/blob/master/advanced-example.js#L13
Ah. Thanks.
I didn't notice the customLabels. This was so much easier than I thought -
customLabels: { generalized_status: null },
transformLabels: (labels) => {
Object.assign(labels, {
generalized_status: generalizeStatusCode(labels.status_code),
});
},
It is disabled by default. This way, one has the option of storing both the actual status_code and the generalized one.
Before this commit one could provide a custom function to convert the status_code but that would result in the original status_code being lost.