diff --git a/src/main/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryService.java b/src/main/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryService.java index 906bac38a..8b1918bc1 100644 --- a/src/main/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryService.java +++ b/src/main/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryService.java @@ -43,7 +43,8 @@ protected TelemetryService initialValue() { // Global parameters: private static final String TELEMETRY_SERVER_URL_PATTERN = - "https://(sfcdev\\.|sfctest\\.|)client-telemetry\\.snowflakecomputing\\" + ".com/enqueue"; + "https://(sfcdev\\.|sfctest\\.|)?client-telemetry\\.[a-z0-9\\.\\-]*snowflake[computing]?\\" + + ".com/enqueue"; /** * control which deployments are enabled: the service skips all events for the disabled @@ -56,7 +57,8 @@ protected TelemetryService initialValue() { TELEMETRY_SERVER_DEPLOYMENT.REG.name, TELEMETRY_SERVER_DEPLOYMENT.QA1.name, TELEMETRY_SERVER_DEPLOYMENT.PREPROD3.name, - TELEMETRY_SERVER_DEPLOYMENT.PROD.name)); + TELEMETRY_SERVER_DEPLOYMENT.PROD.name, + TELEMETRY_SERVER_DEPLOYMENT.K8TEST.name)); // connection string for current connection private String connStr = ""; @@ -175,6 +177,8 @@ public void updateContext(SnowflakeConnectString conStr) { private TELEMETRY_SERVER_DEPLOYMENT manuallyConfigureDeployment(String dep) { switch (dep) { + case "K8TEST": + return TELEMETRY_SERVER_DEPLOYMENT.K8TEST; case "REG": return TELEMETRY_SERVER_DEPLOYMENT.REG; case "DEV": @@ -253,7 +257,9 @@ private enum TELEMETRY_API { "kyTKLWpEZSaJnrzTZ63I96QXZHKsgfqbaGmAaIWf"), // pragma: allowlist secret PROD( "https://client-telemetry.snowflakecomputing.com/enqueue", - "wLpEKqnLOW9tGNwTjab5N611YQApOb3t9xOnE1rX"); // pragma: allowlist secret + "wLpEKqnLOW9tGNwTjab5N611YQApOb3t9xOnE1rX"), // pragma: allowlist secret + + K8TEST("https://client-telemetry.ordevmisc1.us-west-2.aws-dev.app.snowflake.com/enqueue", ""); private final String url; @@ -272,7 +278,8 @@ public enum TELEMETRY_SERVER_DEPLOYMENT { REG("reg", TELEMETRY_API.SFCDEV), QA1("qa1", TELEMETRY_API.SFCDEV), PREPROD3("preprod3", TELEMETRY_API.SFCDEV), - PROD("prod", TELEMETRY_API.PROD); + PROD("prod", TELEMETRY_API.PROD), + K8TEST("k8test", TELEMETRY_API.K8TEST); private String name; private String url; diff --git a/src/test/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryServiceIT.java b/src/test/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryServiceIT.java index 1850a6732..47e4e4dde 100644 --- a/src/test/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryServiceIT.java +++ b/src/test/java/net/snowflake/client/jdbc/telemetryOOB/TelemetryServiceIT.java @@ -8,6 +8,7 @@ import java.sql.SQLException; import java.sql.SQLFeatureNotSupportedException; import java.sql.Statement; +import java.util.Map; import java.util.Properties; import java.util.concurrent.TimeUnit; import net.snowflake.client.ConditionalIgnoreRule; @@ -35,7 +36,9 @@ public class TelemetryServiceIT extends BaseJDBCTest { @Before public void setUp() { TelemetryService service = TelemetryService.getInstance(); - service.updateContextForIT(getConnectionParameters()); + Map connectionParams = getConnectionParameters(); + connectionParams.put("TELEMETRYDEPLOYMENT", "K8TEST"); + service.updateContextForIT(connectionParams); defaultState = service.isEnabled(); service.enable(); } @@ -53,7 +56,6 @@ public void tearDown() throws InterruptedException { } @SuppressWarnings("divzero") - @Ignore @Test public void testCreateException() { TelemetryService service = TelemetryService.getInstance();