Module collector
Expand description
Telemetry data collection and export infrastructure.
This module provides the core infrastructure for collecting telemetry data and exporting it to various backends. It includes the global collector singleton, export trait, and various built-in exporters.
§Global Collector
The collector uses a global singleton pattern to ensure telemetry data is collected
consistently across the entire application.
The collector must be initialized once
using set_exporter
before any telemetry data can be collected.
§Export Trait
The Export
trait defines the interface for exporting telemetry data.
Custom exporters can be implemented by providing an implementation of this trait.
§Built-in Exporters
ConsoleJsonExporter
- Exports telemetry data as JSON to stdoutTestExporter
- Collects telemetry data in memory for testing purposes
Structs§
- Collector
- The global telemetry collector.
- Console
Json Exporter - An exporter that outputs telemetry messages as JSON to stdout.
- SetExporter
Error - The type returned by
set_exporter
ifset_exporter
has already been called. - Test
Exporter - An exporter for testing that stores all telemetry messages in memory.
Traits§
- Export
- Trait for exporting telemetry data to external systems.
Functions§
- get_
collector - Returns a reference to the collector.
- set_
exporter - Initializes the collector with the given Exporter and
ExecutionId
.