Class TelemetryCollector

java.lang.Object
com.databricks.jdbc.telemetry.latency.TelemetryCollector

public class TelemetryCollector extends Object
Context handler for tracking telemetry details for Databricks JDBC driver. This class manages per-statement telemetry details and provides logic for data collection.
  • Method Details

    • getInstance

      public static TelemetryCollector getInstance()
    • recordChunkDownloadLatency

      public void recordChunkDownloadLatency(String statementId, long chunkIndex, long latencyMillis)
      Records the latency for downloading a chunk and updates metrics.
      Parameters:
      statementId - the statement ID string
      chunkIndex - the index of the chunk being downloaded
      latencyMillis - the time taken to download the chunk in milliseconds
    • recordTotalChunks

      public void recordTotalChunks(StatementId statementId, long totalChunks)
    • recordOperationLatency

      public void recordOperationLatency(long latencyMillis, String methodName)
    • recordResultSetIteration

      public void recordResultSetIteration(String statementId, Long totalChunks, boolean hasNext)
      Records when a result set is iterated/consumed.
      Parameters:
      statementId - the statement ID
      totalChunks - the total chunks present (if any)
      hasNext - if there are any more results left to be iterated
    • getOrCreateTelemetryDetails

      public StatementTelemetryDetails getOrCreateTelemetryDetails(String statementId)
      Gets the telemetry details for a statement if present Otherwise creates a new one and persist
      Parameters:
      statementId - the statement ID
    • exportAllPendingTelemetryDetails

      public void exportAllPendingTelemetryDetails()
      Exports all pending telemetry details and clears the trackers. This method is called when the connection/client is being closed.
    • recordGetOperationStatus

      public void recordGetOperationStatus(String statementId, long latencyMillis)
    • setResultFormat

      public void setResultFormat(IDatabricksStatementInternal statement, TSparkRowSetType executionResultFormat)
    • setResultFormat

      public void setResultFormat(StatementId statementId, com.databricks.sdk.service.sql.Format executionResultFormat)