MCPcopy Create free account
hub / github.com/coder/coder / buildMetricName

Function buildMetricName

scripts/metricsdocgen/scanner/scanner.go:513–527  ·  view source on GitHub ↗

buildMetricName constructs the full metric name from namespace, subsystem, and name.

(namespace, subsystem, name string)

Source from the content-addressed store, hash-verified

511
512// buildMetricName constructs the full metric name from namespace, subsystem, and name.
513func buildMetricName(namespace, subsystem, name string) string {
514 metricNameParts := make([]string, 0, 3)
515 if namespace != "" {
516 metricNameParts = append(metricNameParts, namespace)
517 }
518 if subsystem != "" {
519 metricNameParts = append(metricNameParts, subsystem)
520 }
521 if name != "" {
522 metricNameParts = append(metricNameParts, name)
523 }
524 // Join non-empty parts with "_" to handle optional namespace/subsystem.
525 // e.g., ("coderd", "", "agents_up"): "coderd_agents_up"
526 return strings.Join(metricNameParts, "_")
527}
528
529// extractOptsMetric extracts a metric from prometheus.New*() or prometheus.New*Vec() calls.
530// Supported patterns:

Callers 2

extractOptsMetricFunction · 0.85
extractPromautoMetricFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected