Skip to content

Commit

Permalink
enable custom collector endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
nozik committed Oct 2, 2022
1 parent fbb2b8f commit 6c95ff0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class HeliosConfiguration {
public static final String HELIOS_ENVIRONMENT_ENV_VAR = "HS_ENVIRONMENT";
public static final String HELIOS_SERVICE_NAME_ENV_VAR = "HS_SERVICE_NAME";
public static final String HELIOS_TOKEN_ENV_VAR = "HS_TOKEN";
public static final String HELIOS_COLLECTOR_ENDPOINT_ENV_VAR = "HS_COLLECTOR_ENDPOINT";
public static final String DEFAULT_COLLECTOR_ENDPOINT = "https://collector.heliosphere.io/traces";

public static String getEnvironmentName() {
return System.getenv(HELIOS_ENVIRONMENT_ENV_VAR);
Expand All @@ -32,4 +34,9 @@ public static String getServiceName() {
public static String getHsToken() {
return System.getenv(HELIOS_TOKEN_ENV_VAR);
}

public static String getCollectorEndpoint() {
String result = System.getenv(HELIOS_COLLECTOR_ENDPOINT_ENV_VAR);
return result == null ? DEFAULT_COLLECTOR_ENDPOINT : result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.javaagent.tooling;

import static io.opentelemetry.javaagent.tooling.HeliosConfiguration.getCollectorEndpoint;
import static io.opentelemetry.javaagent.tooling.HeliosConfiguration.getHsToken;

import io.opentelemetry.instrumentation.api.appender.internal.LogEmitterProvider;
Expand Down Expand Up @@ -68,8 +69,7 @@ static void setHeliosSystemProperties() {

if (hsToken != null) {
System.setProperty("otel.exporter.otlp.headers", String.format("Authorization=%s", hsToken));
System.setProperty(
"otel.exporter.otlp.traces.endpoint", "https://collector.heliosphere.io/traces");
System.setProperty("otel.exporter.otlp.traces.endpoint", getCollectorEndpoint());
System.setProperty("otel.exporter.otlp.traces.protocol", "http/protobuf");
}
}
Expand Down
2 changes: 1 addition & 1 deletion version.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
val stableVersion = "1.0.2"
val stableVersion = "1.0.3"
val alphaVersion = "1.17.1-alpha-SNAPSHOT"

allprojects {
Expand Down

0 comments on commit 6c95ff0

Please sign in to comment.