dragon.telemetry.telemetry
Dragon’s API to generate and visualize time series metrics in grafana utilizing the telemetry infrastructure
Classes
This class is used to generate and visualize time series metrics in Grafana utilizing the Dragon telemetry infrastructure. |
- class Telemetry
Bases:
object
This class is used to generate and visualize time series metrics in Grafana utilizing the Dragon telemetry infrastructure. The telemetry infrastructure is started when the runtime is started with
--telemetry-level
set to greater than zero. A--telemetry-level=1
is reserved for user metrics and will not collect any default metrics. The user can add data to the local node database using theadd_data
method. The data can then be visualized in Grafana or retrieved and analyzed utilizing theAnalysisClient
.Example usage:
import dragon import multiprocessing as mp import time from dragon.telemetry import Telemetry if __name__ == "__main__": dt = Telemetry() mp.set_start_method("dragon") pool = mp.Pool(10) for _ in range(10) start = time.time() pool.map(f, list(range(100))) dt.add_data("map_time", time.time()-start, telemetry_level=2) pool.close() pool.join() dt.finalize()
- __init__(metrics_url='http://localhost:4243/api/metrics')
- property level
- add_data(ts_metric_name: str , ts_data: float , timestamp: int = None, telemetry_level: int = 1, tagk: str = None, tagv: int | str = None) None
Adds user defined metric data to node local database that can then be retrieved via Grafana
- Parameters:
ts_metric_name (str ) – Metric name used to store data and retrieve it in Grafana. This should be consistent across nodes. Grafana’s retrieval will add the hostname to the metric.
ts_data (float ) – Time-series data point
timestamp (int , optional) – time stamp for time-series data point, defaults to int(time.time())
telemetry_level (int , optional) – telemetry data level for metric. if the data_level is greater than the launch specified telemetry level the data will not be added to the data base, defaults to 1
tagk (str , optional) – tag key for the datapoint