(self: T,
name: str,
documentation: str,
labelnames: Iterable[str] = (),
namespace: str = '',
subsystem: str = '',
unit: str = '',
registry: Optional[CollectorRegistry] = REGISTRY,
_labelvalues: Optional[Sequence[str]] = None,
)
| 100 | return f"{metric_type.__module__}.{metric_type.__name__}({self._name})" |
| 101 | |
| 102 | def __init__(self: T, |
| 103 | name: str, |
| 104 | documentation: str, |
| 105 | labelnames: Iterable[str] = (), |
| 106 | namespace: str = '', |
| 107 | subsystem: str = '', |
| 108 | unit: str = '', |
| 109 | registry: Optional[CollectorRegistry] = REGISTRY, |
| 110 | _labelvalues: Optional[Sequence[str]] = None, |
| 111 | ) -> None: |
| 112 | |
| 113 | self._original_name = name |
| 114 | self._namespace = namespace |
| 115 | self._subsystem = subsystem |
| 116 | self._name = _build_full_name(self._type, name, namespace, subsystem, unit) |
| 117 | self._labelnames = _validate_labelnames(self, labelnames) |
| 118 | self._labelvalues = tuple(_labelvalues or ()) |
| 119 | self._kwargs: Dict[str, Any] = {} |
| 120 | self._documentation = documentation |
| 121 | self._unit = unit |
| 122 | |
| 123 | _validate_metric_name(self._name) |
| 124 | |
| 125 | if self._is_parent(): |
| 126 | # Prepare the fields needed for child metrics. |
| 127 | self._lock = Lock() |
| 128 | self._metrics: Dict[Sequence[str], T] = {} |
| 129 | |
| 130 | if self._is_observable(): |
| 131 | self._metric_init() |
| 132 | |
| 133 | if not self._labelvalues: |
| 134 | # Register the multi-wrapper parent metric, or if a label-less metric, the whole shebang. |
| 135 | if registry: |
| 136 | registry.register(self) |
| 137 | |
| 138 | def labels(self: T, *labelvalues: Any, **labelkwargs: Any) -> T: |
| 139 | """Return the child for the given labelset. |
nothing calls this directly
no test coverage detected