Package com.databricks.jdbc.telemetry

## Class TelemetryHelper

- java.lang.Object
- - com.databricks.jdbc.telemetry.TelemetryHelper

    public class TelemetryHelper
    extends Object

### Field Summary

Fields
`static String` `DEFAULT_HOST`

### Constructor Summary

Constructors
`TelemetryHelper()`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `exportFailureLog​(IDatabricksConnectionContext connectionContext, String errorName, String errorMessage, TelemetryLogLevel logLevel)`
`static void` `exportFailureLog​(IDatabricksConnectionContext connectionContext, String errorName, String errorMessage, String statementId, Long chunkIndex, TelemetryLogLevel logLevel)`
`static void` `exportTelemetryLog​(StatementTelemetryDetails telemetryDetails, TelemetryLogLevel logLevel)`
`static com.databricks.sdk.core.DatabricksConfig` `getDatabricksConfigSafely​(IDatabricksConnectionContext context)`
`static DriverSystemConfiguration` `getDriverSystemConfiguration()`
`static String` `getStatementIdString​(StatementId statementId)`
`static boolean` `isTelemetryAllowedForConnection​(IDatabricksConnectionContext context)`
`static String` `keyOf​(IDatabricksConnectionContext context)`
`static OperationType` `mapMethodToOperationType​(String methodName)`
`static void` `recordChunkDownloadLatency​(IDatabricksConnectionContext connectionContext, String statementId, long chunkIndex, long latencyMillis)` Records chunk download latency.
`static void` `recordGetOperationStatus​(IDatabricksConnectionContext connectionContext, String statementId, long latencyMillis)` Records get operation status latency.
`static void` `recordResultSetIteration​(IDatabricksConnectionContext connectionContext, String statementId, long chunkCount, boolean hasNext)` Records a result set iteration.
`static void` `recordResultSetIteration​(IDatabricksStatementInternal parentStatement, StatementId statementId, Long chunkCount, boolean hasNext)` Records a result set iteration from a parent statement.
`static void` `recordTotalChunks​(IDatabricksConnectionContext connectionContext, StatementId statementId, long chunkCount)` Records the total chunks for a statement.
`static void` `removeConnectionParameters​(String connectionUuid)` Removes cached connection parameters for the given connection UUID.
`static void` `setResultFormat​(IDatabricksConnectionContext connectionContext, IDatabricksStatementInternal parentStatement, TSparkRowSetType format)` Sets the result format for a statement (Thrift API).
`static void` `setResultFormat​(IDatabricksConnectionContext connectionContext, StatementId statementId, com.databricks.sdk.service.sql.Format format)` Sets the result format for a statement (SQL Execution API).
`static void` `updateTelemetryAppName​(IDatabricksConnectionContext connectionContext, String clientInfoAppName)` Sets/updates client app name in telemetry

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### DEFAULT_HOST

    public static final String DEFAULT_HOST

See Also:
  Constant Field Values

### Constructor Detail

#### TelemetryHelper

    public TelemetryHelper()

### Method Detail

#### getDriverSystemConfiguration

    public static DriverSystemConfiguration getDriverSystemConfiguration()

#### isTelemetryAllowedForConnection

    public static boolean isTelemetryAllowedForConnection​(IDatabricksConnectionContext context)

#### exportTelemetryLog

    public static void exportTelemetryLog​(StatementTelemetryDetails telemetryDetails,
                                          TelemetryLogLevel logLevel)

#### exportFailureLog

    public static void exportFailureLog​(IDatabricksConnectionContext connectionContext,
                                        String errorName,
                                        String errorMessage,
                                        TelemetryLogLevel logLevel)

#### exportFailureLog

    public static void exportFailureLog​(IDatabricksConnectionContext connectionContext,
                                        String errorName,
                                        String errorMessage,
                                        String statementId,
                                        Long chunkIndex,
                                        TelemetryLogLevel logLevel)

#### getStatementIdString

    public static String getStatementIdString​(StatementId statementId)

#### getDatabricksConfigSafely

    public static com.databricks.sdk.core.DatabricksConfig getDatabricksConfigSafely​(IDatabricksConnectionContext context)

#### mapMethodToOperationType

    public static OperationType mapMethodToOperationType​(String methodName)

#### updateTelemetryAppName

    public static void updateTelemetryAppName​(IDatabricksConnectionContext connectionContext,
                                              String clientInfoAppName)

Sets/updates client app name in telemetry

Parameters:
  `connectionContext` - The connection context
  `clientInfoAppName` - The application name from client info properties, can be null

#### keyOf

    public static String keyOf​(IDatabricksConnectionContext context)

#### removeConnectionParameters

    public static void removeConnectionParameters​(String connectionUuid)

Removes cached connection parameters for the given connection UUID. Should be called when a connection is closed to prevent memory leaks.

Parameters:
  `connectionUuid` - The connection UUID whose cached parameters should be removed

#### recordTotalChunks

    public static void recordTotalChunks​(IDatabricksConnectionContext connectionContext,
                                         StatementId statementId,
                                         long chunkCount)

Records the total chunks for a statement. Silently ignores errors.

Parameters:
  `connectionContext` - The connection context
  `statementId` - The statement ID
  `chunkCount` - The total number of chunks

#### setResultFormat

    public static void setResultFormat​(IDatabricksConnectionContext connectionContext,
                                       StatementId statementId,
                                       com.databricks.sdk.service.sql.Format format)

Sets the result format for a statement (SQL Execution API). Silently ignores errors.

Parameters:
  `connectionContext` - The connection context
  `statementId` - The statement ID
  `format` - The result format

#### setResultFormat

    public static void setResultFormat​(IDatabricksConnectionContext connectionContext,
                                       IDatabricksStatementInternal parentStatement,
                                       TSparkRowSetType format)

Sets the result format for a statement (Thrift API). Silently ignores errors.

Parameters:
  `connectionContext` - The connection context
  `parentStatement` - The parent statement
  `format` - The result format

#### recordResultSetIteration

    public static void recordResultSetIteration​(IDatabricksConnectionContext connectionContext,
                                                String statementId,
                                                long chunkCount,
                                                boolean hasNext)

Records a result set iteration. Silently ignores errors.

Parameters:
  `connectionContext` - The connection context
  `statementId` - The statement ID
  `chunkCount` - The total number of chunks
  `hasNext` - Whether there are more rows

#### recordResultSetIteration

    public static void recordResultSetIteration​(IDatabricksStatementInternal parentStatement,
                                                StatementId statementId,
                                                Long chunkCount,
                                                boolean hasNext)

Records a result set iteration from a parent statement. Extracts connection context safely and silently ignores all errors.

Parameters:
  `parentStatement` - The parent statement (can be null)
  `statementId` - The statement ID
  `chunkCount` - The total number of chunks (can be null)
  `hasNext` - Whether there are more rows

#### recordGetOperationStatus

    public static void recordGetOperationStatus​(IDatabricksConnectionContext connectionContext,
                                                String statementId,
                                                long latencyMillis)

Records get operation status latency. Silently ignores errors.

Parameters:
  `connectionContext` - The connection context
  `statementId` - The statement ID
  `latencyMillis` - The operation latency in milliseconds

#### recordChunkDownloadLatency

    public static void recordChunkDownloadLatency​(IDatabricksConnectionContext connectionContext,
                                                  String statementId,
                                                  long chunkIndex,
                                                  long latencyMillis)

Records chunk download latency. Silently ignores errors.

Parameters:
  `connectionContext` - The connection context
  `statementId` - The statement ID
  `chunkIndex` - The chunk index
  `latencyMillis` - The download latency in milliseconds