PingManager
Central manager for the Ping analytics system, responsible for coordinating Pinglet tracking, envelope creation, and reliable delivery to backend services.
PingManager serves as the main entry point for the Ping analytics system and acts as a bridge between the platform-specific Kotlin code and the shared C++ implementation. It manages the entire lifecycle of analytics data from Pinglet creation through reliable delivery.
Key Responsibilities:
Managing Pinglet queuing via native C++ implementation
Creating and sending Pinglet envelopes to backend services
Handling retry logic for failed send attempts
Coordinating with persistent storage for reliable delivery
Managing resource cleanup after Ping usage
Thread Safety: All operations are thread-safe and can be called from multiple threads concurrently. The underlying C++ implementation ensures thread-safe access to the Pinglet queue.
Functions
Retrieves the current trace ID from the native C++ implementation.
Attempts to retry sending any previously failed Pinglet envelopes.
Immediately flushes all queued Pinglets to the envelope and attempts to send them to the backend. The operation is asynchronous and runs in the newly launched coroutine on the IO dispatcher. If the envelope fails to send, it will be stored for later retry attempts.
Asynchronously flushes all queued Pinglets to the envelope and attempts to send them to the backend.