Skip to content

Commit

Permalink
Rename labelvalues to _labelvalues (#660)
Browse files Browse the repository at this point in the history
Make it clear that labelvalues are for internal use only. Right now it
is easy to assume that they provide a way of creating static labels on a
counter, but that is not the case.

Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
  • Loading branch information
csmarchbanks authored Jun 1, 2021
1 parent 269bbde commit 59025d0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions prometheus_client/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ def __init__(self,
subsystem='',
unit='',
registry=REGISTRY,
labelvalues=None,
_labelvalues=None,
):
self._name = _build_full_name(self._type, name, namespace, subsystem, unit)
self._labelnames = _validate_labelnames(self, labelnames)
self._labelvalues = tuple(labelvalues or ())
self._labelvalues = tuple(_labelvalues or ())
self._kwargs = {}
self._documentation = documentation
self._unit = unit
Expand Down Expand Up @@ -170,7 +170,7 @@ def labels(self, *labelvalues, **labelkwargs):
documentation=self._documentation,
labelnames=self._labelnames,
unit=self._unit,
labelvalues=labelvalues,
_labelvalues=labelvalues,
**self._kwargs
)
return self._metrics[labelvalues]
Expand Down Expand Up @@ -327,7 +327,7 @@ def __init__(self,
subsystem='',
unit='',
registry=REGISTRY,
labelvalues=None,
_labelvalues=None,
multiprocess_mode='all',
):
self._multiprocess_mode = multiprocess_mode
Expand All @@ -341,7 +341,7 @@ def __init__(self,
subsystem=subsystem,
unit=unit,
registry=registry,
labelvalues=labelvalues,
_labelvalues=_labelvalues,
)
self._kwargs['multiprocess_mode'] = self._multiprocess_mode

Expand Down Expand Up @@ -515,7 +515,7 @@ def __init__(self,
subsystem='',
unit='',
registry=REGISTRY,
labelvalues=None,
_labelvalues=None,
buckets=DEFAULT_BUCKETS,
):
self._prepare_buckets(buckets)
Expand All @@ -527,7 +527,7 @@ def __init__(self,
subsystem=subsystem,
unit=unit,
registry=registry,
labelvalues=labelvalues,
_labelvalues=_labelvalues,
)
self._kwargs['buckets'] = buckets

Expand Down Expand Up @@ -652,7 +652,7 @@ def __init__(self,
subsystem='',
unit='',
registry=REGISTRY,
labelvalues=None,
_labelvalues=None,
states=None,
):
super(Enum, self).__init__(
Expand All @@ -663,7 +663,7 @@ def __init__(self,
subsystem=subsystem,
unit=unit,
registry=registry,
labelvalues=labelvalues,
_labelvalues=_labelvalues,
)
if name in labelnames:
raise ValueError('Overlapping labels for Enum metric: %s' % (name,))
Expand Down

0 comments on commit 59025d0

Please sign in to comment.