Class SnowflakeTelemetryService
- java.lang.Object
-
- com.snowflake.kafka.connector.internal.telemetry.SnowflakeTelemetryService
-
- Direct Known Subclasses:
SnowflakeTelemetryServiceV1,SnowflakeTelemetryServiceV2
public abstract class SnowflakeTelemetryService extends Object
Abstract class handling basics of sending telemetry information to snowflake. Please note, this is only for debugging purposes and data is not exposed to customers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSnowflakeTelemetryService.TelemetryType
-
Field Summary
Fields Modifier and Type Field Description protected static StringIS_CHANNEL_CLOSINGprotected static StringIS_PIPE_CLOSINGprotected net.snowflake.client.jdbc.telemetry.Telemetrytelemetry
-
Constructor Summary
Constructors Modifier Constructor Description protectedSnowflakeTelemetryService()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddUserConnectorPropertiesToDataNode(Map<String,String> userProvidedConfig, net.snowflake.client.jdbc.internal.fasterxml.jackson.databind.node.ObjectNode dataObjectNode)Adds specific user provided connector properties to ObjectNodeprotected net.snowflake.client.jdbc.internal.fasterxml.jackson.databind.node.ObjectNodegetDefaultObjectNode(IngestionMethodConfig ingestionMethodConfig)This is the minimum JsonNode which will be present in each telemetry Payload.abstract net.snowflake.client.jdbc.internal.fasterxml.jackson.databind.node.ObjectNodegetObjectNode()Get default object Node which will be part of every telemetry being sent to snowflake.voidreportKafkaConnectFatalError(String errorDetail)Event of a fatal error in the connectorvoidreportKafkaConnectStart(long startTime, Map<String,String> userProvidedConfig)Event of connector startvoidreportKafkaConnectStop(long startTime)Event of connector stopvoidreportKafkaPartitionStart(SnowflakeTelemetryBasicInfo partitionCreation)report connector partition startvoidreportKafkaPartitionUsage(SnowflakeTelemetryBasicInfo partitionStatus, boolean isClosing)report connector's partition usage.protected voidsend(SnowflakeTelemetryService.TelemetryType type, net.snowflake.client.jdbc.internal.fasterxml.jackson.databind.JsonNode data)JsonNode data is wrapped into another ObjectNode which looks like this:voidsetAppName(String name)set app namevoidsetTaskID(String taskID)set task id
-
-
-
Field Detail
-
IS_PIPE_CLOSING
protected static final String IS_PIPE_CLOSING
- See Also:
- Constant Field Values
-
IS_CHANNEL_CLOSING
protected static final String IS_CHANNEL_CLOSING
- See Also:
- Constant Field Values
-
telemetry
protected net.snowflake.client.jdbc.telemetry.Telemetry telemetry
-
-
Method Detail
-
setAppName
public void setAppName(String name)
set app name- Parameters:
name- app name
-
setTaskID
public void setTaskID(String taskID)
set task id- Parameters:
taskID- task id
-
reportKafkaConnectStart
public void reportKafkaConnectStart(long startTime, Map<String,String> userProvidedConfig)Event of connector start- Parameters:
startTime- task start timeuserProvidedConfig- max number of tasks
-
reportKafkaConnectStop
public void reportKafkaConnectStop(long startTime)
Event of connector stop- Parameters:
startTime- start timestamp
-
reportKafkaConnectFatalError
public void reportKafkaConnectFatalError(String errorDetail)
Event of a fatal error in the connector- Parameters:
errorDetail- error message
-
reportKafkaPartitionUsage
public void reportKafkaPartitionUsage(SnowflakeTelemetryBasicInfo partitionStatus, boolean isClosing)
report connector's partition usage.- Parameters:
partitionStatus- SnowflakePipeStatus objectisClosing- is the underlying pipe/channel closing
-
getObjectNode
public abstract net.snowflake.client.jdbc.internal.fasterxml.jackson.databind.node.ObjectNode getObjectNode()
Get default object Node which will be part of every telemetry being sent to snowflake. Based on the underlying implementation, node fields might change.- Returns:
- ObjectNode in Json Format
-
reportKafkaPartitionStart
public void reportKafkaPartitionStart(SnowflakeTelemetryBasicInfo partitionCreation)
report connector partition start- Parameters:
partitionCreation- SnowflakeTelemetryBasicInfo object
-
getDefaultObjectNode
protected net.snowflake.client.jdbc.internal.fasterxml.jackson.databind.node.ObjectNode getDefaultObjectNode(IngestionMethodConfig ingestionMethodConfig)
This is the minimum JsonNode which will be present in each telemetry Payload. Format:{ "app_name": "", "task_id": 1, "snowflake.ingestion.method": " " for IngestionMethodConfig}- Returns:
- An ObjectNode which is by default always created with certain defined properties in it.
-
send
protected void send(SnowflakeTelemetryService.TelemetryType type, net.snowflake.client.jdbc.internal.fasterxml.jackson.databind.JsonNode data)
JsonNode data is wrapped into another ObjectNode which looks like this:{ "data": { "app_name": "", "task_id": "-1" }, "source": "kafka_connector", "type": "kafka_start/ ", "version": "snowflake_kc_version" } - Parameters:
type- type of Datadata- JsonData to wrap in a json field called data
-
addUserConnectorPropertiesToDataNode
protected void addUserConnectorPropertiesToDataNode(Map<String,String> userProvidedConfig, net.snowflake.client.jdbc.internal.fasterxml.jackson.databind.node.ObjectNode dataObjectNode)
Adds specific user provided connector properties to ObjectNode- Parameters:
userProvidedConfig- user provided key value pairs in a MapdataObjectNode- Object node in which specific properties to add
-
-