MCPcopy Index your code
hub / github.com/coder/coder / prometheusBannerEntry

Function prometheusBannerEntry

scripts/develop/main.go:1290–1299  ·  view source on GitHub ↗

prometheusBannerEntry decides which (if any) prometheus-related URL the dev banner should advertise. When the embedded Prometheus server is running we prefer its UI; otherwise fall back to the raw metrics endpoint. Returns an empty label when metrics are disabled entirely.

(cfg *devConfig, prometheusServerStarted bool)

Source from the content-addressed store, hash-verified

1288// is running we prefer its UI; otherwise fall back to the raw metrics
1289// endpoint. Returns an empty label when metrics are disabled entirely.
1290func prometheusBannerEntry(cfg *devConfig, prometheusServerStarted bool) (label string, port int64) {
1291 switch {
1292 case prometheusServerStarted:
1293 return "Prometheus UI:", prometheusServerPort
1294 case cfg.coderMetricsPort != 0:
1295 return "Metrics:", cfg.coderMetricsPort
1296 default:
1297 return "", 0
1298 }
1299}
1300
1301func portBannerLine(label string, port int64, source portSource, offset int) string {
1302 portValue := strconv.FormatInt(port, 10)

Callers 2

printBannerFunction · 0.85

Calls

no outgoing calls

Tested by 1