Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
This implementation encodes the labels to use as a map key.
Args:
labels: The dictionary of label keys to label values.
"""
if len(labels) == 0:
return EMPTY_LABEL_SET
# Use simple encoding for now until encoding API is implemented
encoded = tuple(sorted(labels.items()))
# If LabelSet exists for this meter in memory, use existing one
if encoded not in self.labels:
self.labels[encoded] = LabelSet(labels=labels)
return self.labels[encoded]
meter = Meter()