Clustering - Cannot read property 'responses' of undefined
See original GitHub issuehttps://github.com/siimon/prom-client/blob/master/lib/cluster.js#L159
I am attempting run prometheus in an application that collects metrics for calls within koa middleware
But I am finding that this line
const request = requests.get(message.requestId);
returns undefined, causing line 159 to throw the error Cannot read property 'responses' of undefined
Its also worth mentioning I’m running metrics through a node proxy server and collecting metrics in the middleware itself - if i guard on the presence of request, it appears to work as expected
if (request) {
message.metrics.forEach(registry => request.responses.push(registry));
request.pending--;
// etc
}
The middleware is mounted at /api
where i’m using promClient.Histogram to time calls
I’m afraid I don’t understand the code well enough to understand why the request is undefined. Is anyone available to walk me through this?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
I had encountered same issue. It turned out that my worker script imported two copy of module
prom-client
@montykamath
There’s no state like that, no. If you have a full repro that you can post, I’ll try to take a look.