INNER CODE UNIT · Python
get_metrics
DataDog/dd-agent · checks/__init__.py:266
def get_metrics(self, expire=True):
"""Get all metrics, including the ones that are tagged.
This is the preferred method to retrieve metrics
@return the list of samples
@rtype [(metric_name, timestamp, value, {"tags": ["tag1", "tag2"]}), ...]
"""
metrics = []
for m in self._sample_store:
try:
for key in self._sample_store[m]:
tags, device_name = key
try:
ts, val, hostname, device_name = self.get_sample_with_timestamp(m, tags, device_name, expire)
except UnknownValue:
continue
attributes = {}
if tags: