Skip to content

Commit 664941e

Browse files
committed
set the default values of some of the system properties for non lambda env
1 parent 4d65752 commit 664941e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsApplicationSignalsCustomizerProvider.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ public class AwsApplicationSignalsCustomizerProvider
102102
private static final String OTEL_BSP_MAX_EXPORT_BATCH_SIZE_CONFIG =
103103
"otel.bsp.max.export.batch.size";
104104

105+
private static final String OTEL_METRICS_EXPORTER = "otel.metrics.exporter";
106+
private static final String OTEL_LOGS_EXPORTER = "otel.logs.exporter";
107+
private static final String OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT = "otel.aws.application.signals.exporter.endpoint";
108+
private static final String OTEL_EXPORTER_OTLP_PROTOCOL = "otel.exporter.otlp.protocol";
109+
private static final String OTEL_EXPORTER_OTLP_TRACES_ENDPOINT = "otel.exporter.otlp.traces.endpoint";
110+
private static final String OTEL_TRACES_SAMPLER = "otel.traces.sampler";
111+
private static final String OTEL_TRACES_SAMPLER_ARG = "otel.traces.sampler.arg";
112+
105113
// UDP packet can be upto 64KB. To limit the packet size, we limit the exported batch size.
106114
// This is a bit of a magic number, as there is no simple way to tell how many spans can make a
107115
// 64KB batch since spans can vary in size.
@@ -140,6 +148,17 @@ private Map<String, String> customizeProperties(ConfigProperties configProps) {
140148
// Enable AWS Resource Providers
141149
propsOverride.put(OTEL_RESOURCE_PROVIDERS_AWS_ENABLED, "true");
142150

151+
if (!isLambdaEnvironment()) {
152+
// Set default values for non Lambda environment
153+
propsOverride.put(OTEL_METRICS_EXPORTER, "none");
154+
propsOverride.put(OTEL_LOGS_EXPORTER, "none");
155+
propsOverride.put(OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT, "http://localhost:4316/v1/metrics");
156+
propsOverride.put(OTEL_EXPORTER_OTLP_PROTOCOL, "http/protobuf");
157+
propsOverride.put(OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, "http://localhost:4316/v1/traces");
158+
propsOverride.put(OTEL_TRACES_SAMPLER, "xray");
159+
propsOverride.put(OTEL_TRACES_SAMPLER_ARG, "endpoint=http://localhost:2000");
160+
}
161+
143162
if (isApplicationSignalsRuntimeEnabled(configProps)) {
144163
List<String> list = configProps.getList(OTEL_JMX_TARGET_SYSTEM_CONFIG);
145164
if (list.contains("jvm")) {

0 commit comments

Comments
 (0)