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)
| 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. |
| 1290 | func 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 | |
| 1301 | func portBannerLine(label string, port int64, source portSource, offset int) string { |
| 1302 | portValue := strconv.FormatInt(port, 10) |
no outgoing calls