mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-12 22:37:27 -08:00
95554074d8
* React UI: Support custom path prefixes The challenge was that the path prefix can be set dynamically as a flag on Prometheus, but the React app bundle is statically compiled in to expect a given path prefix. By adding a placeholder value to the React app's index.html and replacing it in Prometheus with the right path prefix during serving, this injects Prometheus's path prefix into the React app via a global const. Threading the path prefix into the different React components could have been done with React's Contexts (https://reactjs.org/docs/context.html), but I found the consumer side of context values to be a bit cumbersome (wrapping entire components in context consumers), so I ended up preferring direct threading of the path prefix values to components that needed them. Also, using contexts in tests is more verbose than just passing in path prefix values directly. Fixes https://github.com/prometheus/prometheus/issues/6163 Signed-off-by: Julius Volz <julius.volz@gmail.com> * Review feedback Signed-off-by: Julius Volz <julius.volz@gmail.com> |
||
---|---|---|
.. | ||
react-app | ||
static | ||
templates | ||
assets_generate.go | ||
doc.go | ||
README.md | ||
ui.go |
The ui
directory contains static files and templates used in the web UI. For
easier distribution they are statically compiled into the Prometheus binary
using the vfsgen library (c.f. Makefile).
During development it is more convenient to always use the files on disk to
directly see changes without recompiling.
To make this work, remove the builtinassets
build tag in the flags
entry
in .promu.yml
, and then make build
(or build Prometheus using
go build ./cmd/prometheus
).
This will serve all files from your local filesystem. This is for development purposes only.