opentelemetry
OpenTelemetry Task Metrics Setup.
Module
Functions
get_installation_uuid
def get_installation_uuid(storage_path: Optional[Path] = None) ‑> str:Return the installation UUID.
Uses config.settings.paths.storage_path by default.
get_task_meter
def get_task_meter() ‑> TaskMeter:Fetch global TaskMeter.
setup_opentelemetry_metrics
def setup_opentelemetry_metrics(*, session: BitfountSession) ‑> None:Setup Open Telemetry metrics exporter and TaskMeter.
Global variables
task_meter : Optional[TaskMeter]- The OpenTelemetry Python SDK doesn't seem to have a way to unregister callbacks, (https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#asynchronous-gauge-operations) so to avoid creating a new gauge and registering a new callback that will have a reference kept my OpenTelemetry (memory leak) every time we instantiate a Protocol we have this global Meter that can be used by all Protocol instances.
Classes
BitfountOLTPMetricsExporter
class BitfountOLTPMetricsExporter( *, session: BitfountSession, endpoint: str, insecure: bool,):OTLPMetricExporter that sends Bitfount session headers.
The BitfountSession message_service_metadata property may change over time so we need to ensure we have it fresh when we export metrics.
Ancestors
- opentelemetry.exporter.otlp.proto.grpc.metric_exporter.OTLPMetricExporter
- opentelemetry.sdk.metrics._internal.export.MetricExporter
- opentelemetry.exporter.otlp.proto.grpc.exporter.OTLPExporterMixin
- abc.ABC
- typing.Generic
- opentelemetry.exporter.otlp.proto.common._internal.metrics_encoder.OTLPMetricExporterMixin
TaskMeter
class TaskMeter():Meter that can be used to report task metrics.
Methods
submit_algorithm_records_per_class_returned
def submit_algorithm_records_per_class_returned( self, *, records_count_per_class: dict[str, int], task_id: str, algorithm: Union[_BaseAlgorithm, str], protocol_batch_num: Optional[int] = None, project_id: Optional[str] = None,) ‑> None:Submit an algorithm_records_returned observation per class.
submit_algorithm_records_returned
def submit_algorithm_records_returned( self, *, records_count: int, task_id: str, algorithm: Union[_BaseAlgorithm, str], protocol_batch_num: Optional[int] = None, project_id: Optional[str] = None,) ‑> None:Submit algorithm_records_returned observation.
submit_dataset_diagnostic_statistics
def submit_dataset_diagnostic_statistics( self, *, id: Optional[str] = None, datasource_name: str, origin: str, statistics: dict[str, object], bitfount_version: Optional[str], schema_version: Optional[str], schema_type: Optional[str],) ‑> None:Submit metric of dataset diagnostic statistics for a project.
submit_unique_patient_count
def submit_unique_patient_count(self, *, patient_count: int, project_id: str) ‑> None:Submit metric of unique eligible patients found for a project.
submit_user_input_statistics
def submit_user_input_statistics( self, *, categorical_columns: dict[str, dict[str, int]], project_id: str,) ‑> None:Submit metric of user input statistics for a project.