Class TelemetryCollectorManager


  • public class TelemetryCollectorManager
    extends Object
    Manages TelemetryCollector instances per connection. Each connection gets its own TelemetryCollector instance to ensure telemetry data is properly isolated.
    • Method Detail

      • getOrCreateCollector

        public TelemetryCollector getOrCreateCollector​(IDatabricksConnectionContext context)
        Gets or creates a TelemetryCollector for the given connection context. Null checks are retained due to ThreadLocal usage patterns that may result in null context.
        Parameters:
        context - the connection context
        Returns:
        the TelemetryCollector instance for this connection
      • removeCollector

        public TelemetryCollector removeCollector​(String connectionUuid)
        Removes and returns the TelemetryCollector for the given connection. Should be called when a connection is closed.
        Parameters:
        connectionUuid - the connection UUID
        Returns:
        the removed TelemetryCollector, or null if not found
      • removeCollector

        public TelemetryCollector removeCollector​(IDatabricksConnectionContext context)
        Removes and returns the TelemetryCollector for the given connection context.
        Parameters:
        context - the connection context
        Returns:
        the removed TelemetryCollector, or null if not found
      • getCollectorSafely

        public TelemetryCollector getCollectorSafely​(Supplier<IDatabricksConnectionContext> connectionContextSupplier)
        Safely gets a TelemetryCollector from connection context, catching and ignoring any errors. This is useful for code that doesn't want telemetry failures to affect main logic.
        Parameters:
        connectionContextSupplier - a function that provides the connection context
        Returns:
        the TelemetryCollector, or null if an error occurred
      • clear

        public void clear()
        Clears all collectors. For testing purposes only.