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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexportAllPendingTelemetryDetails()Exports all pending telemetry details and clears the trackers.static TelemetryCollectorgetInstance()StatementTelemetryDetailsgetOrCreateTelemetryDetails(String statementId)Gets the telemetry details for a statement if present Otherwise creates a new one and persistvoidrecordChunkDownloadLatency(String statementId, long chunkIndex, long latencyMillis)Records the latency for downloading a chunk and updates metrics.voidrecordGetOperationStatus(String statementId, long latencyMillis)voidrecordOperationLatency(long latencyMillis, String methodName)voidrecordResultSetIteration(String statementId, Long totalChunks, boolean hasNext)Records when a result set is iterated/consumed.voidrecordTotalChunks(StatementId statementId, long totalChunks)voidsetResultFormat(IDatabricksStatementInternal statement, TSparkRowSetType executionResultFormat)voidsetResultFormat(StatementId statementId, com.databricks.sdk.service.sql.Format executionResultFormat)
-
-
-
Method Detail
-
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 stringchunkIndex- the index of the chunk being downloadedlatencyMillis- 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 IDtotalChunks- 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)
-
-