Default to serving new (Prometheus 3.0) UI

Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
Julius Volz 2024-09-04 21:33:37 +02:00
parent d0ee5427bd
commit c73c3e24d7
5 changed files with 34 additions and 25 deletions

View File

@ -250,9 +250,9 @@ func (c *flagConfig) setFeatureListOptions(logger log.Logger) error {
continue
case "promql-at-modifier", "promql-negative-offset":
level.Warn(logger).Log("msg", "This option for --enable-feature is now permanently enabled and therefore a no-op.", "option", o)
case "new-ui":
c.web.UseNewUI = true
level.Info(logger).Log("msg", "Serving experimental new web UI.")
case "old-ui":
c.web.UseOldUI = true
level.Info(logger).Log("msg", "Serving previous version of the Prometheus web UI.")
default:
level.Warn(logger).Log("msg", "Unknown option for --enable-feature", "option", o)
}
@ -495,7 +495,7 @@ func main() {
a.Flag("scrape.name-escaping-scheme", `Method for escaping legacy invalid names when sending to Prometheus that does not support UTF-8. Can be one of "values", "underscores", or "dots".`).Default(scrape.DefaultNameEscapingScheme.String()).StringVar(&cfg.nameEscapingScheme)
a.Flag("enable-feature", "Comma separated feature names to enable. Valid options: agent, auto-gomaxprocs, auto-gomemlimit, concurrent-rule-eval, created-timestamp-zero-ingestion, delayed-compaction, exemplar-storage, expand-external-labels, extra-scrape-metrics, memory-snapshot-on-shutdown, native-histograms, new-service-discovery-manager, new-ui, no-default-scrape-port, otlp-write-receiver, promql-experimental-functions, promql-delayed-name-removal, promql-per-step-stats, remote-write-receiver (DEPRECATED), utf8-names. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for more details.").
a.Flag("enable-feature", "Comma separated feature names to enable. Valid options: agent, auto-gomaxprocs, auto-gomemlimit, concurrent-rule-eval, created-timestamp-zero-ingestion, delayed-compaction, exemplar-storage, expand-external-labels, extra-scrape-metrics, memory-snapshot-on-shutdown, native-histograms, new-service-discovery-manager, no-default-scrape-port, old-ui, otlp-write-receiver, promql-experimental-functions, promql-delayed-name-removal, promql-per-step-stats, remote-write-receiver (DEPRECATED), utf8-names. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for more details.").
Default("").StringsVar(&cfg.featureList)
promlogflag.AddFlags(a, &cfg.promlogConfig)

View File

@ -57,7 +57,7 @@ The Prometheus monitoring server
| <code class="text-nowrap">--query.max-concurrency</code> | Maximum number of queries executed concurrently. Use with server mode only. | `20` |
| <code class="text-nowrap">--query.max-samples</code> | Maximum number of samples a single query can load into memory. Note that queries will fail if they try to load more samples than this into memory, so this also limits the number of samples a query can return. Use with server mode only. | `50000000` |
| <code class="text-nowrap">--scrape.name-escaping-scheme</code> | Method for escaping legacy invalid names when sending to Prometheus that does not support UTF-8. Can be one of "values", "underscores", or "dots". | `values` |
| <code class="text-nowrap">--enable-feature</code> <code class="text-nowrap">...<code class="text-nowrap"> | Comma separated feature names to enable. Valid options: agent, auto-gomaxprocs, auto-gomemlimit, concurrent-rule-eval, created-timestamp-zero-ingestion, delayed-compaction, exemplar-storage, expand-external-labels, extra-scrape-metrics, memory-snapshot-on-shutdown, native-histograms, new-service-discovery-manager, new-ui, no-default-scrape-port, otlp-write-receiver, promql-experimental-functions, promql-delayed-name-removal, promql-per-step-stats, remote-write-receiver (DEPRECATED), utf8-names. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for more details. | |
| <code class="text-nowrap">--enable-feature</code> <code class="text-nowrap">...<code class="text-nowrap"> | Comma separated feature names to enable. Valid options: agent, auto-gomaxprocs, auto-gomemlimit, concurrent-rule-eval, created-timestamp-zero-ingestion, delayed-compaction, exemplar-storage, expand-external-labels, extra-scrape-metrics, memory-snapshot-on-shutdown, native-histograms, new-service-discovery-manager, no-default-scrape-port, old-ui, otlp-write-receiver, promql-experimental-functions, promql-delayed-name-removal, promql-per-step-stats, remote-write-receiver (DEPRECATED), utf8-names. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for more details. | |
| <code class="text-nowrap">--log.level</code> | Only log messages with the given severity or above. One of: [debug, info, warn, error] | `info` |
| <code class="text-nowrap">--log.format</code> | Output format of log messages. One of: [logfmt, json] | `logfmt` |

View File

@ -226,11 +226,11 @@ This has the potential to improve rule group evaluation latency and resource uti
The number of concurrent rule evaluations can be configured with `--rules.max-concurrent-rule-evals`, which is set to `4` by default.
## Experimental new web UI
## Serve old Prometheus UI
Enables the new experimental web UI instead of the old and stable web UI. The new UI is a complete rewrite and aims to be cleaner, less cluttered, and more modern under the hood. It is not feature complete yet and is still under active development.
Fall back to serving the old (Prometheus 2.x) web UI instead of the new UI. The new UI that was released as part of Prometheus 3.0 is a complete rewrite and aims to be cleaner, less cluttered, and more modern under the hood. However, it is not fully feature complete and battle-tested yet, so some users may still prefer using the old UI.
`--enable-feature=new-ui`
`--enable-feature=old-ui`
## Metadata WAL Records

View File

@ -141,7 +141,16 @@ export default function RulesPage() {
<IconTimeline size={15} />
</Tooltip>
)}
<Text>{r.name}</Text>
<Text
ff={
r.type === "recording"
? '"DejaVu Sans Mono", monospace'
: undefined
}
fz={r.type === "recording" ? "sm" : "md"}
>
{r.name}
</Text>
</Group>
<Group gap="xs">
<Group gap="xs" wrap="wrap">

View File

@ -270,7 +270,7 @@ type Options struct {
UserAssetsPath string
ConsoleTemplatesPath string
ConsoleLibrariesPath string
UseNewUI bool
UseOldUI bool
EnableLifecycle bool
EnableAdminAPI bool
PageTitle string
@ -384,9 +384,9 @@ func New(logger log.Logger, o *Options) *Handler {
router = router.WithPrefix(o.RoutePrefix)
}
homePage := "/graph"
if o.UseNewUI {
homePage = "/query"
homePage := "/query"
if o.UseOldUI {
homePage = "/graph"
}
if o.IsAgent {
homePage = "/agent"
@ -398,15 +398,15 @@ func New(logger log.Logger, o *Options) *Handler {
http.Redirect(w, r, path.Join(o.ExternalURL.Path, homePage), http.StatusFound)
})
if o.UseNewUI {
if !o.UseOldUI {
router.Get("/graph", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, path.Join(o.ExternalURL.Path, "/query?"+r.URL.RawQuery), http.StatusFound)
})
}
reactAssetsRoot := "/static/react-app"
if h.options.UseNewUI {
reactAssetsRoot = "/static/mantine-ui"
reactAssetsRoot := "/static/mantine-ui"
if h.options.UseOldUI {
reactAssetsRoot = "/static/react-app"
}
// The console library examples at 'console_libraries/prom.lib' still depend on old asset files being served under `classic`.
@ -448,11 +448,11 @@ func New(logger log.Logger, o *Options) *Handler {
}
// Serve the React app.
reactRouterPaths := oldUIReactRouterPaths
reactRouterServerPaths := oldUIReactRouterServerPaths
if h.options.UseNewUI {
reactRouterPaths = newUIReactRouterPaths
reactRouterServerPaths = newUIReactRouterServerPaths
reactRouterPaths := newUIReactRouterPaths
reactRouterServerPaths := newUIReactRouterServerPaths
if h.options.UseOldUI {
reactRouterPaths = oldUIReactRouterPaths
reactRouterServerPaths = oldUIReactRouterServerPaths
}
for _, p := range reactRouterPaths {
@ -480,9 +480,9 @@ func New(logger log.Logger, o *Options) *Handler {
})
}
reactStaticAssetsDir := "/static"
if h.options.UseNewUI {
reactStaticAssetsDir = "/assets"
reactStaticAssetsDir := "/assets"
if h.options.UseOldUI {
reactStaticAssetsDir = "/static"
}
// Static files required by the React app.
router.Get(reactStaticAssetsDir+"/*filepath", func(w http.ResponseWriter, r *http.Request) {