Open gracewehner opened 3 years ago
It is similar in concept to zpages, but for prometheus metrics. Having it as an extension like zpages would be nice for decoupling, but looking at the zpages extension, it isn't actually very decoupled, since it is mostly implemented by the service itself, rather than the extension.
I'd lean towards using as much of the upstream prometheus code as we can. It may also be possible to request small changes in upstream prometheus if that would make things much easier for us.
Hi! @roidelapluie helpfully pointed me at this issue.
Just to let you know, there are two implementations of the UI in Prometheus:
Thanks @juliusv! I have it working with the React UI now with the same code as above that's using the Prometheus web package. Is there a place where the UI reusability work is tracked or a design proposal? I'd be happy to help with contributing this.
@gracewehner We don't have a properly tracked effort for it yet on the Prometheus side, as it's more of a loose aspiration of a couple of folks so far who are too distracted by other stuff as well :) Thanos did touch on this a bit in https://github.com/thanos-io/thanos/issues/2198 because it would make sense to reuse components there.
However, @Nexucis already laid some of the groundwork in Prometheus recently by breaking up the single React app into a multi-module structure all within the same repo (all living under https://github.com/prometheus/prometheus/tree/main/web/ui). The only module that is broken out so far is the PromQL text editor support code, but ultimately it could make sense to break out other reusable components in a similar way, so that external consumers like Thanos, Cortex, the Prometheus Receiver, etc. can just "plug together" a partial Prometheus UI that fits their needs. TBH I haven't fully thought through all the implications of that yet in terms of maintainability, reusability, and so on, so I guess this project is looking for someone to lead it :)
breaking up the single React
so accurate haha.
joke appart, I'm currently looking to good a candidate that will ultimately validate this new model. codemirror-promql
was a special case that cannot be really followed for other potentiel components.
I proposed to start with the Graph page here: https://github.com/prometheus/prometheus/issues/8685. But perhaps it's not the best candidate.
Like by looking at this issue, perhaps sharing the way to display the targets could be more interesting. (and let's be crazy, it could be the good opportunity to tackle the optimization issues around this page)
Is there any updates here?
Seem like the failed test from https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/23244 need to be fixed + approval and as well the MR https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/29622 need reopen/rebase and testing.
Currently, authoring scrape configs or debugging issues with scrape configs can be difficult and has a learning curve using just the debug logs of the prometheus receiver.
Prometheus has a web UI with the pages Targets, Service Discovery, and Configuration for this:
This UI uses html templates with the data filled by calling the scrape manager's functions. The prometheus receiver is using the same scrape manager in metrics_receiver.go, so the same functions to get the same data can be called to have an optional, similar UI.
A config option can be added for the prometheus receiver to enable hosting the UI as a local endpoint. The code that enables this would be in the Start() function of metrics_receiver.go, where the scrapeManager is created and run:
I currently have two different proof of concepts:
Directly using the web package of the Prometheus repo, creating the webHandler, passing it the configuration options including the scrapeManager, and running it. The only code changes needed would be something similar to above.
The issues with this approach are that:
Creating a new folder called web in the prometheusreceiver folder, copying over most of the golang code and html/css/js files but customizing the code to fix the above issues by:
However this means that a lot of the same code from the prometheus web package is copied over, including the html/css/js files.