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 · 11 comments · May be fixed by #11964
Open

Add expvar handler to zpages extension #11081

yurishkuro opened this issue Sep 7, 2024 · 11 comments · May be fixed by #11964
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
@codeboten codeboten added the extension/zpages zPages extension label Sep 19, 2024
@arsenalzp
Copy link

arsenalzp commented Nov 24, 2024

Hello colleagues,
Is this issue suitable for newcomers who wish to familiarize oneself with this great OpenTelemetry project?

@yurishkuro
Copy link
Member Author

Yes

@dridi-walid
Copy link

Hi, I'd like to work on it.

@HongChenTW
Copy link

Hi @yurishkuro , could you help to check this PR #11217 if is mergeable?

I'm not sure whether the implementation is suitable for the requirements in this issue, also, since this PR was created few months ago, could you help to guide how to safely update the PR branch with the latest commit in main branch, I want to prevent to reference on the others' commits and show up the actions I made in their issues & PRs.

e.g.
image

Thanks!

@yurishkuro
Copy link
Member Author

yes, it looks like a good PR. It's easier to use the Merge button on GitHub to avoid pulling other commits. If you want to re-create, you could start a fresh branch from the current main and use git cherry-pick to select the commits you need from the old branch.

@HongChenTW
Copy link

Thanks for the suggestion, I'll create another branch.

@david-sevcik
Copy link

Hello, is this issue free to take? Looks like it's already taken by looking at the comments, but nobody is assigned to this one 🤷

HongChenTW added a commit to HongChenTW/opentelemetry-collector that referenced this issue Dec 20, 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
6 participants