Skip to main content

telemetry_events

Strongly-typed dataclasses for Datadog telemetry events.

Each class maps to one event value emitted via telemetry_logger. Pass an instance directly to telemetry_logger.info(); the DatadogLogsHandler serialises it automatically via dataclasses.asdict().

Classes

AlgorithmProgressEvent

class AlgorithmProgressEvent(    algorithm_name: str,    task_context: str,    step: str,    datetime: str,    current_epoch: int | None = None,    max_epochs: int | None = None,    step_info: str | None = None,):

Emitted at algorithm lifecycle boundaries (run/epoch start and end).

Fired automatically by AlgorithmProgress for every algorithm via the BaseAlgorithmHook infrastructure — individual algorithm classes do not need any changes.

step is one of "run_start", "run_end", "epoch_start", or "epoch_end".

Variables

  • static algorithm_name : str
  • static current_epoch : Optional[int]
  • static datetime : str
  • static max_epochs : Optional[int]
  • static step : str
  • static step_info : Optional[str]
  • static task_context : str

BatchProgressEvent

class BatchProgressEvent(protocol_name: str, batch_number: int):

Emitted by the orchestrator at the start of each protocol batch.

Variables

  • static batch_number : int
  • static protocol_name : str

DatasetConnectedEvent

class DatasetConnectedEvent(    dataset_name: str, datasource_type: str, connection_datetime: str,):

Emitted once per datasource when a pod successfully connects it.

Variables

  • static connection_datetime : str
  • static dataset_name : str
  • static datasource_type : str

EHRQueryCompleteEvent

class EHRQueryCompleteEvent(patients_queried: int, records_found: int, config_type: str):

Emitted after an EHR patient query batch completes.

Fires once per protocol batch in EHR-enabled algorithms. Provides visibility into the per-batch EHR query phase, which is otherwise the longest silent stretch during task execution.

Variables

  • static config_type : str
  • static patients_queried : int
  • static records_found : int

EHRSessionInitialisedEvent

class EHRSessionInitialisedEvent(config_type: str):

Emitted after a NextGen or FHIR R4 EHR session is set up.

Variables

  • static config_type : str

EHRTokenRefreshedEvent

class EHRTokenRefreshedEvent(config_type: str):

Emitted after a FHIR client access token is refreshed.

Variables

  • static config_type : str

ExecutionTimeEvent

class ExecutionTimeEvent(class_name: str, function: str, duration_seconds: float):

Emitted by the @log_execution_time decorator.

Variables

  • static class_name : str
  • static duration_seconds : float
  • static function : str

FilteringCompleteEvent

class FilteringCompleteEvent(total_files: int, files_selected: int):

Emitted after RecordFilterAlgorithm.setup_run() finishes selecting files.

Fires once per task, before the first batch begins. Provides visibility into how many files were considered and how many passed the filter criteria.

Variables

  • static files_selected : int
  • static total_files : int

GroupingSummaryEvent

class GroupingSummaryEvent(    step: str,    group_count: int | None = None,    selected_files: int | None = None,    cached_files: int | None = None,    batch_size: int | None = None,    maybe_final: bool | None = None,    include_non_new_group_files: bool | None = None,    oversized_cohort_size: int | None = None,):

Aggregate Datadog event for grouping-aware batching behaviour.

Variables

  • static batch_size : Optional[int]
  • static cached_files : Optional[int]
  • static group_count : Optional[int]
  • static include_non_new_group_files : bool | None
  • static maybe_final : bool | None
  • static oversized_cohort_size : Optional[int]
  • static selected_files : Optional[int]
  • static step : str

MissingColumnEvent

class MissingColumnEvent(file_name: str, column_name: str):

Emitted when a required column is absent from a file (e.g. DICOM pixel data).

file_name is passed through PII redaction before logging because file names in medical imaging datasets may encode patient identifiers. column_name is a static code constant (e.g. "Pixel Data") and carries no PII.

Variables

  • static column_name : str
  • static file_name : str

PatientEligibilityEvent

class PatientEligibilityEvent(    eligible_count: int, datasource: str, project_id: str, datetime: str,):

Emitted by the orchestrator after eligible patient counts are calculated.

Variables

  • static datasource : str
  • static datetime : str
  • static eligible_count : int
  • static project_id : str

SchemaGenerationEndEvent

class SchemaGenerationEndEvent(    dataset_id: str, source_of_initiation: SchemaInitiationSource, datetime: str,):

Emitted when the Prefect schema worker finishes generating a schema.

Variables

  • static dataset_id : str
  • static datetime : str

SchemaGenerationStartEvent

class SchemaGenerationStartEvent(    dataset_id: str, source_of_initiation: SchemaInitiationSource, datetime: str,):

Emitted when the Prefect schema worker begins generating a schema.

Variables

  • static dataset_id : str
  • static datetime : str

SchemaInitiationSource

class SchemaInitiationSource(*args, **kwds):

Source that triggered schema generation.

Inherits from str so values serialise directly as JSON strings.

Ancestors

Variables

  • static PREFECT_SCHEMA_WORKER

SchemaUploadSuccessEvent

class SchemaUploadSuccessEvent(dataset_id: str, number_of_records: int, datetime: str):

Emitted after a full schema is successfully uploaded to the Hub.

Variables

  • static dataset_id : str
  • static datetime : str
  • static number_of_records : int

TaskAcceptedByPodEvent

class TaskAcceptedByPodEvent(    pod_identifier: str, task_id: str, app_version: str, datetime: str,):

Emitted by the modeller when a pod accepts a task request.

Variables

  • static app_version : str
  • static datetime : str
  • static pod_identifier : str
  • static task_id : str

TaskAcceptedEvent

class TaskAcceptedEvent(    task_id: str,    pod_name: str,    modeller_username: str,    datasource_type: str,    app_version: str,    datetime: str,):

Emitted by the worker when it accepts and begins a task.

Variables

  • static app_version : str
  • static datasource_type : str
  • static datetime : str
  • static modeller_username : str
  • static pod_name : str
  • static task_id : str

TaskCompleteEvent

class TaskCompleteEvent(    task_id: str, pod_name: str, modeller_username: str, datetime: str,):

Emitted by the worker when a task finishes successfully.

Symmetric counterpart to TaskAcceptedEvent — together they bracket the full task execution window in Datadog logs.

Variables

  • static datetime : str
  • static modeller_username : str
  • static pod_name : str
  • static task_id : str

TaskErrorEvent

class TaskErrorEvent(    task_id: str,    pod_name: str,    modeller_username: str,    error_type: str,    stacktrace_frames: str,):

Emitted by the worker when an unhandled exception aborts a task.

stacktrace_frames contains only the frame strings from traceback.format_tb() — the exception message and .args are deliberately excluded to avoid leaking PII (patient names, IDs, etc. that may appear in exception messages).

Variables

  • static error_type : str
  • static modeller_username : str
  • static pod_name : str
  • static stacktrace_frames : str
  • static task_id : str

TelemetryEventName

class TelemetryEventName(*args, **kwds):

Canonical names for all Datadog telemetry events.

Inherits from str so values serialise directly as JSON strings.

Ancestors

Variables

  • static ALGORITHM_PROGRESS
  • static BATCH_PROGRESS
  • static DATASET_CONNECTED
  • static EHR_QUERY_COMPLETE
  • static EHR_SESSION_INITIALISED
  • static EHR_TOKEN_REFRESHED
  • static EXECUTION_TIME
  • static FILTERING_COMPLETE
  • static GROUPING_SUMMARY
  • static MISSING_COLUMN
  • static PATIENT_ELIGIBILITY
  • static SCHEMA_GENERATION_END
  • static SCHEMA_GENERATION_START
  • static SCHEMA_UPLOAD_SUCCESS
  • static TASK_ACCEPTED
  • static TASK_ACCEPTED_BY_POD
  • static TASK_COMPLETE
  • static TASK_ERROR
  • static TRIAL_FILTER_SUMMARY

TrialFilterSummaryEvent

class TrialFilterSummaryEvent(    step: str,    filter_name: str,    rows_matched: int,    rows_failed: int,    rows_missing: int = 0,    matching_column_count: int | None = None,    missing_columns: list[str] | None = None,):

Aggregate Datadog event for trial filter outcomes within a batch.

rows_missing counts rows with missing inputs required by the filter. It is not mutually exclusive with rows_matched or rows_failed.

Variables

  • static filter_name : str
  • static matching_column_count : Optional[int]
  • static missing_columns : Optional[list[str]]
  • static rows_failed : int
  • static rows_matched : int
  • static rows_missing : int
  • static step : str