[Metrics] Use isinstance for type-checking keys of tags for metrics (#11202)

* Use isinstance instead of type for type-checking keys of tags for metrics

* Fix lint error
This commit is contained in:
Sumanth Ratna
2020-10-05 17:24:22 -04:00
committed by GitHub
parent aaa8147acb
commit 0630242522
+3 -4
View File
@@ -37,10 +37,9 @@ class Metric:
# The Cython metric class. This should be set in the child class.
self._metric = None
if type(self._tag_keys) != tuple:
raise ValueError(
"tag_keys should be a tuple type, "
f"but {type(self._tag_keys)} type was specified instead.")
if not isinstance(self._tag_keys, tuple):
raise ValueError("tag_keys should be a tuple type, got: "
f"{type(self._tag_keys)}")
def set_default_tags(self, default_tags: Dict[str, str]):
"""Set default tags of metrics.