Skip to content

Commit ec8a6e8

Browse files
authored
[PECOBLR-1168] query tags telemetry (#1166)
## Description <!-- Provide a brief summary of the changes made and the issue they aim to address.--> Added query tags to telemetry ## Testing <!-- Describe how the changes have been tested--> Tested with real workspace in both cases: when query tags are present / not present. Behaviour is working as expected. ## Additional Notes to the Reviewer <!-- Share any additional context or insights that may help the reviewer understand the changes better. This could include challenges faced, limitations, or compromises made during the development process. Also, mention any areas of the code that you would like the reviewer to focus on specifically. --> NO_CHANGELOG=true Signed-off-by: Sreekanth Vadigi <sreekanth.vadigi@databricks.com>
1 parent 9ad5004 commit ec8a6e8

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/main/java/com/databricks/jdbc/common/DatabricksJdbcConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public final class DatabricksJdbcConstants {
108108
public static final String QUERY_EXECUTION_TIMEOUT_SQLSTATE = "57KD0";
109109
public static final int TEMPORARY_REDIRECT_STATUS_CODE = 307;
110110
public static final String REDACTED_TOKEN = "****";
111+
public static final String QUERY_TAGS = "query_tags";
111112
public static final int MAX_DEFAULT_STRING_COLUMN_LENGTH = 32767;
112113
public static final int DEFUALT_STRING_COLUMN_LENGTH = 255;
113114
public static final int DEFAULT_MAX_CONCURRENT_PRESIGNED_REQUESTS = 50;

src/main/java/com/databricks/jdbc/model/telemetry/DriverConnectionParameters.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ public class DriverConnectionParameters {
139139
@JsonProperty("enable_metric_view_metadata")
140140
boolean enableMetricViewMetadata;
141141

142+
@JsonProperty("query_tags")
143+
String queryTags;
144+
142145
public DriverConnectionParameters setHttpPath(String httpPath) {
143146
this.httpPath = httpPath;
144147
return this;
@@ -364,6 +367,11 @@ public DriverConnectionParameters setEnableMetricViewMetadata(boolean enableMetr
364367
return this;
365368
}
366369

370+
public DriverConnectionParameters setQueryTags(String queryTags) {
371+
this.queryTags = queryTags;
372+
return this;
373+
}
374+
367375
@Override
368376
public String toString() {
369377
return new ToStringer(DriverConnectionParameters.class)
@@ -411,6 +419,7 @@ public String toString() {
411419
.add("rowsFetchedPerBlock", rowsFetchedPerBlock)
412420
.add("asyncPollIntervalMillis", asyncPollIntervalMillis)
413421
.add("enableMetricViewMetadata", enableMetricViewMetadata)
422+
.add("queryTags", queryTags)
414423
.toString();
415424
}
416425
}

src/main/java/com/databricks/jdbc/telemetry/TelemetryHelper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.databricks.jdbc.telemetry;
22

3+
import static com.databricks.jdbc.common.DatabricksJdbcConstants.QUERY_TAGS;
34
import static com.databricks.jdbc.common.util.WildcardUtil.isNullOrEmpty;
45

56
import com.databricks.jdbc.api.internal.IDatabricksConnectionContext;
@@ -223,7 +224,8 @@ private static DriverConnectionParameters buildDriverConnectionParameters(
223224
.setAsyncPollIntervalMillis(connectionContext.getAsyncExecPollInterval())
224225
.setEnableTokenCache(connectionContext.isTokenCacheEnabled())
225226
.setHttpPath(connectionContext.getHttpPath())
226-
.setEnableMetricViewMetadata(connectionContext.getEnableMetricViewMetadata());
227+
.setEnableMetricViewMetadata(connectionContext.getEnableMetricViewMetadata())
228+
.setQueryTags(connectionContext.getSessionConfigs().get(QUERY_TAGS));
227229
} catch (DatabricksValidationException e) {
228230
// If configuration validation fails, return null to skip telemetry export
229231
// This prevents invalid configuration from breaking telemetry

0 commit comments

Comments
 (0)