-
Background/Warning: I'm the at least mildly confused guy from one of the OTel transition presentation slide decks that can't yet his head around the Go OTel SDK, so begging for help here. I simply struggle getting the picture with meter providers, propagators, meters, ... Please note that I'm not in the situation of instrumenting HTTP handlers or similar where the OTel Go SDK has lots of examples. Instead, I'm in the situation of having collected metrics via completely OTel-independent means, such as Linux kernel APIs, et cetera. Unfortunately, for the metrics I need to collect, there are often neither Prometheus nor OTel exporters available, so that nicely puts food on my table. Coming from the Prometheus Go client, in the past I just whipped up something that implements the So, I simply want to export a bunch of counter metrics, easy to do so far using the Prometheus Go client API. Lots of documentation also covering my use case where I collect the metrics outside the SDK. Now looking at the OTel metrics SDK 😭 Which elements do I need to create and wire up in case of the OTel Go SDK, to push my metrics gathered outside of the SDK to, say, Prometheus using the OTel protocol? (HTTP one in case of Prometheus?) Please note that I don't want to throw the OTel collector into the mix, making an otherwise minimalist setup overly complex. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
You may be looking for this prometheus example, which shows how to create metrics and expose them to the prometheus client. |
Beta Was this translation helpful? Give feedback.
-
I think you might be looking for https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric#WithProducer and use it with a periodic reader and OTLP exporter. |
Beta Was this translation helpful? Give feedback.
I think you might be looking for https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric#WithProducer and use it with a periodic reader and OTLP exporter.