qdk_chemistry.utils.telemetry module
Telemetry module for QDK Chemistry.
Module sends telemetry directly to Azure Monitor using a similar mechanism and format to the Azure Monitor OpenTelemetry Python SDK. It only supports custom metrics of type “counter” and “histogram” for now. Its goal is to be minimal in size and dependencies, and easy to read to understand exactly what data is being sent.
To use this API, simply call log_telemetry with the metric name, value, and any other optional properties. The telemetry will be batched and sent at a regular intervals (60 sec), and when the process is about to exit.
Disable qdk_chemistry Python telemetry by setting the environment variable QSHARP_PYTHON_TELEMETRY to one of the following: none, disabled, false, or 0.
- class qdk_chemistry.utils.telemetry.Metric[source]
Bases:
TypedDictUsed internally for objects in the telemetry queue.
- class qdk_chemistry.utils.telemetry.PendingMetric[source]
Bases:
MetricUsed internally to aggregate metrics before sending.
- qdk_chemistry.utils.telemetry.log_telemetry(name, value, count=1, properties=None, type='counter')[source]
Log a custom telemetry metric.
Logs a custom metric with the name provided. Properties are optional and can be used to capture additional context about the metric (but should be a relatively static set of values, as each unique set of properties will be sent as a separate metric and creates a separate ‘dimension’ in the backend telemetry store).
The type can be either ‘counter’ or ‘histogram’. A ‘counter’ is a simple value that is summed over time, such as how many times an event occurs, while a ‘histogram’ is used to track ‘quantitative’ values, such as the distribution of values over time, e.g., the duration of an operation.