Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
237 changes: 237 additions & 0 deletions .github/patches/opentelemetry-java-contrib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
diff --git a/aws-xray/src/main/java/io/opentelemetry/contrib/awsxray/SamplingRuleApplier.java b/aws-xray/src/main/java/io/opentelemetry/contrib/awsxray/SamplingRuleApplier.java
index 1ef8abf..ef84f35 100644
--- a/aws-xray/src/main/java/io/opentelemetry/contrib/awsxray/SamplingRuleApplier.java
+++ b/aws-xray/src/main/java/io/opentelemetry/contrib/awsxray/SamplingRuleApplier.java
@@ -35,6 +35,11 @@ final class SamplingRuleApplier {

private static final Map<String, String> XRAY_CLOUD_PLATFORM;

+ private static final AttributeKey<String> URL_PATH = AttributeKey.stringKey("url.path");
+ private static final AttributeKey<String> URL_FULL = AttributeKey.stringKey("url.full");
+ private static final AttributeKey<String> HTTP_REQUEST_METHOD =
+ AttributeKey.stringKey("http.request.method");
+
static {
Map<String, String> xrayCloudPlatform = new HashMap<>();
xrayCloudPlatform.put(ResourceAttributes.CloudPlatformValues.AWS_EC2, "AWS::EC2::Instance");
@@ -162,11 +167,14 @@ final class SamplingRuleApplier {
String host = null;

for (Map.Entry<AttributeKey<?>, Object> entry : attributes.asMap().entrySet()) {
- if (entry.getKey().equals(SemanticAttributes.HTTP_TARGET)) {
+ if (entry.getKey().equals(SemanticAttributes.HTTP_TARGET)
+ || entry.getKey().equals(URL_PATH)) {
httpTarget = (String) entry.getValue();
- } else if (entry.getKey().equals(SemanticAttributes.HTTP_URL)) {
+ } else if (entry.getKey().equals(SemanticAttributes.HTTP_URL)
+ || entry.getKey().equals(URL_FULL)) {
httpUrl = (String) entry.getValue();
- } else if (entry.getKey().equals(SemanticAttributes.HTTP_METHOD)) {
+ } else if (entry.getKey().equals(SemanticAttributes.HTTP_METHOD)
+ || entry.getKey().equals(HTTP_REQUEST_METHOD)) {
httpMethod = (String) entry.getValue();
} else if (entry.getKey().equals(SemanticAttributes.NET_HOST_NAME)) {
host = (String) entry.getValue();
diff --git a/aws-xray/src/test/java/io/opentelemetry/contrib/awsxray/SamplingRuleApplierTest.java b/aws-xray/src/test/java/io/opentelemetry/contrib/awsxray/SamplingRuleApplierTest.java
index 6bb6e82..55dabbd 100644
--- a/aws-xray/src/test/java/io/opentelemetry/contrib/awsxray/SamplingRuleApplierTest.java
+++ b/aws-xray/src/test/java/io/opentelemetry/contrib/awsxray/SamplingRuleApplierTest.java
@@ -42,6 +42,11 @@ class SamplingRuleApplierTest {

private static final String CLIENT_ID = "test-client-id";

+ private static final AttributeKey<String> URL_PATH = AttributeKey.stringKey("url.path");
+ private static final AttributeKey<String> URL_FULL = AttributeKey.stringKey("url.full");
+ private static final AttributeKey<String> HTTP_REQUEST_METHOD =
+ AttributeKey.stringKey("http.request.method");
+
@Nested
@SuppressWarnings("ClassCanBeStatic")
class ExactMatch {
@@ -68,6 +73,15 @@ class SamplingRuleApplierTest {
.put(AttributeKey.longKey("speed"), 10)
.build();

+ private final Attributes newSemCovAttributes =
+ Attributes.builder()
+ .put(HTTP_REQUEST_METHOD, "GET")
+ .put(SemanticAttributes.NET_HOST_NAME, "opentelemetry.io")
+ .put(URL_PATH, "/instrument-me")
+ .put(AttributeKey.stringKey("animal"), "cat")
+ .put(AttributeKey.longKey("speed"), 10)
+ .build();
+
// FixedRate set to 1.0 in rule and no reservoir
@Test
void fixedRateAlwaysSample() {
@@ -116,6 +130,21 @@ class SamplingRuleApplierTest {
.isTrue();
}

+ @Test
+ void matchesURLFullNewSemCov() {
+ assertThat(applier.matches(newSemCovAttributes, resource)).isTrue();
+
+ // http.url works too
+ assertThat(
+ applier.matches(
+ attributes.toBuilder()
+ .remove(URL_FULL)
+ .put(URL_FULL, "scheme://host:port/instrument-me")
+ .build(),
+ resource))
+ .isTrue();
+ }
+
@Test
void serviceNameNotMatch() {
assertThat(
@@ -137,6 +166,13 @@ class SamplingRuleApplierTest {
assertThat(applier.matches(attributes, resource)).isFalse();
}

+ @Test
+ void methodNewSemCovNotMatch() {
+ Attributes attributes =
+ this.newSemCovAttributes.toBuilder().put(HTTP_REQUEST_METHOD, "POST").build();
+ assertThat(applier.matches(attributes, resource)).isFalse();
+ }
+
@Test
void hostNotMatch() {
// Replacing dot with character makes sure we're not accidentally treating dot as regex
@@ -178,6 +214,34 @@ class SamplingRuleApplierTest {
assertThat(applier.matches(attributes, resource)).isFalse();
}

+ @Test
+ void pathNewSemCovNotMatch() {
+ Attributes attributes =
+ this.newSemCovAttributes.toBuilder().put(URL_PATH, "/instrument-you").build();
+ assertThat(applier.matches(attributes, resource)).isFalse();
+ attributes =
+ this.newSemCovAttributes.toBuilder()
+ .remove(URL_PATH)
+ .put(URL_FULL, "scheme://host:port/instrument-you")
+ .build();
+ assertThat(applier.matches(attributes, resource)).isFalse();
+ attributes =
+ this.newSemCovAttributes.toBuilder()
+ .remove(URL_PATH)
+ .put(URL_FULL, "scheme://host:port")
+ .build();
+ assertThat(applier.matches(attributes, resource)).isFalse();
+
+ // Correct path, but we ignore anyways since the URL is malformed per spec, scheme is always
+ // present.
+ attributes =
+ this.newSemCovAttributes.toBuilder()
+ .remove(URL_PATH)
+ .put(URL_FULL, "host:port/instrument-me")
+ .build();
+ assertThat(applier.matches(attributes, resource)).isFalse();
+ }
+
@Test
void attributeNotMatch() {
Attributes attributes =
@@ -243,6 +307,15 @@ class SamplingRuleApplierTest {
.put(AttributeKey.longKey("speed"), 10)
.build();

+ private final Attributes newSemCovAttributes =
+ Attributes.builder()
+ .put(HTTP_REQUEST_METHOD, "GET")
+ .put(SemanticAttributes.NET_HOST_NAME, "opentelemetry.io")
+ .put(URL_PATH, "/instrument-me?foo=bar&cat=meow")
+ .put(AttributeKey.stringKey("animal"), "cat")
+ .put(AttributeKey.longKey("speed"), 10)
+ .build();
+
// FixedRate set to 0.0 in rule and no reservoir
@Test
void fixedRateNeverSample() {
@@ -329,6 +402,26 @@ class SamplingRuleApplierTest {
assertThat(applier.matches(attributes, resource)).isFalse();
}

+ @Test
+ void newSemCovMethodMatches() {
+ Attributes attributes =
+ this.newSemCovAttributes.toBuilder().put(HTTP_REQUEST_METHOD, "BADGETGOOD").build();
+ assertThat(applier.matches(attributes, resource)).isTrue();
+ attributes = newSemCovAttributes.toBuilder().put(HTTP_REQUEST_METHOD, "BADGET").build();
+ assertThat(applier.matches(attributes, resource)).isTrue();
+ attributes = newSemCovAttributes.toBuilder().put(HTTP_REQUEST_METHOD, "GETGET").build();
+ assertThat(applier.matches(attributes, resource)).isTrue();
+ }
+
+ @Test
+ void newSemCovMethodNotMatch() {
+ Attributes attributes =
+ newSemCovAttributes.toBuilder().put(HTTP_REQUEST_METHOD, "POST").build();
+ assertThat(applier.matches(attributes, resource)).isFalse();
+ attributes = removeAttribute(newSemCovAttributes, HTTP_REQUEST_METHOD);
+ assertThat(applier.matches(attributes, resource)).isFalse();
+ }
+
@Test
void hostMatches() {
Attributes attributes =
@@ -410,6 +503,29 @@ class SamplingRuleApplierTest {
assertThat(applier.matches(attributes, resource)).isFalse();
}

+ @Test
+ void pathNewSemCovMatches() {
+ Attributes attributes =
+ newSemCovAttributes.toBuilder().put(URL_PATH, "/instrument-me?foo=bar&cat=").build();
+ assertThat(applier.matches(attributes, resource)).isTrue();
+ // Deceptive question mark, it's actually a wildcard :-)
+ attributes =
+ newSemCovAttributes.toBuilder().put(URL_PATH, "/instrument-meafoo=bar&cat=").build();
+ assertThat(applier.matches(attributes, resource)).isTrue();
+ }
+
+ @Test
+ void pathNewSemCovNotMatch() {
+ Attributes attributes =
+ newSemCovAttributes.toBuilder().put(URL_PATH, "/instrument-mea?foo=bar&cat=").build();
+ assertThat(applier.matches(attributes, resource)).isFalse();
+ attributes =
+ newSemCovAttributes.toBuilder().put(URL_PATH, "foo/instrument-meafoo=bar&cat=").build();
+ assertThat(applier.matches(attributes, resource)).isFalse();
+ attributes = removeAttribute(newSemCovAttributes, URL_PATH);
+ assertThat(applier.matches(attributes, resource)).isFalse();
+ }
+
@Test
void attributeMatches() {
Attributes attributes =
diff --git a/disk-buffering/build.gradle.kts b/disk-buffering/build.gradle.kts
index 041d2e9..e3d60f4 100644
--- a/disk-buffering/build.gradle.kts
+++ b/disk-buffering/build.gradle.kts
@@ -70,6 +70,10 @@ tasks.named<ShadowJar>("shadowJar") {
mustRunAfter("jar")
}

+tasks.withType<Test>().configureEach {
+ dependsOn("shadowJar")
+}
+
// The javadoc from wire's generated classes has errors that make the task that generates the "javadoc" artifact to fail. This
// makes the javadoc task to ignore those generated classes.
tasks.withType(Javadoc::class.java) {
diff --git a/version.gradle.kts b/version.gradle.kts
index acefcee..329b524 100644
--- a/version.gradle.kts
+++ b/version.gradle.kts
@@ -1,5 +1,5 @@
-val stableVersion = "1.39.0"
-val alphaVersion = "1.39.0-alpha"
+val stableVersion = "1.39.0-adot1"
+val alphaVersion = "1.39.0-alpha-adot1"

allprojects {
if (findProperty("otel.stable") != "true") {
4 changes: 2 additions & 2 deletions .github/patches/opentelemetry-java-instrumentation.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3573,8 +3573,8 @@ index a1cae43b4b..c1520e9947 100644
@@ -1,5 +1,5 @@
-val stableVersion = "2.11.0"
-val alphaVersion = "2.11.0-alpha"
+val stableVersion = "2.11.0-adot1"
+val alphaVersion = "2.11.0-adot1-alpha"
+val stableVersion = "2.11.0-adot2"
+val alphaVersion = "2.11.0-adot2-alpha"

allprojects {
if (findProperty("otel.stable") != "true") {
1 change: 1 addition & 0 deletions .github/patches/versions
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
OTEL_JAVA_INSTRUMENTATION_VERSION=v2.11.0
OTEL_JAVA_CONTRIB_VERSION=v1.39.0
4 changes: 2 additions & 2 deletions .github/workflows/owasp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ jobs:
id: high_scan_v2
uses: ./.github/actions/image_scan
with:
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v2.10.0"
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v2.11.0"
severity: 'CRITICAL,HIGH'

- name: Perform low image scan on v2
if: always()
id: low_scan_v2
uses: ./.github/actions/image_scan
with:
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v2.10.0"
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v2.11.0"
severity: 'MEDIUM,LOW,UNKNOWN'

- name: Configure AWS Credentials for emitting metrics
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-udp-exporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ jobs:
--title "Release aws-distro-opentelemetry-xray-udp-span-exporter v${{ inputs.udp-exporter-version }}" \
--notes "Please refer to the [Changelog](https://github.com/aws-observability/aws-otel-java-instrumentation/blob/main/exporters/aws-distro-opentelemetry-xray-udp-span-exporter/CHANGELOG.md) for more details" \
--draft \
"v${{ inputs.udp-exporter-version }}"
"aws-distro-opentelemetry-xray-udp-span-exporter/v${{ inputs.udp-exporter-version }}"
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
public final class AwsApplicationSignalsCustomizerProvider
implements AutoConfigurationCustomizerProvider {
static final String AWS_LAMBDA_FUNCTION_NAME_CONFIG = "AWS_LAMBDA_FUNCTION_NAME";
static final String LAMBDA_APPLICATION_SIGNALS_REMOTE_ENVIRONMENT =
"LAMBDA_APPLICATION_SIGNALS_REMOTE_ENVIRONMENT";

private static final Duration DEFAULT_METRIC_EXPORT_INTERVAL = Duration.ofMinutes(1);
private static final Logger logger =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ private AwsAttributeKeys() {}
static final AttributeKey<String> AWS_REMOTE_SERVICE =
AttributeKey.stringKey("aws.remote.service");

static final AttributeKey<String> AWS_REMOTE_ENVIRONMENT =
AttributeKey.stringKey("aws.remote.environment");

static final AttributeKey<String> AWS_REMOTE_OPERATION =
AttributeKey.stringKey("aws.remote.operation");

Expand Down Expand Up @@ -64,6 +67,9 @@ private AwsAttributeKeys() {}
static final AttributeKey<String> AWS_SECRET_ARN =
AttributeKey.stringKey("aws.secretsmanager.secret.arn");

static final AttributeKey<String> AWS_LAMBDA_NAME =
AttributeKey.stringKey("aws.lambda.function.name");

static final AttributeKey<String> AWS_LAMBDA_ARN =
AttributeKey.stringKey("aws.lambda.function.arn");

Expand Down
Loading
Loading