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

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

Open mx-psi opened this issue 3 years ago • 2 comments
trafficstars

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

  • Host will have to start an "http.Server" that can be shared between "health check", "zpages", "status", "etc.".
  • If we do this, the zpages/health extensions (maybe) becomes almost a no-op.

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

mx-psi avatar May 12 '22 10:05 mx-psi

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

jpkrohling avatar Jul 04 '22 12:07 jpkrohling

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

mx-psi avatar Jul 04 '22 16:07 mx-psi