INNER CODE UNIT · Python
get_sample_with_timestamp
DataDog/dd-agent · checks/__init__.py:210
def get_sample_with_timestamp(self, metric, tags=None, device_name=None, expire=True):
"Get (timestamp-epoch-style, value)"
# Get the proper tags
if tags is not None and isinstance(tags, ListType):
tags.sort()
tags = tuple(tags)
key = (tags, device_name)
# Never seen this metric
if metric not in self._sample_store:
raise UnknownValue()
# Not enough value to compute rate
elif self.is_counter(metric) and len(self._sample_store[metric][key]) < 2:
raise UnknownValue()
elif self.is_counter(metric) and len(self._sample_store[metric][key]) >= 2: