opentelemetry-java icon indicating copy to clipboard operation
opentelemetry-java copied to clipboard

Don't force reliance on Prometheus HTTP Server

Open hdost opened this issue 3 years ago • 3 comments

👋🏼 https://github.com/open-telemetry/opentelemetry-java/pull/4185 As it seems there's a desire for feedback on this. My first inclination is that mandating a particular HTTP server is restrictive. By limiting consumption of the MetricReader to the Prometheus Collector anyone using alternative HTTP Frameworks can easily keep their applications integrated. This is actually my usecase 😓

Originally posted by @hdost in https://github.com/open-telemetry/opentelemetry-java/discussions/4235#discussioncomment-2297369

hdost avatar Mar 21 '22 10:03 hdost

Hi @hdost - sorry for missing this issue from so many months ago. While the built-in server is meant to be easy to get going, I agree that being able to use a different HTTP framework is good, and is what I'd do in my apps too. We'd probably want to add a byte[] serialize type of method instead of encoding into a collector for that use case, which allows using our optimized serialization code. Would that satisfy your use case?

anuraaga avatar May 23 '22 08:05 anuraaga

@anuraaga I guess that depends, I would need to think a bit more as potentially there might be selectors which could be useful. Especially as there may be potential want/need in the future to export in Protobuf Prometheus Format for Sparse Histograms

hdost avatar May 23 '22 11:05 hdost

Thanks for the context @hdost - my understanding was that OTel settled on the text protocol for Prometheus via the push there in OpenMetrics. If there is community consensus for supporting protobuf as well, then we would definitely need to add support for marshaling it here too.

anuraaga avatar May 24 '22 01:05 anuraaga

@anuraaga Going back to this. I am trying to think more about how we could utilize the serializer. Would it make sense to make the serializer public? Perhaps we could do a contrib instead that's just Serializer exporter.

hdost avatar Sep 21 '22 17:09 hdost

@anuraaga I've hit this issue as well where actually having the PrometheusCollector would be a much more flexible choice compared to the PrometheusHttpServer. In my use case I'm replacing dropwizard with opentelemetry. To keep both running on the same prometheus server, we basically need the PrometheusCollector to use it with the prometheus java client.

nicu-da avatar Oct 06 '22 15:10 nicu-da

After talking internally I could also be desirable to make it more compatible with explicit parameter by being able to pass in a registry

hdost avatar Oct 28 '22 12:10 hdost

Take a look at opentelemetry-java-contrib#660, which adds PrometheusCollector as a published component in opentelemetry-java-contrib. It could use another maintainer if @hdost or @nicu-da are interested.

jack-berg avatar Dec 22 '22 19:12 jack-berg

I'm going to close this now that opentelemetry-java-contrib#660 is merged. If that is still insufficient, we can reopen this issue to discuss options for adding a byte[] serialize method to allow use with other HTTP servers.

jack-berg avatar Dec 29 '22 21:12 jack-berg

Thank you 🙏

hdost avatar Jan 01 '23 23:01 hdost