mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-21 03:16:00 -08:00
Agent: Add a boolean to the index to indicate agent mode. (#9649)
I would like to avoid extra API call's to determine if we are running in Agent Mode, so I think we could use this approach. This is a bootstrap of #9612 Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
parent
ea924746b3
commit
b40e254f25
|
@ -10,12 +10,15 @@
|
||||||
<meta name="theme-color" content="#000000" />
|
<meta name="theme-color" content="#000000" />
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
The GLOBAL_CONSOLES_LINK placeholder magic value is replaced during serving by Prometheus
|
Placeholders replaced by Prometheus during serving:
|
||||||
and set to the consoles link if it exists. It will render a "Consoles" link in the navbar when
|
- GLOBAL_CONSOLES_LINK is replaced and set to the consoles link if it exists.
|
||||||
it is non-empty.
|
It will render a "Consoles" link in the navbar when it is non-empty.
|
||||||
|
- PROMETHEUS_AGENT_MODE is replaced by a boolean indicating if Prometheus is running in agent mode.
|
||||||
|
It true, it will disable querying capacities in the UI and generally adapt the UI to the agent mode.
|
||||||
-->
|
-->
|
||||||
<script>
|
<script>
|
||||||
const GLOBAL_CONSOLES_LINK='CONSOLES_LINK_PLACEHOLDER';
|
const GLOBAL_CONSOLES_LINK='CONSOLES_LINK_PLACEHOLDER';
|
||||||
|
const GLOBAL_PROMETHEUS_AGENT_MODE=PROMETHEUS_AGENT_MODE_PLACEHOLDER;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
|
@ -32,6 +32,7 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
template_text "text/template"
|
template_text "text/template"
|
||||||
|
@ -408,6 +409,7 @@ func New(logger log.Logger, o *Options) *Handler {
|
||||||
}
|
}
|
||||||
replacedIdx := bytes.ReplaceAll(idx, []byte("CONSOLES_LINK_PLACEHOLDER"), []byte(h.consolesPath()))
|
replacedIdx := bytes.ReplaceAll(idx, []byte("CONSOLES_LINK_PLACEHOLDER"), []byte(h.consolesPath()))
|
||||||
replacedIdx = bytes.ReplaceAll(replacedIdx, []byte("TITLE_PLACEHOLDER"), []byte(h.options.PageTitle))
|
replacedIdx = bytes.ReplaceAll(replacedIdx, []byte("TITLE_PLACEHOLDER"), []byte(h.options.PageTitle))
|
||||||
|
replacedIdx = bytes.ReplaceAll(replacedIdx, []byte("PROMETHEUS_AGENT_MODE_PLACEHOLDER"), []byte(strconv.FormatBool(h.options.IsAgent)))
|
||||||
w.Write(replacedIdx)
|
w.Write(replacedIdx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue