Skip to content

Commit 3558887

Browse files
committed
Enable AWS Resource detector.
1 parent 8b4a4d9 commit 3558887

File tree

6 files changed

+22
-23
lines changed

6 files changed

+22
-23
lines changed

appsignals-tests/contract-tests/src/test/java/software/amazon/opentelemetry/appsignals/test/httpservers/base/BaseHttpServerTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ protected void assertSemanticConventionsSpanAttributes(
8484
});
8585
}
8686

87-
// some sementic attributes has been removed:
88-
//
89-
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/commit/7cd705b55594f17f821c16181bb2f12d093e6680
9087
protected void assertSemanticConventionsAttributes(
9188
List<KeyValue> attributesList, String method, String route, String target, long status_code) {
9289
assertThat(attributesList)

appsignals-tests/contract-tests/src/test/java/software/amazon/opentelemetry/appsignals/test/utils/JMXMetricsConstants.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ public class JMXMetricsConstants {
9191
TOMCAT_REQUEST_COUNT,
9292
TOMCAT_MAX_TIME,
9393
TOMCAT_PROCESSING_TIME,
94-
TOMCAT_TRAFFIC,
95-
TOMCAT_THREADS);
94+
// TODO: Pending on root cause why tomcat.threads can be negative
95+
// TOMCAT_THREADS,
96+
TOMCAT_TRAFFIC);
9697

9798
// Kafka Metrics
9899
public static final String KAFKA_MESSAGE_COUNT = "kafka.message.count";

appsignals-tests/contract-tests/src/test/java/software/amazon/opentelemetry/appsignals/test/utils/SemanticConventionsConstants.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ public class SemanticConventionsConstants {
7777
// kafka
7878
public static final String MESSAGING_CLIENT_ID = "messaging.client_id";
7979
public static final String MESSAGING_DESTINATION_NAME = "messaging.destination.name";
80-
// Rename `messaging.kafka.destination.partition` to `messaging.destination.partition.id`
81-
//
82-
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/57c7cf2ad5f7272c1eb83b9816e652bf832c91d4/CHANGELOG.md?plain=1#L430C3-L430C89
8380
public static final String MESSAGING_DESTINATION_PARTITION_ID =
8481
"messaging.destination.partition.id";
8582
public static final String MESSAGING_KAFKA_MESSAGE_OFFSET = "messaging.kafka.message.offset";

awsagentprovider/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ dependencies {
5959

6060
tasks {
6161
val shadowJar by existing(ShadowJar::class) {
62-
// You can configure the existing task here
6362
archiveClassifier.set("")
6463
}
6564
}

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

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ public class AwsApplicationSignalsCustomizerProvider
8080
"otel.aws.app.signals.enabled";
8181
private static final String APPLICATION_SIGNALS_ENABLED_CONFIG =
8282
"otel.aws.application.signals.enabled";
83+
84+
private static final String OTEL_RESOURCE_PROVIDERS_AWS_ENABLED =
85+
"otel.resource.providers.aws.enabled";
8386
private static final String APPLICATION_SIGNALS_RUNTIME_ENABLED_CONFIG =
8487
"otel.aws.application.signals.runtime.enabled";
8588
private static final String DEPRECATED_SMP_EXPORTER_ENDPOINT_CONFIG =
@@ -132,19 +135,23 @@ private boolean isApplicationSignalsRuntimeEnabled(ConfigProperties configProps)
132135
}
133136

134137
private Map<String, String> customizeProperties(ConfigProperties configProps) {
135-
if (isApplicationSignalsRuntimeEnabled(configProps)) {
136-
List<String> list = configProps.getList(OTEL_JMX_TARGET_SYSTEM_CONFIG);
137-
if (list.contains("jvm")) {
138-
logger.log(Level.INFO, "Found jmx in {0}", OTEL_JMX_TARGET_SYSTEM_CONFIG);
139-
return Collections.emptyMap();
140-
} else {
141-
logger.log(Level.INFO, "Configure jmx in {0}", OTEL_JMX_TARGET_SYSTEM_CONFIG);
142-
List<String> jmxTargets = new ArrayList<>(list);
143-
jmxTargets.add("jvm");
144-
Map<String, String> propsOverride = new HashMap<>(1);
145-
propsOverride.put(OTEL_JMX_TARGET_SYSTEM_CONFIG, String.join(",", jmxTargets));
146-
return propsOverride;
138+
if (isApplicationSignalsEnabled(configProps)) {
139+
Map<String, String> propsOverride = new HashMap<>();
140+
// Enable AWS Resource Providers
141+
propsOverride.put(OTEL_RESOURCE_PROVIDERS_AWS_ENABLED, "true");
142+
143+
if (isApplicationSignalsRuntimeEnabled(configProps)) {
144+
List<String> list = configProps.getList(OTEL_JMX_TARGET_SYSTEM_CONFIG);
145+
if (list.contains("jvm")) {
146+
logger.log(Level.INFO, "Found jmx in {0}", OTEL_JMX_TARGET_SYSTEM_CONFIG);
147+
} else {
148+
logger.log(Level.INFO, "Configure jmx in {0}", OTEL_JMX_TARGET_SYSTEM_CONFIG);
149+
List<String> jmxTargets = new ArrayList<>(list);
150+
jmxTargets.add("jvm");
151+
propsOverride.put(OTEL_JMX_TARGET_SYSTEM_CONFIG, String.join(",", jmxTargets));
152+
}
147153
}
154+
return propsOverride;
148155
}
149156
return Collections.emptyMap();
150157
}

smoke-tests/runner/src/test/java/io/awsobservability/instrumentation/smoketests/runner/SpringBootSmokeTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ public ExportTraceServiceRequest deserialize(
122122
.withEnv("OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED", "true")
123123
.withEnv("OTEL_EXPORTER_OTLP_ENDPOINT", "http://backend:8080");
124124

125-
// Suppressing controller and/or view spans:
126-
// https://opentelemetry.io/docs/zero-code/java/agent/disable/#suppressing-controller-andor-view-spans
127125
@Container
128126
private static final GenericContainer<?> applicationXraySampler =
129127
new GenericContainer<>("public.ecr.aws/aws-otel-test/aws-otel-java-smoketests-springboot:v2")

0 commit comments

Comments
 (0)