Skip to content

Commit a7d7adf

Browse files
authored
Merge pull request #800 from harrryr/main
Add different endpoints for GRPC and HTTP protocal
2 parents dc29a0c + 402053d commit a7d7adf

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,25 @@ public MetricExporter createExporter(ConfigProperties configProps) {
137137
OtlpConfigUtil.getOtlpProtocol(OtlpConfigUtil.DATA_TYPE_METRICS, configProps);
138138
logger.log(Level.FINE, String.format("AppSignals export protocol: %s", protocol));
139139

140-
String appSignalsEndpoint =
141-
configProps.getString(
142-
"otel.aws.app.signals.exporter.endpoint",
143-
configProps.getString("otel.aws.smp.exporter.endpoint", "http://localhost:4315"));
144-
logger.log(Level.FINE, String.format("AppSignals export endpoint: %s", appSignalsEndpoint));
145-
140+
String appSignalsEndpoint;
146141
if (protocol.equals(OtlpConfigUtil.PROTOCOL_HTTP_PROTOBUF)) {
142+
appSignalsEndpoint =
143+
configProps.getString(
144+
"otel.aws.app.signals.exporter.endpoint",
145+
configProps.getString(
146+
"otel.aws.smp.exporter.endpoint", "http://localhost:4316/v1/metrics"));
147+
logger.log(Level.FINE, String.format("AppSignals export endpoint: %s", appSignalsEndpoint));
147148
return OtlpHttpMetricExporter.builder()
148149
.setEndpoint(appSignalsEndpoint)
149150
.setDefaultAggregationSelector(this::getAggregation)
150151
.setAggregationTemporalitySelector(AggregationTemporalitySelector.deltaPreferred())
151152
.build();
152153
} else if (protocol.equals(OtlpConfigUtil.PROTOCOL_GRPC)) {
154+
appSignalsEndpoint =
155+
configProps.getString(
156+
"otel.aws.app.signals.exporter.endpoint",
157+
configProps.getString("otel.aws.smp.exporter.endpoint", "http://localhost:4315"));
158+
logger.log(Level.FINE, String.format("AppSignals export endpoint: %s", appSignalsEndpoint));
153159
return OtlpGrpcMetricExporter.builder()
154160
.setEndpoint(appSignalsEndpoint)
155161
.setDefaultAggregationSelector(this::getAggregation)

0 commit comments

Comments
 (0)