-
I am trying to expose Prometheus metrics for my services. The open source base module is @gasbuddy/service, and the relevant code: App startup: https://github.com/gas-buddy/service/blob/main/src/express-app/app.ts#L37 And when I make a counter and increment it: I would expect that getting metrics from the metrics endpoint would return a counter. But it does not, it returns a blank object. When I print the collection result, I see this: {"resourceMetrics":{"resource":{"attributes":{}},"scopeMetrics":[{"scope":{"name":"fake-serv","version":""},"metrics":[]}]},"errors":[]} My counter is not there nor is a value for it. Any idea what I'm doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
It's not entirely clear to me what opentelemetry provides in this instance - perhaps I would be better off just using prom-client? |
Beta Was this translation helpful? Give feedback.
-
I think I've figured it out - if you add metrics BEFORE the exporter has been added as a metric reader, they will not ever be collected. This definitely seems like a bug, if people agree I can try and file one. |
Beta Was this translation helpful? Give feedback.
I think I've figured it out - if you add metrics BEFORE the exporter has been added as a metric reader, they will not ever be collected. This definitely seems like a bug, if people agree I can try and file one.