Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add expvar handler to zpages extension #11081

Open
yurishkuro opened this issue Sep 7, 2024 · 4 comments · May be fixed by #11217
Open

Add expvar handler to zpages extension #11081

yurishkuro opened this issue Sep 7, 2024 · 4 comments · May be fixed by #11217
Labels
extension/zpages zPages extension good first issue Good for newcomers help wanted Good issue for contributors to OpenTelemetry Service to pick up

Comments

@yurishkuro
Copy link
Member

yurishkuro commented Sep 7, 2024

Is your feature request related to a problem? Please describe.

Go stdlib's expvar provides some useful information about Go runtime, and sometimes it is used by various libraries that could be imported by OTEL components to report their own internal state. But the HTTP handler is not exposed by default so there is no way to introspect that state of the libraries in the collector.

Describe the solution you'd like

Since zpage extension is the agreed mechanism for introspection of the running collector, and already provides a webserver, we can register expvar handler on that server (also mentioned in #2155 (comment)).

The zpage extension config can have a flag that enables expvar, which could be off by default.

Describe alternatives you've considered
There could be a separate expvar extension just to create a new webserver and open a port, but it seems like an overkill and not aligned with zpages as the main introspection facility.

@yurishkuro yurishkuro added help wanted Good issue for contributors to OpenTelemetry Service to pick up good first issue Good for newcomers labels Sep 8, 2024
@HongChenTW
Copy link

Hi @yurishkuro, I'd like to try this one, it seems a good opportunity to understand the zpage extension implementation.

@yurishkuro
Copy link
Member Author

@HongChenTW go for it. I temporarily created an internal extension in Jaeger as a workaround jaegertracing/jaeger#5986

@HongChenTW
Copy link

Hi @yurishkuro , after digging into code, I found that I could register the expvar handler to expose the expvar pages at here, with some adjustments(declare the expvarz path variable, add port, on/off configs, etc.), but I'm not sure if I'm in the right path.

e.g. zPagesMux.Handle(path.Join("/debug", "expvarz"), expvar.Handler())

But I also noticed other components in zpages extention draw html pages like tracez or featurez, should I also design a html template to render the expvar, could you give some advises?

Thanks!

@yurishkuro
Copy link
Member Author

@HongChenTW I would start with just the default, out of the box expvar.Handler(). It returns JSON which is already pretty readable, and there are probably tools today that can scrape that format if someone needs it. I personally just used a browser plugin for JSON rendering so that I can expand/collapse some of the more complex structures supported by the expvar package.

HongChenTW added a commit to HongChenTW/opentelemetry-collector that referenced this issue Sep 19, 2024
resolve open-telemetry#11081

Signed-off-by: Hong Chen <hong.chen.7219@gmail.com>
@codeboten codeboten added the extension/zpages zPages extension label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension/zpages zPages extension good first issue Good for newcomers help wanted Good issue for contributors to OpenTelemetry Service to pick up
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants