11package com .databricks .jdbc .telemetry ;
22
33import com .databricks .jdbc .client .DatabricksHttpException ;
4- import com .databricks .jdbc .client . http . DatabricksHttpClient ;
4+ import com .databricks .jdbc .commons . util . DefaultHttpClientUtil ;
55import com .databricks .jdbc .core .DatabricksSQLException ;
66import com .databricks .jdbc .driver .IDatabricksConnectionContext ;
77import com .fasterxml .jackson .databind .ObjectMapper ;
1515import org .apache .http .client .methods .HttpPost ;
1616import org .apache .http .client .methods .HttpUriRequest ;
1717import org .apache .http .client .utils .URIBuilder ;
18+ import org .apache .http .impl .client .DefaultHttpClient ;
1819import org .apache .http .util .EntityUtils ;
1920
2021// TODO (Bhuvan) Flush out metrics once the driver connection is closed
@@ -30,7 +31,7 @@ public class DatabricksMetrics {
3031 private final String METRICS_TYPE = "metrics_type" ;
3132 private Boolean hasInitialExportOccurred = false ;
3233 private String workspaceId = null ;
33- private DatabricksHttpClient telemetryClient = null ;
34+ private DefaultHttpClient telemetryClient = null ;
3435
3536 private void setWorkspaceId (String workspaceId ) {
3637 this .workspaceId = workspaceId ;
@@ -67,7 +68,13 @@ public DatabricksMetrics(IDatabricksConnectionContext context) throws Databricks
6768 }
6869 String resourceId = context .getComputeResource ().getWorkspaceId ();
6970 setWorkspaceId (resourceId );
70- telemetryClient = DatabricksHttpClient .getInstance (context );
71+ // TODO: Bhuvan: Replace telemetry client with DatabricksHttpClient when non-SSL variation is
72+ // implemented
73+ try {
74+ telemetryClient = DefaultHttpClientUtil .getDefaultHttpClient ();
75+ } catch (Exception e ) {
76+ throw new DatabricksSQLException ("Failed to create telemetry client" );
77+ }
7178 scheduleExportMetrics ();
7279 }
7380
0 commit comments