Skip to content

Commit 7d4166f

Browse files
authored
added MW_AGENT_SERVICE env support (#5)
1 parent 35924da commit 7d4166f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/extension/src/main/java/com/example/javaagent/DemoAutoConfigurationCustomizerProvider.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ private SdkLoggerProviderBuilder configureSdkLoggerProvider(
4242

4343
private Map<String, String> getDefaultProperties() {
4444
Map<String, String> properties = new HashMap<>();
45-
properties.put("otel.exporter.otlp.endpoint", "http://localhost:9319");
45+
String hostname = System.getenv().getOrDefault("MW_AGENT_SERVICE", "localhost");
46+
properties.put("otel.exporter.otlp.endpoint", "http://" + hostname + ":9319");
4647
properties.put("otel.metrics.exporter", "otlp");
4748
properties.put("otel.logs.exporter", "otlp");
4849
properties.put("otel.instrumentation.runtime-telemetry-java17.enable-all", "true");

0 commit comments

Comments
 (0)