microsoft.opentelemetry.a365.core.exporters.replay_coordinator module
Background replay coordinator for durable telemetry delivery.
- class microsoft.opentelemetry.a365.core.exporters.replay_coordinator.ReplayCoordinator(storage, gate, send, poll_interval_seconds=30.0)[source]
Bases:
objectDrive durable record replay on a single daemon thread.
- start()[source]
Start the replay loop on one daemon thread.
Calling
start()aftershutdown()is a deliberate safe no-op: once the stop event has been set the coordinator is permanently stopped and a new instance should be created instead.- Return type:
- shutdown(timeout_seconds=None)[source]
Signal the replay thread to stop and wait for it to exit.
timeout_seconds=None(the default) waits indefinitely: the caller decides how long “long enough” is, so this primitive never silently gives up and reports success while the thread is still running a pass. A finite value performs a bounded wait instead and returns whether the thread had exited by the deadline; the stop request itself is always recorded regardless of the timeout, so a later bounded or unbounded call will still observe (and can wait out) the same in-progress shutdown.Safe to call concurrently from multiple threads. A thread can never join itself, so a call made from the replay thread itself (e.g. via an unexpected reentrant callback) returns
Falseimmediately without blocking or raising – the stop request is still recorded, but the caller cannot safely wait here for its own thread to exit.- Return type:
- run_once()[source]
Claim and process a single bounded replay batch.
Scan up to
_MAX_RECORDS_TO_SCAN_PER_PASSrecords to find identities whose gates are open, attempting at most_MAX_RECORDS_PER_PASS. Retryable failures update only their identity’s gate without stopping the pass. ReturnTrueonly when the full attempt budget was deleted, allowing healthy backlogs to drain immediately. Otherwise use the periodic cadence so retained or gate-blocked records do not cause a busy-spin.- Return type:
- exception microsoft.opentelemetry.a365.core.exporters.replay_coordinator.ReplayEndpointError[source]
Bases:
ExceptionRaised when replay cannot safely use the current exporter endpoint.
Task 2 raises this from the replay send callback when the reconstructed endpoint is invalid for bearer-token replay (for example, non-HTTPS). Task 3 will add coordinator-specific handling.
- exception microsoft.opentelemetry.a365.core.exporters.replay_coordinator.ReplayIdentityError[source]
Bases:
ExceptionRaised by the send callback when an identity or token cannot be resolved.
When the coordinator catches this exception, it releases the current record and releases the gate probe for that identity, then continues processing remaining records in the batch. This is appropriate for transient, per-identity failures (e.g. credential look-up errors) that should not block delivery of records belonging to other identities.
Contrast with unexpected / general exceptions, which cause the coordinator to release all remaining leased records and abort the current pass.