net.snowflake.client.jdbc.telemetryOOB

## 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
`static class` `TelemetryService.TELEMETRY_SERVER_DEPLOYMENT`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `add(TelemetryEvent event)`
`void` `disable()`
`void` `enable()`
`void` `flush()` force to flush events in the queue
`net.minidev.json.JSONObject` `getContext()`
`TelemetryEvent` `getEvent(int i)`
`static TelemetryService` `getInstance()`
`String` `getServerDeploymentName()`
`boolean` `isDeploymentEnabled()` whether the telemetry service is enabled for current deployment
`boolean` `isEnabled()`

`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

`String` `logsToString(LinkedList<TelemetryEvent> queue)` convert a list of json objects to a string
`void` `setDeployment(TelemetryService.TELEMETRY_SERVER_DEPLOYMENT deployment)`
`int` `size()`
`void` `updateContext(Map<String,String> params)`
`void` `updateContext(String url, Properties info)`

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

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

### Method Detail

#### getInstance

    public static TelemetryService getInstance()

Returns:
  return thread local instance

#### enable

    public void enable()

#### disable

    public void disable()

#### isEnabled

    public boolean isEnabled()

#### getContext

    public net.minidev.json.JSONObject getContext()

#### updateContext

    public void updateContext(Map<String,String> params)

#### updateContext

    public void updateContext(String url,
                              Properties info)

#### isDeploymentEnabled

    public boolean isDeploymentEnabled()

whether the telemetry service is enabled for current deployment

#### getEvent

    public TelemetryEvent getEvent(int i)

#### setDeployment

    public void setDeployment(TelemetryService.TELEMETRY_SERVER_DEPLOYMENT deployment)

#### getServerDeploymentName

    public String getServerDeploymentName()

#### add

    public void add(TelemetryEvent event)

#### flush

    public void flush()

force to flush events in the queue

#### logsToString

    public String logsToString(LinkedList<TelemetryEvent> queue)

convert a list of json objects to a string

Parameters:
  `queue` - a list of json objects
Returns:
  the result json string

#### size

    public int size()

#### 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