Class TelemetryService
- java.lang.Object
-
- net.snowflake.client.jdbc.telemetryOOB.TelemetryService
-
public class TelemetryService extends Object
Copyright (c) 2018-2019 Snowflake Computing Inc. All rights reserved.Out of Band Telemetry Service This is a thread safe singleton queue containing telemetry messages
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTelemetryService.TELEMETRY_SERVER_DEPLOYMENT
-
Constructor Summary
Constructors Constructor Description TelemetryService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcount()Count one more successfully reported eventsstatic voiddisable()static voiddisableHTAP()static voidenable()static voidenableHTAP()StringexportQueueToLogString(TelemetryEvent event)StringexportQueueToString(TelemetryEvent event)Convert an event to a payload in stringintgetClientFailureCount()net.minidev.json.JSONObjectgetContext()StringgetDriverConnectionString()intgetEventCount()static TelemetryServicegetInstance()StringgetLastClientError()intgetNumOfRetryToTriggerTelemetry()StringgetServerDeploymentName()intgetServerFailureCount()SnowflakeConnectStringgetSnowflakeConnectionString()booleanisDeploymentEnabled()whether the telemetry service is enabled for current deploymentbooleanisEnabled()booleanisHTAPEnabled()voidlogExecutionTimeTelemetryEvent(net.minidev.json.JSONObject telemetryData, String eventName)log execution times from various processing slicesvoidlogHttpRequestTelemetryEvent(String eventName, org.apache.http.client.methods.HttpRequestBase request, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, org.apache.http.client.methods.CloseableHttpResponse response, Exception savedEx, String breakRetryReason, long retryTimeout, int retryCount, String sqlState, int errorCode)log error http response to telemetryvoidlogOCSPExceptionTelemetryEvent(String eventType, net.minidev.json.JSONObject telemetryData, CertificateException ex)log OCSP exception to telemetryvoidreport(TelemetryEvent event)Report the event to the telemetry server in a new threadvoidreportChooseEvent(TelemetryEvent event, boolean isHTAP)voidresetNumOfRetryToTriggerTelemetry()voidsetDeployment(TelemetryService.TELEMETRY_SERVER_DEPLOYMENT deployment)voidsetNumOfRetryToTriggerTelemetry(int num)voidupdateContext(SnowflakeConnectString conStr)voidupdateContextForIT(Map<String,String> params)Note: Only used for IT
-
-
-
Method Detail
-
getInstance
public static TelemetryService getInstance()
- Returns:
- return thread local instance
-
resetNumOfRetryToTriggerTelemetry
public void resetNumOfRetryToTriggerTelemetry()
-
getNumOfRetryToTriggerTelemetry
public int getNumOfRetryToTriggerTelemetry()
-
setNumOfRetryToTriggerTelemetry
public void setNumOfRetryToTriggerTelemetry(int num)
-
enable
public static void enable()
-
disable
public static void disable()
-
enableHTAP
public static void enableHTAP()
-
disableHTAP
public static void disableHTAP()
-
isEnabled
public boolean isEnabled()
-
isHTAPEnabled
public boolean isHTAPEnabled()
-
getContext
public net.minidev.json.JSONObject getContext()
-
updateContextForIT
public void updateContextForIT(Map<String,String> params)
Note: Only used for IT
-
updateContext
public void updateContext(SnowflakeConnectString conStr)
-
isDeploymentEnabled
public boolean isDeploymentEnabled()
whether the telemetry service is enabled for current deployment
-
getDriverConnectionString
public String getDriverConnectionString()
-
getSnowflakeConnectionString
public SnowflakeConnectString getSnowflakeConnectionString()
-
setDeployment
public void setDeployment(TelemetryService.TELEMETRY_SERVER_DEPLOYMENT deployment)
-
getServerDeploymentName
public String getServerDeploymentName()
-
getEventCount
public int getEventCount()
- Returns:
- the number of events successfully reported by this service
-
getClientFailureCount
public int getClientFailureCount()
- Returns:
- the number of times an event was attempted to be reported but failed due to a client-side error
-
getServerFailureCount
public int getServerFailureCount()
- Returns:
- the number of times an event was attempted to be reported but failed due to a server-side error
-
getLastClientError
public String getLastClientError()
- Returns:
- the string containing the most recent failed response
-
count
public void count()
Count one more successfully reported events
-
report
public void report(TelemetryEvent event)
Report the event to the telemetry server in a new thread
-
reportChooseEvent
public void reportChooseEvent(TelemetryEvent event, boolean isHTAP)
-
exportQueueToString
public String exportQueueToString(TelemetryEvent event)
Convert an event to a payload in string
-
exportQueueToLogString
public String exportQueueToLogString(TelemetryEvent event)
-
logOCSPExceptionTelemetryEvent
public void logOCSPExceptionTelemetryEvent(String eventType, net.minidev.json.JSONObject telemetryData, CertificateException ex)
log OCSP exception to telemetry
-
logHttpRequestTelemetryEvent
public void logHttpRequestTelemetryEvent(String eventName, org.apache.http.client.methods.HttpRequestBase request, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, org.apache.http.client.methods.CloseableHttpResponse response, Exception savedEx, String breakRetryReason, long retryTimeout, int retryCount, String sqlState, int errorCode)
log error http response to telemetry
-
logExecutionTimeTelemetryEvent
public void logExecutionTimeTelemetryEvent(net.minidev.json.JSONObject telemetryData, String eventName)log execution times from various processing slices
-
-