open-telemetry / opentelemetry-collector

OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
4.11k stars 1.37k forks source link

Make the service Host own an `http.Server` for extensions to use #5353

Open mx-psi opened 2 years ago

mx-psi commented 2 years ago

An idea that I had in mind for long time, is to actually embed the "zpages" into Host:

How I would design this is probably on the Host interface allow any component to "Register" a path/handler similar with http.ServerMux, something like:

RegisterHandler(pattern string, handler http.Handler)

Then we should extend the "service" configuration to accept an http server configuration for this, and maybe some options to say "register trace zpages", "register metrics zpages", etc.

The service.Host can accept this instance of the http.Server (similar to how you construct things like telemetry).

_Originally posted by @bogdandrutu in https://github.com/open-telemetry/opentelemetry-collector/pull/5294#discussion_r861912539_


See more details on the linked PR

jpkrohling commented 2 years ago

Should this be closed, given that #5294 has been merged?

mx-psi commented 2 years ago

No, I think this should be kept open. #5294 improved things a bit, but we may still want to do this.