MCPcopy Index your code
hub / github.com/prometheus/client_python / _build_full_name

Function _build_full_name

prometheus_client/metrics.py:25–40  ·  view source on GitHub ↗
(metric_type, name, namespace, subsystem, unit)

Source from the content-addressed store, hash-verified

23
24
25def _build_full_name(metric_type, name, namespace, subsystem, unit):
26 if not name:
27 raise ValueError('Metric name should not be empty')
28 full_name = ''
29 if namespace:
30 full_name += namespace + '_'
31 if subsystem:
32 full_name += subsystem + '_'
33 full_name += name
34 if metric_type == 'counter' and full_name.endswith('_total'):
35 full_name = full_name[:-6] # Munge to OpenMetrics.
36 if unit and not full_name.endswith("_" + unit):
37 full_name += "_" + unit
38 if unit and metric_type in ('info', 'stateset'):
39 raise ValueError('Metric name is of a type that cannot have a unit: ' + full_name)
40 return full_name
41
42
43

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected