| Modifier and Type | Method and Description |
|---|---|
void |
addLogToBatch(com.fasterxml.jackson.databind.node.ObjectNode message,
long timeStamp)
Add log to batch to be submitted to telemetry.
|
void |
addLogToBatch(TelemetryData log)
Add log to batch to be submitted to telemetry.
|
int |
bufferSize()
For test use only
|
void |
close()
Close telemetry connector and send any unsubmitted logs
|
static Telemetry |
createSessionlessTelemetry(org.apache.http.impl.client.CloseableHttpClient httpClient,
String serverUrl)
Initialize the sessionless telemetry connector
|
static Telemetry |
createSessionlessTelemetry(org.apache.http.impl.client.CloseableHttpClient httpClient,
String serverUrl,
int flushSize)
Initialize the sessionless telemetry connector
|
static Telemetry |
createTelemetry(Connection conn)
Initialize the telemetry connector
|
static Telemetry |
createTelemetry(Connection conn,
int flushSize)
Initialize the telemetry connector
|
static Telemetry |
createTelemetry(SFSession session)
Initialize the telemetry connector
|
static Telemetry |
createTelemetry(SFSession session,
int flushSize)
Initialize the telemetry connector
|
void |
disableTelemetry()
Disable any use of the client to add/send metrics
|
boolean |
isClosed()
Return whether the client has been closed
|
boolean |
isTelemetryEnabled()
Return whether the client can be used to add/send metrics
|
LinkedList<TelemetryData> |
logBuffer()
For test use only
|
void |
postProcess(String queryId,
String sqlState,
int vendorCode,
Throwable ex)
A hook for post-processing after sending telemetry data.
|
void |
refreshToken(String token)
Refresh the JWT token
|
Future<Boolean> |
sendBatchAsync()
Send all cached logs to server
|
boolean |
sendLog(com.fasterxml.jackson.databind.node.ObjectNode message,
long timeStamp)
Send a log to the server, along with any existing logs waiting to be sent
|
boolean |
sendLog(TelemetryData log)
Send a log to the server, along with any existing logs waiting to be sent
|
public boolean isTelemetryEnabled()
public void disableTelemetry()
public static Telemetry createTelemetry(Connection conn, int flushSize)
conn - connection with the session to use for the connectorflushSize - maximum size of telemetry batch before flushpublic static Telemetry createTelemetry(Connection conn)
conn - connection with the session to use for the connectorpublic static Telemetry createTelemetry(SFSession session)
session - session to use for telemetry dumpspublic static Telemetry createTelemetry(SFSession session, int flushSize)
session - session to use for telemetry dumpsflushSize - maximum size of telemetry batch before flushpublic static Telemetry createSessionlessTelemetry(org.apache.http.impl.client.CloseableHttpClient httpClient, String serverUrl)
httpClient - client object used to communicate with other machineserverUrl - server urlpublic static Telemetry createSessionlessTelemetry(org.apache.http.impl.client.CloseableHttpClient httpClient, String serverUrl, int flushSize)
httpClient - client object used to communicate with other machineserverUrl - server urlflushSize - maximum size of telemetry batch before flushpublic void addLogToBatch(TelemetryData log)
addLogToBatch in interface Telemetrylog - entry to addpublic void addLogToBatch(com.fasterxml.jackson.databind.node.ObjectNode message,
long timeStamp)
message - json node of logtimeStamp - timestamp to use for logpublic void close()
public boolean isClosed()
public Future<Boolean> sendBatchAsync()
TelemetrysendBatchAsync in interface Telemetrypublic void postProcess(String queryId, String sqlState, int vendorCode, Throwable ex)
TelemetrypostProcess in interface TelemetryqueryId - The query idsqlState - The SQL state as defined in net.snowflake.common.core.SqlStatevendorCode - The vendor code for localized messagesex - The throwable that caused this.public boolean sendLog(TelemetryData log) throws IOException
log - entry to sendIOException - if closed or uploading batch failspublic boolean sendLog(com.fasterxml.jackson.databind.node.ObjectNode message,
long timeStamp)
throws IOException
message - json node of logtimeStamp - timestamp to use for logIOException - if closed or uploading batch failspublic int bufferSize()
public LinkedList<TelemetryData> logBuffer()
public void refreshToken(String token)
token - latest JWT tokenCopyright © 2022. All rights reserved.