mirror of
https://github.com/prometheus/prometheus
synced 2024-12-26 00:23:18 +00: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" />
|
||||
|
||||
<!--
|
||||
The GLOBAL_CONSOLES_LINK placeholder magic value is replaced during serving by Prometheus
|
||||
and set to the consoles link if it exists. It will render a "Consoles" link in the navbar when
|
||||
it is non-empty.
|
||||
Placeholders replaced by Prometheus during serving:
|
||||
- GLOBAL_CONSOLES_LINK is replaced and set to the consoles link if it exists.
|
||||
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>
|
||||
const GLOBAL_CONSOLES_LINK='CONSOLES_LINK_PLACEHOLDER';
|
||||
const GLOBAL_PROMETHEUS_AGENT_MODE=PROMETHEUS_AGENT_MODE_PLACEHOLDER;
|
||||
</script>
|
||||
|
||||
<!--
|
||||
|
@ -32,6 +32,7 @@ import (
|
||||
"regexp"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
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(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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user