INNER CODE UNIT · Python
get_sample
DataDog/dd-agent · checks/__init__.py:239
def get_sample(self, metric, tags=None, device_name=None, expire=True):
"Return the last value for that metric"
x = self.get_sample_with_timestamp(metric, tags, device_name, expire)
assert isinstance(x, TupleType) and len(x) == 4, x
return x[1]
def get_samples_with_timestamps(self, expire=True):
"Return all values {metric: (ts, value)} for non-tagged metrics"
values = {}
for m in self._sample_store:
try:
values[m] = self.get_sample_with_timestamp(m, expire=expire)
except Exception:
pass
return values
def get_samples(self, expire=True):
"Return all values {metric: value} for non-tagged metrics"