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

Dynamic graphs registration #118

Open
AlekSi opened this issue Dec 21, 2023 · 2 comments
Open

Dynamic graphs registration #118

AlekSi opened this issue Dec 21, 2023 · 2 comments

Comments

@AlekSi
Copy link

AlekSi commented Dec 21, 2023

It would be nice to be able to add graphs dynamically. For example, we wanted to convert Prometheus metrics to Statsviz graphs, with one graph per Prometheus label value. But the full set of values is not known in advance, so it is not possible to pass all options to statsviz.Register.

It is almost possible to do now by creating Statsviz HTTP handler on the fly in the other HTTP handler:

// pseudocode
http.HandleFunc("/debug/graphs", func(rw http.ResponseWriter, req *http.Request) {
	s, _ := statsviz.NewServer()
	s.Index().ServeHTTP(rw, req)
})

Unfortunately, there are two handlers: Index() and Ws(). Maybe it is possible to create a single handler that would route to one or another based on, say, HTTP headers?

@AlekSi
Copy link
Author

AlekSi commented Jan 14, 2024

@arl WDYT?

@arl
Copy link
Owner

arl commented Jan 14, 2024

Hi. I understand the use case but can you detail a bit the technical solution you'd use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants