From 9e203c6731a04527da80f03892fa2c09e70c57e1 Mon Sep 17 00:00:00 2001 From: cleverchuk Date: Wed, 26 Jun 2024 08:35:13 -0400 Subject: [PATCH] NH-37575: extract environment from endpoint so stage integration test pass --- .../extensions/initialize/ConfigurationLoader.java | 8 +++++++- smoke-tests/src/test/java/com/solarwinds/SmokeTest.java | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/custom/src/main/java/com/solarwinds/opentelemetry/extensions/initialize/ConfigurationLoader.java b/custom/src/main/java/com/solarwinds/opentelemetry/extensions/initialize/ConfigurationLoader.java index 8a2a4125..c0c5f71e 100644 --- a/custom/src/main/java/com/solarwinds/opentelemetry/extensions/initialize/ConfigurationLoader.java +++ b/custom/src/main/java/com/solarwinds/opentelemetry/extensions/initialize/ConfigurationLoader.java @@ -203,19 +203,25 @@ static void configOtelLogExport(ConfigContainer container) { String[] fragments = collectorEndpoint.split("\\."); String dataCell = "na-01"; + String env = "cloud"; + if (fragments.length > 2) { // This is based on knowledge of the SWO url format where the third name from the left in // the domain is the data-cell name and assumes this format will stay stable. dataCell = fragments[2]; } + if (fragments.length > 3) { + env = fragments[3]; + } + System.setProperty("otel.exporter.otlp.protocol", "grpc"); System.setProperty("otel.logs.exporter", "otlp"); System.setProperty( "otel.exporter.otlp.logs.headers", String.format("authorization=Bearer %s", apiKey)); System.setProperty( "otel.exporter.otlp.logs.endpoint", - String.format("https://otel.collector.%s.cloud.solarwinds.com", dataCell)); + String.format("https://otel.collector.%s.%s.solarwinds.com", dataCell, env)); } } diff --git a/smoke-tests/src/test/java/com/solarwinds/SmokeTest.java b/smoke-tests/src/test/java/com/solarwinds/SmokeTest.java index ab0b8553..0d0ab101 100644 --- a/smoke-tests/src/test/java/com/solarwinds/SmokeTest.java +++ b/smoke-tests/src/test/java/com/solarwinds/SmokeTest.java @@ -243,7 +243,6 @@ void assertThatJDBCInstrumentationIsApplied() { @Test - @Disabled // Disabled because log linking doesn't work in staging at moment void assertThatLogsAreExported() throws IOException { String resultJson = new String( Files.readAllBytes(namingConventions.local.k6Results(Configs.E2E.config.agents().get(0))));