Skip to content

Commit 5d07e67

Browse files
committed
[AdaptiveSampling] Improve sampling rule propagation + other improvements
1 parent 22a807b commit 5d07e67

File tree

9 files changed

+381
-146
lines changed

9 files changed

+381
-146
lines changed

.github/actions/patch-dependencies/action.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ runs:
4949
if [[ -f .github/patches/opentelemetry-java.patch ]]; then
5050
echo 'patch_otel_java=true' >> $GITHUB_ENV
5151
fi
52+
if [[ -f .github/patches/opentelemetry-java-instrumentation.patch ]]; then
53+
echo 'patch_otel_java_instrumentation=true' >> $GITHUB_ENV
54+
fi
5255
if [[ -f .github/patches/opentelemetry-java-contrib.patch ]]; then
5356
echo 'patch_otel_java_contrib=true' >> $GITHUB_ENV
5457
fi
@@ -97,3 +100,22 @@ runs:
97100
run: rm -rf opentelemetry-java-contrib
98101
if: ${{ env.patch_otel_java_contrib == 'true' }}
99102
shell: bash
103+
104+
- name: Build opentelemetry-java-instrumentation with tests
105+
uses: gradle/gradle-build-action@v2
106+
if: ${{ env.patch_otel_java_instrumentation == 'true' && inputs.run_tests != 'false' }}
107+
with:
108+
arguments: check -x spotlessCheck publishToMavenLocal
109+
build-root-directory: opentelemetry-java-instrumentation
110+
111+
- name: Build opentelemetry java instrumentation
112+
uses: gradle/gradle-build-action@v2
113+
if: ${{ env.patch_otel_java_instrumentation == 'true' && inputs.run_tests == 'false' }}
114+
with:
115+
arguments: publishToMavenLocal
116+
build-root-directory: opentelemetry-java-instrumentation
117+
118+
- name: cleanup opentelmetry-java-instrumentation
119+
run: rm -rf opentelemetry-java-instrumentation
120+
if: ${{ env.patch_otel_java_instrumentation == 'true' }}
121+
shell: bash

.github/patches/opentelemetry-java-contrib.patch

Lines changed: 287 additions & 142 deletions
Large diffs are not rendered by default.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
diff --git a/dependencyManagement/build.gradle.kts b/dependencyManagement/build.gradle.kts
2+
index d020848503..88f0a60ac6 100644
3+
--- a/dependencyManagement/build.gradle.kts
4+
+++ b/dependencyManagement/build.gradle.kts
5+
@@ -100,7 +100,7 @@ val DEPENDENCIES = listOf(
6+
"commons-validator:commons-validator:1.9.0",
7+
"io.netty:netty:3.10.6.Final",
8+
"io.opentelemetry.contrib:opentelemetry-aws-resources:${otelContribVersion}",
9+
- "io.opentelemetry.contrib:opentelemetry-aws-xray-propagator:${otelContribVersion}",
10+
+ "io.opentelemetry.contrib:opentelemetry-aws-xray-propagator:1.39.0-alpha-adot1",
11+
"io.opentelemetry.contrib:opentelemetry-gcp-resources:${otelContribVersion}",
12+
"io.opentelemetry.contrib:opentelemetry-baggage-processor:${otelContribVersion}",
13+
"io.opentelemetry.proto:opentelemetry-proto:1.4.0-alpha",
14+
diff --git a/version.gradle.kts b/version.gradle.kts
15+
index a1cae43b4b..c1520e9947 100644
16+
--- a/version.gradle.kts
17+
+++ b/version.gradle.kts
18+
@@ -1,5 +1,5 @@
19+
-val stableVersion = "2.11.0"
20+
-val alphaVersion = "2.11.0-alpha"
21+
+val stableVersion = "2.11.0-adot1"
22+
+val alphaVersion = "2.11.0-adot1-alpha"
23+
24+
allprojects {
25+
if (findProperty("otel.stable") != "true") {
26+
--
27+
2.45.1
28+

.github/scripts/patch.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,16 @@ if [[ -f "$OTEL_JAVA_CONTRIB_PATCH" ]]; then
4444
else
4545
echo "Skipping patching opentelemetry-java-contrib"
4646
fi
47+
48+
49+
OTEL_JAVA_INSTRUMENTATION_PATCH=".github/patches/opentelemetry-java-instrumentation.patch"
50+
if [[ -f "$OTEL_JAVA_INSTRUMENTATION_PATCH" ]]; then
51+
git clone https://github.com/open-telemetry/opentelemetry-java-instrumentation.git
52+
cd opentelemetry-java-instrumentation
53+
git checkout ${OTEL_JAVA_INSTRUMENTATION_VERSION} -b tag-${OTEL_JAVA_INSTRUMENTATION_VERSION}
54+
patch -p1 < "../${OTEL_JAVA_INSTRUMENTATION_PATCH}"
55+
git commit -a -m "ADOT Patch release"
56+
cd -
57+
else
58+
echo "Skipping patching opentelemetry-java-instrumentation"
59+
fi

dependencyManagement/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ data class DependencySet(val group: String, val version: String, val modules: Li
2727
val testSnapshots = rootProject.findProperty("testUpstreamSnapshots") == "true"
2828

2929
// This is the version of the upstream instrumentation BOM
30-
val otelVersion = "2.11.0"
30+
val otelVersion = "2.11.0-adot1"
3131
val otelSnapshotVersion = "2.12.0"
3232
val otelAlphaVersion = if (!testSnapshots) "$otelVersion-alpha" else "$otelSnapshotVersion-alpha-SNAPSHOT"
3333
val otelJavaAgentVersion = if (!testSnapshots) otelVersion else "$otelSnapshotVersion-SNAPSHOT"

lambda-layer/build-layer.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ git clone https://github.com/open-telemetry/opentelemetry-java-instrumentation.g
2222
pushd opentelemetry-java-instrumentation
2323
git checkout v${version} -b tag-v${version}
2424

25+
# There is another patch in the .github/patches directory for other changes. We should apply them too for consistency.
26+
patch -p1 < "$SOURCEDIR"/../.github/patches/opentelemetry-java-instrumentation.patch
27+
2528
# This patch is for Lambda related context propagation
2629
patch -p1 < "$SOURCEDIR"/patches/opentelemetry-java-instrumentation.patch
2730

lambda-layer/patches/aws-otel-java-instrumentation.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ index 9493189..6090207 100644
66
val testSnapshots = rootProject.findProperty("testUpstreamSnapshots") == "true"
77

88
// This is the version of the upstream instrumentation BOM
9-
-val otelVersion = "2.11.0"
9+
-val otelVersion = "2.11.0-adot1"
1010
+val otelVersion = "2.11.0-adot-lambda1"
1111
val otelSnapshotVersion = "2.12.0"
1212
val otelAlphaVersion = if (!testSnapshots) "$otelVersion-alpha" else "$otelSnapshotVersion-alpha-SNAPSHOT"

lambda-layer/patches/opentelemetry-java-instrumentation.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ index 7900c9a4d9..80383d7c22 100644
310310
--- a/version.gradle.kts
311311
+++ b/version.gradle.kts
312312
@@ -1,5 +1,5 @@
313-
-val stableVersion = "2.11.0"
314-
-val alphaVersion = "2.11.0-alpha"
313+
-val stableVersion = "2.11.0-adot1"
314+
-val alphaVersion = "2.11.0-adot1-alpha"
315315
+val stableVersion = "2.11.0-adot-lambda1"
316316
+val alphaVersion = "2.11.0-adot-lambda1-alpha"
317317

scripts/local_patch.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,28 @@ if [[ -f "$OTEL_JAVA_CONTRIB_PATCH" ]]; then
5656
rm -rf opentelemetry-java-contrib
5757
else
5858
echo "Skipping patching opentelemetry-java-contrib"
59+
fi
60+
61+
62+
# Patching opentelemetry-java-instrumentation
63+
OTEL_JAVA_INSTRUMENTATION_PATCH=".github/patches/opentelemetry-java-instrumentation.patch"
64+
if [[ -f "$OTEL_JAVA_INSTRUMENTATION_PATCH" ]]; then
65+
echo "Patching opentelemetry-java-instrumentation"
66+
git clone https://github.com/open-telemetry/opentelemetry-java-instrumentation.git
67+
cd opentelemetry-java-instrumentation
68+
69+
echo "Checking out tag ${OTEL_JAVA_INSTRUMENTATION_VERSION}"
70+
git checkout ${OTEL_JAVA_INSTRUMENTATION_VERSION} -b tag-${OTEL_JAVA_INSTRUMENTATION_VERSION}
71+
patch -p1 < "../${OTEL_JAVA_INSTRUMENTATION_PATCH}"
72+
git commit -a -m "ADOT Patch release"
73+
74+
echo "Building patched opentelemetry-java-instrumentation"
75+
./gradlew clean assemble
76+
./gradlew publishToMavenLocal
77+
cd -
78+
79+
echo "Cleaning up opentelemetry-java-instrumentation"
80+
rm -rf opentelemetry-java-instrumentation
81+
else
82+
echo "Skipping patching opentelemetry-java-instrumentation"
5983
fi

0 commit comments

Comments
 (0)