diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 7971d1daf5b2..e1c0e8066f1a 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -1,6 +1,6 @@
#
# Learn about membership in OpenTelemetry community:
-# https://github.com/open-telemetry/community/blob/main/community-membership.md
+# https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md
#
#
# Learn about CODEOWNERS file format:
diff --git a/.github/graal-native-docker-compose.yaml b/.github/graal-native-docker-compose.yaml
index 5f7634b72ec4..bdcf87f31317 100644
--- a/.github/graal-native-docker-compose.yaml
+++ b/.github/graal-native-docker-compose.yaml
@@ -14,14 +14,18 @@ services:
kafka:
image: confluentinc/cp-kafka:6.2.10
+ ports:
+ - 9094:9094
depends_on:
- zookeeper
- ports:
- - "29092:29092"
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
- KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
- KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
+ KAFKA_LISTENERS: INTERNAL://0.0.0.0:9092,OUTSIDE://0.0.0.0:9094
+ KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9092,OUTSIDE://localhost:9094
+ KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,OUTSIDE:PLAINTEXT
+ KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
+ KAFKA_DEFAULT_REPLICATION_FACTOR: 1
+ KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
+ KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
diff --git a/.github/renovate.json5 b/.github/renovate.json5
index c47982066dbc..c93741ed8db4 100644
--- a/.github/renovate.json5
+++ b/.github/renovate.json5
@@ -11,11 +11,19 @@
// https://github.com/renovatebot/renovate/discussions/8399#discussioncomment-305798
"separateMinorPatch": true,
"packageRules": [
+ {
+ // this is to reduce the number of renovate PRs by consolidating them into a weekly batch
+ "matchManagers": ["github-actions"],
+ "extends": ["schedule:weekly"],
+ "groupName": "github actions",
+ "separateMinorPatch": false // overrides separateMinorPatch specified above
+ },
{
"matchPackageNames": [
"io.opentelemetry.contrib:opentelemetry-aws-resources",
"io.opentelemetry.contrib:opentelemetry-aws-xray-propagator",
"io.opentelemetry.contrib:opentelemetry-gcp-resources",
+ "io.opentelemetry.contrib:opentelemetry-baggage-processor",
"io.opentelemetry.proto:opentelemetry-proto",
"io.opentelemetry.semconv:opentelemetry-semconv"
],
diff --git a/.github/workflows/auto-update-otel-sdk.yml b/.github/workflows/auto-update-otel-sdk.yml
index 7c7773a46ac1..7fdd8c5994af 100644
--- a/.github/workflows/auto-update-otel-sdk.yml
+++ b/.github/workflows/auto-update-otel-sdk.yml
@@ -66,13 +66,13 @@ jobs:
run: .github/scripts/gha-free-disk-space.sh
- name: Set up JDK for running Gradle
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
- name: Update license report
run: ./gradlew generateLicenseReport
diff --git a/.github/workflows/build-common.yml b/.github/workflows/build-common.yml
index 8a5f1311e784..79efebc87490 100644
--- a/.github/workflows/build-common.yml
+++ b/.github/workflows/build-common.yml
@@ -32,13 +32,13 @@ jobs:
run: .github/scripts/gha-free-disk-space.sh
- name: Set up JDK for running Gradle
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
with:
cache-read-only: ${{ inputs.cache-read-only }}
# gradle enterprise is used for the build cache
@@ -54,7 +54,7 @@ jobs:
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- - uses: gradle/actions/wrapper-validation@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ - uses: gradle/actions/wrapper-validation@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
license-check:
runs-on: ubuntu-latest
@@ -65,13 +65,13 @@ jobs:
run: .github/scripts/gha-free-disk-space.sh
- name: Set up JDK for running Gradle
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
with:
cache-read-only: ${{ inputs.cache-read-only }}
# gradle enterprise is used for the build cache
@@ -88,12 +88,11 @@ jobs:
run: |
# add any untracked folders that may have been added by generateLicenseReport
git add licenses
- # there's always going to one line difference due to the timestamp included in the report
- if [[ $(git diff --cached --shortstat licenses) == " 1 file changed, 1 insertion(+), 1 deletion(-)" ]]
+ if [[ $(git diff --cached --shortstat licenses) == "" ]]
then
echo "Licenses are up-to-date."
else
- echo "Licenses are not up-to-date, please run './gradlew generateLicenseReport' locally and commit."
+ echo "Licenses are not up-to-date, please run './gradlew generateLicenseReport --no-build-cache' locally and commit."
echo
echo "$(git diff --cached --stat licenses)"
echo
@@ -135,7 +134,7 @@ jobs:
run: .github/scripts/gha-free-disk-space.sh
- name: Set up JDK for running Gradle
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
@@ -145,7 +144,7 @@ jobs:
sed -i "s/org.gradle.jvmargs=/org.gradle.jvmargs=-Xmx3g /" gradle.properties
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
with:
cache-read-only: ${{ inputs.cache-read-only }}
# gradle enterprise is used for the build cache
@@ -172,7 +171,7 @@ jobs:
fi
- name: Upload agent jar
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
+ uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: opentelemetry-javaagent.jar
path: javaagent/build/libs/opentelemetry-javaagent-*-SNAPSHOT.jar
@@ -183,7 +182,7 @@ jobs:
mkdir sboms
cp javaagent/build/spdx/*.spdx.json sboms
- - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
+ - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
name: Upload SBOMs
with:
name: opentelemetry-java-instrumentation-SBOM.zip
@@ -221,21 +220,21 @@ jobs:
- id: setup-test-java
name: Set up JDK ${{ matrix.test-java-version }}-${{ matrix.vm }} for running tests
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
# using zulu because new releases get published quickly
distribution: ${{ matrix.vm == 'hotspot' && 'zulu' || 'adopt-openj9'}}
java-version: ${{ matrix.test-java-version }}
- name: Set up JDK for running Gradle
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
# vaadin 14 tests fail with node 18
- name: Set up Node
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
+ uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: 16
@@ -250,7 +249,7 @@ jobs:
run: .github/scripts/deadlock-detector.sh
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
with:
# only push cache for one matrix option since github action cache space is limited
cache-read-only: ${{ inputs.cache-read-only || matrix.test-java-version != 11 || matrix.vm != 'hotspot' }}
@@ -292,7 +291,7 @@ jobs:
- name: Upload deadlock detector artifacts if any
if: failure()
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
+ uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: deadlock-detector-test-${{ matrix.test-java-version }}-${{ matrix.vm }}-${{ matrix.test-partition }}
path: /tmp/deadlock-detector-*
@@ -300,7 +299,7 @@ jobs:
- name: Upload jvm crash dump files if any
if: failure()
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
+ uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: javacore-test-${{ matrix.test-java-version }}-${{ matrix.test-partition }}
path: |
@@ -343,13 +342,13 @@ jobs:
run: .github/scripts/gha-free-disk-space.sh
- name: Set up JDK for running Gradle
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
- name: Set up Gradle cache
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
with:
# only push cache for one matrix option per OS since github action cache space is limited
cache-read-only: ${{ inputs.cache-read-only || matrix.smoke-test-suite != 'tomcat' }}
@@ -369,7 +368,7 @@ jobs:
- name: Upload jvm crash dump files if any
if: failure()
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
+ uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: javacore-smoke-test-${{ matrix.smoke-test-suite }}-${{ matrix.os }}
# we expect crash dumps either in root director or in smoke-tests
@@ -396,13 +395,13 @@ jobs:
run: .github/scripts/gha-free-disk-space.sh
- name: Set up JDK for running Gradle
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
with:
cache-read-only: ${{ inputs.cache-read-only }}
@@ -419,13 +418,13 @@ jobs:
run: .github/scripts/gha-free-disk-space.sh
- name: Set up JDK for running Gradle
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
- name: Set up Gradle cache
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
with:
cache-read-only: ${{ inputs.cache-read-only }}
diff --git a/.github/workflows/build-pull-request.yml b/.github/workflows/build-pull-request.yml
index 402beccc91f1..4008f6e2d316 100644
--- a/.github/workflows/build-pull-request.yml
+++ b/.github/workflows/build-pull-request.yml
@@ -2,6 +2,11 @@ name: Build pull request
on:
pull_request:
+ types:
+ - labeled
+ - opened
+ - synchronize
+ - reopened
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 23dd91e96469..214f30cb4ef6 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -67,13 +67,13 @@ jobs:
run: .github/scripts/gha-free-disk-space.sh
- name: Set up JDK for running Gradle
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
with:
# gradle enterprise is used for the build cache
gradle-home-cache-excludes: caches/build-cache-1
diff --git a/.github/workflows/codeql-daily.yml b/.github/workflows/codeql-daily.yml
index b597a361bc7a..658038dc362d 100644
--- a/.github/workflows/codeql-daily.yml
+++ b/.github/workflows/codeql-daily.yml
@@ -24,13 +24,13 @@ jobs:
run: .github/scripts/gha-free-disk-space.sh
- name: Set up Java 17
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
- name: Initialize CodeQL
- uses: github/codeql-action/init@530d4feaa9c62aaab2d250371e2061eb7a172363 # v3.25.9
+ uses: github/codeql-action/init@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0
with:
languages: java
# using "latest" helps to keep up with the latest Kotlin support
@@ -38,14 +38,14 @@ jobs:
tools: latest
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
- name: Build
# skipping build cache is needed so that all modules will be analyzed
run: ./gradlew assemble -x javadoc --no-build-cache --no-daemon
- name: Perform CodeQL analysis
- uses: github/codeql-action/analyze@530d4feaa9c62aaab2d250371e2061eb7a172363 # v3.25.9
+ uses: github/codeql-action/analyze@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0
workflow-notification:
needs:
diff --git a/.github/workflows/overhead-benchmark-daily.yml b/.github/workflows/overhead-benchmark-daily.yml
index ed072cc7c7c5..cc62b80ed000 100644
--- a/.github/workflows/overhead-benchmark-daily.yml
+++ b/.github/workflows/overhead-benchmark-daily.yml
@@ -24,7 +24,7 @@ jobs:
rsync -avv gh-pages/benchmark-overhead/results/ benchmark-overhead/results/
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
- name: Run tests
working-directory: benchmark-overhead
diff --git a/.github/workflows/owasp-dependency-check-daily.yml b/.github/workflows/owasp-dependency-check-daily.yml
index 8071a1d78035..2d44702e2024 100644
--- a/.github/workflows/owasp-dependency-check-daily.yml
+++ b/.github/workflows/owasp-dependency-check-daily.yml
@@ -19,7 +19,7 @@ jobs:
run: .github/scripts/gha-free-disk-space.sh
- name: Set up JDK for running Gradle
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
@@ -28,7 +28,7 @@ jobs:
run: |
sed -i "s/org.gradle.jvmargs=/org.gradle.jvmargs=-Xmx3g /" gradle.properties
- - uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ - uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
- run: ./gradlew :javaagent:dependencyCheckAnalyze
env:
@@ -36,7 +36,7 @@ jobs:
- name: Upload report
if: always()
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
+ uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
path: javaagent/build/reports
diff --git a/.github/workflows/pr-smoke-test-early-jdk8-images.yml b/.github/workflows/pr-smoke-test-early-jdk8-images.yml
new file mode 100644
index 000000000000..e29c168590f2
--- /dev/null
+++ b/.github/workflows/pr-smoke-test-early-jdk8-images.yml
@@ -0,0 +1,35 @@
+name: PR build early jdk8 images for smoke tests
+
+on:
+ pull_request:
+ paths:
+ - "smoke-tests/images/early-jdk8/**"
+ - ".github/workflows/pr-smoke-test-early-jdk8-images.yml"
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
+
+ - name: Free disk space
+ run: .github/scripts/gha-free-disk-space.sh
+
+ - name: Set up JDK for running Gradle
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
+ with:
+ distribution: temurin
+ java-version-file: .java-version
+
+ - name: Setup Gradle
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
+ with:
+ cache-read-only: true
+ # gradle enterprise is used for the build cache
+ gradle-home-cache-excludes: caches/build-cache-1
+
+ - name: Build Docker image
+ run: ./gradlew :smoke-tests:images:early-jdk8:imageBuild
diff --git a/.github/workflows/pr-smoke-test-fake-backend-images.yml b/.github/workflows/pr-smoke-test-fake-backend-images.yml
index d0892b77fe40..75bb09623157 100644
--- a/.github/workflows/pr-smoke-test-fake-backend-images.yml
+++ b/.github/workflows/pr-smoke-test-fake-backend-images.yml
@@ -19,13 +19,13 @@ jobs:
run: .github/scripts/gha-free-disk-space.sh
- name: Set up JDK for running Gradle
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
with:
cache-read-only: true
# gradle enterprise is used for the build cache
@@ -46,13 +46,13 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up JDK for running Gradle
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
with:
cache-read-only: true
diff --git a/.github/workflows/pr-smoke-test-servlet-images.yml b/.github/workflows/pr-smoke-test-servlet-images.yml
index 50880664b23d..52662d3943b4 100644
--- a/.github/workflows/pr-smoke-test-servlet-images.yml
+++ b/.github/workflows/pr-smoke-test-servlet-images.yml
@@ -43,7 +43,7 @@ jobs:
java-version-file: .java-version
- name: Set up Gradle cache
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
with:
cache-read-only: true
diff --git a/.github/workflows/publish-petclinic-benchmark-image.yml b/.github/workflows/publish-petclinic-benchmark-image.yml
index b3c93ba5f769..9646756ff7db 100644
--- a/.github/workflows/publish-petclinic-benchmark-image.yml
+++ b/.github/workflows/publish-petclinic-benchmark-image.yml
@@ -29,7 +29,7 @@ jobs:
run: echo "TS=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
- name: Push to GitHub packages
- uses: docker/build-push-action@v5
+ uses: docker/build-push-action@v6
with:
push: true
file: benchmark-overhead/Dockerfile-petclinic-base
diff --git a/.github/workflows/publish-smoke-test-early-jdk8-images.yml b/.github/workflows/publish-smoke-test-early-jdk8-images.yml
new file mode 100644
index 000000000000..8ba8425e28ec
--- /dev/null
+++ b/.github/workflows/publish-smoke-test-early-jdk8-images.yml
@@ -0,0 +1,49 @@
+name: Publish early jdk8 images for smoke tests
+
+on:
+ push:
+ paths:
+ - "smoke-tests/images/early-jdk8/**"
+ - ".github/workflows/pr-smoke-test-early-jdk8-images.yml"
+ branches:
+ - main
+ workflow_dispatch:
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Free disk space
+ run: .github/scripts/gha-free-disk-space.sh
+
+ - name: Set up JDK for running Gradle
+ uses: actions/setup-java@v4
+ with:
+ distribution: temurin
+ java-version-file: .java-version
+
+ - name: Login to GitHub package registry
+ uses: docker/login-action@v3
+ with:
+ registry: ghcr.io
+ username: ${{ github.repository_owner }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Set tag
+ run: echo "TAG=$(date '+%Y%m%d').$GITHUB_RUN_ID" >> $GITHUB_ENV
+
+ - name: Setup Gradle
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
+
+ - name: Build Docker image
+ run: ./gradlew :smoke-tests:images:early-jdk8:dockerPush -PextraTag=${{ env.TAG }}
+
+ workflow-notification:
+ needs:
+ - publish
+ if: always()
+ uses: ./.github/workflows/reusable-workflow-notification.yml
+ with:
+ success: ${{ needs.publish.result == 'success' }}
diff --git a/.github/workflows/publish-smoke-test-fake-backend-images.yml b/.github/workflows/publish-smoke-test-fake-backend-images.yml
index 991986922670..ffd8a242ad8a 100644
--- a/.github/workflows/publish-smoke-test-fake-backend-images.yml
+++ b/.github/workflows/publish-smoke-test-fake-backend-images.yml
@@ -35,7 +35,7 @@ jobs:
run: echo "TAG=$(date '+%Y%m%d').$GITHUB_RUN_ID" >> $GITHUB_ENV
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
- name: Build Docker image
run: ./gradlew :smoke-tests:images:fake-backend:jib -Djib.httpTimeout=120000 -Djib.console=plain -PextraTag=${{ env.TAG }}
@@ -68,7 +68,7 @@ jobs:
run: echo "TAG=$(date '+%Y%m%d').$GITHUB_RUN_ID" >> $GITHUB_ENV
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
- name: Build Docker image
run: ./gradlew :smoke-tests:images:fake-backend:dockerPush -PextraTag=${{ env.TAG }}
diff --git a/.github/workflows/publish-smoke-test-servlet-images.yml b/.github/workflows/publish-smoke-test-servlet-images.yml
index e38a4574e151..98b12af63d50 100644
--- a/.github/workflows/publish-smoke-test-servlet-images.yml
+++ b/.github/workflows/publish-smoke-test-servlet-images.yml
@@ -54,20 +54,20 @@ jobs:
run: .github/scripts/gha-free-disk-space.sh
- name: Set up JDK for running Gradle
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
- name: Login to GitHub package registry
- uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
+ uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Gradle cache
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
with:
# only push cache for one matrix option per OS since github action cache space is limited
cache-read-only: ${{ matrix.smoke-test-suite != 'tomcat' }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e0b42505f189..e86cd2ebe4f0 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -80,13 +80,13 @@ jobs:
- name: Free disk space
run: .github/scripts/gha-free-disk-space.sh
- - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
- name: Build and publish artifacts
env:
@@ -114,7 +114,7 @@ jobs:
cp javaagent/build/spdx/*.spdx.json sboms
zip opentelemetry-java-instrumentation-SBOM.zip sboms/*
- - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
+ - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
name: Upload SBOMs
with:
name: opentelemetry-java-instrumentation-SBOM
diff --git a/.github/workflows/reusable-muzzle.yml b/.github/workflows/reusable-muzzle.yml
index 581ff55e004d..7ea42f3deaf2 100644
--- a/.github/workflows/reusable-muzzle.yml
+++ b/.github/workflows/reusable-muzzle.yml
@@ -28,13 +28,13 @@ jobs:
run: .github/scripts/gha-free-disk-space.sh
- name: Set up JDK for running Gradle
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
with:
cache-read-only: ${{ inputs.cache-read-only }}
diff --git a/.github/workflows/reusable-native-tests.yml b/.github/workflows/reusable-native-tests.yml
index e9e8e278e265..09ea5ce2312c 100644
--- a/.github/workflows/reusable-native-tests.yml
+++ b/.github/workflows/reusable-native-tests.yml
@@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- id: read-java
run: echo "version=$(cat .java-version)" >> "$GITHUB_OUTPUT"
- - uses: graalvm/setup-graalvm@2f25c0caae5b220866f732832d5e3e29ff493338 # v1.2.1.1
+ - uses: graalvm/setup-graalvm@22cc13fe88ef133134b3798e128fb208df55e1f5 # v1.2.3.1
with:
version: "latest"
java-version: "${{ steps.read-java.outputs.version }}"
diff --git a/.github/workflows/reusable-smoke-test-images.yml b/.github/workflows/reusable-smoke-test-images.yml
index db97848fd712..73eeb4aa53a1 100644
--- a/.github/workflows/reusable-smoke-test-images.yml
+++ b/.github/workflows/reusable-smoke-test-images.yml
@@ -44,14 +44,14 @@ jobs:
run: .github/scripts/gha-free-disk-space.sh
- name: Set up JDK for running Gradle
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
- name: Login to GitHub package registry
if: inputs.publish
- uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
+ uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
@@ -61,7 +61,7 @@ jobs:
run: echo "TAG=$(date '+%Y%m%d').$GITHUB_RUN_ID" >> $GITHUB_ENV
- name: Set up Gradle cache
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
with:
cache-read-only: ${{ inputs.cache-read-only }}
diff --git a/.github/workflows/reusable-test-indy.yml b/.github/workflows/reusable-test-indy.yml
index c1c529a37d2b..2b2727ba8ea1 100644
--- a/.github/workflows/reusable-test-indy.yml
+++ b/.github/workflows/reusable-test-indy.yml
@@ -19,7 +19,6 @@ permissions:
jobs:
test-indy:
name: testIndy${{ matrix.test-partition }}
- if: ${{ contains(github.event.pull_request.labels.*.name, 'test indy') }}
runs-on: ubuntu-latest
strategy:
matrix:
@@ -36,7 +35,7 @@ jobs:
run: .github/scripts/gha-free-disk-space.sh
- name: Set up JDK for running Gradle
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
@@ -47,7 +46,7 @@ jobs:
# vaadin 14 tests fail with node 18
- name: Set up Node
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
+ uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: 16
@@ -59,7 +58,7 @@ jobs:
key: ${{ runner.os }}-test-latest-cache-pnpm-modules
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
with:
cache-read-only: ${{ inputs.cache-read-only }}
# gradle enterprise is used for the build cache
diff --git a/.github/workflows/reusable-test-latest-deps.yml b/.github/workflows/reusable-test-latest-deps.yml
index 654b50c68979..15f59f58c94c 100644
--- a/.github/workflows/reusable-test-latest-deps.yml
+++ b/.github/workflows/reusable-test-latest-deps.yml
@@ -35,7 +35,7 @@ jobs:
run: .github/scripts/gha-free-disk-space.sh
- name: Set up JDK for running Gradle
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
+ uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
distribution: temurin
java-version-file: .java-version
@@ -55,7 +55,7 @@ jobs:
run: .github/scripts/deadlock-detector.sh
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
+ uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
with:
cache-read-only: ${{ inputs.cache-read-only }}
# gradle enterprise is used for the build cache
@@ -90,7 +90,7 @@ jobs:
- name: Upload deadlock detector artifacts if any
if: failure()
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
+ uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: deadlock-detector-test-latest-${{ matrix.test-java-version }}-${{ matrix.vm }}-${{ matrix.test-partition }}
path: /tmp/deadlock-detector-*
@@ -98,7 +98,7 @@ jobs:
- name: Upload jvm crash dump files if any
if: failure()
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
+ uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: javacore-test-latest-${{ matrix.test-java-version }}-${{ matrix.test-partition }}
path: |
diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml
index 0cea8cc256f5..9644ee8d786d 100644
--- a/.github/workflows/scorecard.yml
+++ b/.github/workflows/scorecard.yml
@@ -34,7 +34,7 @@ jobs:
persist-credentials: false
- name: "Run analysis"
- uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
+ uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
with:
results_file: results.sarif
results_format: sarif
@@ -56,7 +56,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
+ uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: SARIF file
path: results.sarif
@@ -64,6 +64,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@530d4feaa9c62aaab2d250371e2061eb7a172363 # v3.25.9
+ uses: github/codeql-action/upload-sarif@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0
with:
sarif_file: results.sarif
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 173e3067b91c..442a8540ecde 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,125 @@
## Unreleased
+## Version 1.33.5 (2024-07-25)
+
+### 📈 Enhancements
+
+- Backport: Update the OpenTelemetry SDK version to 1.40.0
+ ([#11879](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11879))
+
+## Version 2.6.0 (2024-07-17)
+
+The Spring Boot Starter (`opentelemetry-spring-boot-starter`) is now stable.
+
+### Migration notes
+
+- The `opentelemetry-spring-boot` and `opentelemetry-spring-boot-3` artifacts have been merged
+ into a single artifact named `opentelemetry-spring-boot-autoconfigure`
+ which supports both Spring Boot 2 and Spring Boot 3
+- Two experimental HTTP metrics have been renamed:
+ - `http.server.request.size` → `http.server.request.body.size`,
+ - `http.server.response.size` → `http.server.response.body.size`
+
+### 🌟 New javaagent instrumentation
+
+- Javalin
+ ([#11587](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11587))
+- ClickHouse
+ ([#11660](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11660))
+
+### 📈 Enhancements
+
+- Support HTTP client instrumentation configuration in Spring starter
+ ([#11620](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11620))
+- Influxdb client: don't fill `db.statement` for create/drop database and write operations
+ ([#11557](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11557))
+- Support `otel.instrumentation.common.default-enabled` in the Spring starter
+ ([#11746](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11746))
+- Support Jetty HTTP client 12
+ ([#11519](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11519))
+- Add Pulsar `messaging.producer.duration` metric
+ ([#11591](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11591))
+- Improve instrumentation suppression behavior
+ ([#11640](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11640))
+- Propagate OpenTelemetry context through custom AWS client context for Lambda direct calls
+ ([#11675](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11675))
+- Spring Native support for `@WithSpan`
+ ([#11757](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11757))
+- Support HTTP server instrumentation config properties in the Spring starter
+ ([#11667](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11667))
+
+### 🛠️ Bug fixes
+
+- Fix `http.server.active_requests` metric with async requests
+ ([#11638](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11638))
+
+## Version 1.33.4 (2024-06-19)
+
+### 📈 Enhancements
+
+- Backport: Undertow, run response customizer on all ServerConnection implementations
+ ([#11548](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11548))
+- Backport: Improve security manager support
+ ([#11606](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11606))
+- Backport: Update the OpenTelemetry SDK version to 1.39.0
+ ([#11603](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11603))
+
+### 🛠️ Bug fixes
+
+- Backport: Avoid NullPointerException when JMS destination is not available
+ ([#11577](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11577))
+- Backport: Fix Spring Kafka instrumentation closing the trace too early
+ ([#11592](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11592))
+- Backport: Fix gRPC instrumentation adding duplicates to metadata instead of overwriting
+ ([#11604](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11604))
+- Backport: Fix request header capture corrupting tomcat request
+ ([#11607](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11607))
+
+## Version 2.5.0 (2024-06-17)
+
+### 📈 Enhancements
+
+- Add support for Informix connection string parsing in JDBC instrumentation
+ ([#11542](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11542))
+- Generate an SBOM for the javaagent artifact
+ ([#11075](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11075))
+- Extract sql operation even when the sanitizer is disabled
+ ([#11472](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11472))
+- Improve security manager support
+ ([#11466](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11466))
+- Generate Log4j2Plugin.dat for OpenTelemetryAppender
+ ([#11503](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11503))
+- Stop kotlin coroutine dispatcher from propagating context
+ ([#11500](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11500))
+- Handle Vert.x sub routes
+ ([#11535](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11535))
+- Undertow: run response customizer on all ServerConnection implementations
+ ([#11539](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11539))
+- Allow configuring MDC key names for trace_id, span_id, trace_flags
+ ([#11329](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11329))
+- Apply async end strategy to all kotlin coroutine flows
+ ([#11583](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11583))
+
+### 🛠️ Bug fixes
+
+- Fix container.id issue in some crio scenarios
+ ([#11382](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11382))
+- Fix Finagle http client context propagation
+ ([#11400](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11400))
+- Fix sporadically failing finagle test
+ ([#11441](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11441))
+- Fix request header capture corrupting tomcat request
+ ([#11469](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11469))
+- Fix Ktor server instrumentation when Ktor client library is not present
+ ([#11454](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11454))
+- Fix gRPC instrumentation adding duplicates to metadata instead of overwriting
+ ([#11308](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11308))
+- Avoid NullPointerException when JMS destination is not available
+ ([#11570](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11570))
+- Fix Spring Kafka instrumentation closing the trace too early
+ ([#11471](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/11471))
+
## Version 1.33.3 (2024-05-21)
### 📈 Enhancements
diff --git a/README.md b/README.md
index 9de93acfe745..3abe2c6d7aab 100644
--- a/README.md
+++ b/README.md
@@ -81,7 +81,7 @@ configured to send data to
at `http://localhost:4317`.
Configuration parameters are passed as Java system properties (`-D` flags) or
-as environment variables. See [the configuration documentation][config]
+as environment variables. See [the configuration documentation][config-agent]
for the full list of configuration items. For example:
```
@@ -93,11 +93,14 @@ java -javaagent:path/to/opentelemetry-javaagent.jar \
## Configuring the Agent
-The agent is [highly configurable][config]! Many aspects of the agent's behavior can be
+The agent is highly configurable! Many aspects of the agent's behavior can be
configured for your needs, such as exporter choice, exporter config (like where
data is sent), trace context propagation headers, and much more.
-[Click here to see the detailed list of configuration environment variables and system properties][config].
+For a detailed list of agent configuration options, see the [agent configuration docs][config-agent].
+
+For a detailed list of additional SDK configuration environment variables and system properties,
+see the [SDK configuration docs][config-sdk].
*Note: Config parameter names are very likely to change over time, so please check
back here when trying out a new version!
@@ -151,6 +154,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md).
Triagers ([@open-telemetry/java-instrumentation-triagers](https://github.com/orgs/open-telemetry/teams/java-instrumentation-triagers)):
+- [Jay DeLuca](https://github.com/jaydeluca)
- [Jonas Kunz](https://github.com/JonasKunz), Elastic
- [Steve Rao](https://github.com/steverao), Alibaba
- [Sylvain Juge](https://github.com/SylvainJuge), Elastic
@@ -175,7 +179,7 @@ Emeritus maintainers:
- [Tyler Benson](https://github.com/tylerbenson)
Learn more about roles in
-the [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md).
+the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md).
Thanks to all the people who already contributed!
@@ -183,7 +187,9 @@ Thanks to all the people who already contributed!
-[config]: https://opentelemetry.io/docs/instrumentation/java/automatic/agent-config/
+[config-agent]: https://opentelemetry.io/docs/zero-code/java/agent/configuration/
+
+[config-sdk]: https://opentelemetry.io/docs/languages/java/configuration/
[manual]: https://opentelemetry.io/docs/instrumentation/java/manual/
diff --git a/benchmark-overhead-jmh/build.gradle.kts b/benchmark-overhead-jmh/build.gradle.kts
index 6ea672d76543..6e713e3db381 100644
--- a/benchmark-overhead-jmh/build.gradle.kts
+++ b/benchmark-overhead-jmh/build.gradle.kts
@@ -8,7 +8,7 @@ plugins {
}
dependencies {
- jmhImplementation("org.springframework.boot:spring-boot-starter-web:3.3.0")
+ jmhImplementation("org.springframework.boot:spring-boot-starter-web:3.3.2")
}
tasks {
diff --git a/benchmark-overhead/Dockerfile-petclinic-base b/benchmark-overhead/Dockerfile-petclinic-base
index 8b5820293e5a..154833d54187 100644
--- a/benchmark-overhead/Dockerfile-petclinic-base
+++ b/benchmark-overhead/Dockerfile-petclinic-base
@@ -13,7 +13,7 @@ RUN git checkout 8aa4d49
RUN ./mvnw package -Dmaven.test.skip=true
RUN cp target/spring-petclinic-rest*.jar /app/spring-petclinic-rest.jar
-FROM bellsoft/liberica-openjdk-alpine:21.0.3
+FROM bellsoft/liberica-openjdk-alpine:21.0.4
COPY --from=app-build /app/spring-petclinic-rest.jar /app/spring-petclinic-rest.jar
WORKDIR /app
EXPOSE 9966
diff --git a/benchmark-overhead/build.gradle.kts b/benchmark-overhead/build.gradle.kts
index 0a455d979963..9793e9c5cbf8 100644
--- a/benchmark-overhead/build.gradle.kts
+++ b/benchmark-overhead/build.gradle.kts
@@ -16,16 +16,16 @@ repositories {
}
dependencies {
- implementation(enforcedPlatform("org.junit:junit-bom:5.10.2"))
+ implementation(enforcedPlatform("org.junit:junit-bom:5.10.3"))
- testImplementation("org.testcontainers:testcontainers:1.19.8")
- testImplementation("org.testcontainers:postgresql:1.19.8")
+ testImplementation("org.testcontainers:testcontainers:1.20.1")
+ testImplementation("org.testcontainers:postgresql:1.20.1")
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testImplementation("com.squareup.okhttp3:okhttp:4.12.0")
testImplementation("org.jooq:joox:2.0.1")
testImplementation("com.jayway.jsonpath:json-path:2.9.0")
- testImplementation("org.slf4j:slf4j-simple:2.0.13")
+ testImplementation("org.slf4j:slf4j-simple:2.0.16")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
}
diff --git a/benchmark-overhead/gradle/wrapper/gradle-wrapper.jar b/benchmark-overhead/gradle/wrapper/gradle-wrapper.jar
index e6441136f3d4..2c3521197d7c 100644
Binary files a/benchmark-overhead/gradle/wrapper/gradle-wrapper.jar and b/benchmark-overhead/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/benchmark-overhead/gradle/wrapper/gradle-wrapper.properties b/benchmark-overhead/gradle/wrapper/gradle-wrapper.properties
index 8a1f6b97f473..68e8816d71c9 100644
--- a/benchmark-overhead/gradle/wrapper/gradle-wrapper.properties
+++ b/benchmark-overhead/gradle/wrapper/gradle-wrapper.properties
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionSha256Sum=a4b4158601f8636cdeeab09bd76afb640030bb5b144aafe261a5e8af027dc612
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
+distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/benchmark-overhead/gradlew b/benchmark-overhead/gradlew
index b740cf13397a..f5feea6d6b11 100755
--- a/benchmark-overhead/gradlew
+++ b/benchmark-overhead/gradlew
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# SPDX-License-Identifier: Apache-2.0
+#
##############################################################################
#
@@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
-APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
+' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
diff --git a/benchmark-overhead/gradlew.bat b/benchmark-overhead/gradlew.bat
index 25da30dbdeee..9d21a21834d5 100644
--- a/benchmark-overhead/gradlew.bat
+++ b/benchmark-overhead/gradlew.bat
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
diff --git a/benchmark-overhead/src/test/java/io/opentelemetry/OverheadTests.java b/benchmark-overhead/src/test/java/io/opentelemetry/OverheadTests.java
index b69a6d708294..86756a230f39 100644
--- a/benchmark-overhead/src/test/java/io/opentelemetry/OverheadTests.java
+++ b/benchmark-overhead/src/test/java/io/opentelemetry/OverheadTests.java
@@ -110,7 +110,7 @@ void runAppOnce(TestConfig config, Agent agent) throws Exception {
}
private void startRecording(Agent agent, GenericContainer> petclinic) throws Exception {
- Path outFile = namingConventions.container.jfrFile(agent);
+ String outFile = namingConventions.container.jfrFile(agent);
String[] command = {
"jcmd",
"1",
@@ -123,16 +123,27 @@ private void startRecording(Agent agent, GenericContainer> petclinic) throws E
petclinic.execInContainer(command);
}
- private void doWarmupPhase(TestConfig testConfig, GenericContainer> petclinic) throws IOException, InterruptedException {
- System.out.println("Performing startup warming phase for " + testConfig.getWarmupSeconds() + " seconds...");
+ private void doWarmupPhase(TestConfig testConfig, GenericContainer> petclinic)
+ throws IOException, InterruptedException {
+ System.out.println(
+ "Performing startup warming phase for " + testConfig.getWarmupSeconds() + " seconds...");
// excluding the JFR recording from the warmup causes strange inconsistencies in the results
System.out.println("Starting disposable JFR warmup recording...");
- String[] startCommand = {"jcmd", "1", "JFR.start", "settings=/app/overhead.jfc", "dumponexit=true", "name=warmup", "filename=warmup.jfr"};
+ String[] startCommand = {
+ "jcmd",
+ "1",
+ "JFR.start",
+ "settings=/app/overhead.jfc",
+ "dumponexit=true",
+ "name=warmup",
+ "filename=warmup.jfr"
+ };
petclinic.execInContainer(startCommand);
- long deadline = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(testConfig.getWarmupSeconds());
- while(System.currentTimeMillis() < deadline) {
+ long deadline =
+ System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(testConfig.getWarmupSeconds());
+ while (System.currentTimeMillis() < deadline) {
GenericContainer> k6 =
new GenericContainer<>(DockerImageName.parse("loadimpact/k6"))
.withNetwork(NETWORK)
@@ -151,7 +162,7 @@ private void doWarmupPhase(TestConfig testConfig, GenericContainer> petclinic)
private void writeStartupTimeFile(Agent agent, long start) throws IOException {
long delta = System.currentTimeMillis() - start;
- Path startupPath = namingConventions.local.startupDurationFile(agent);
+ Path startupPath = Path.of(namingConventions.local.startupDurationFile(agent));
Files.writeString(startupPath, String.valueOf(delta));
}
}
diff --git a/benchmark-overhead/src/test/java/io/opentelemetry/containers/K6Container.java b/benchmark-overhead/src/test/java/io/opentelemetry/containers/K6Container.java
index ff022970dbb3..7f6994d1a5d7 100644
--- a/benchmark-overhead/src/test/java/io/opentelemetry/containers/K6Container.java
+++ b/benchmark-overhead/src/test/java/io/opentelemetry/containers/K6Container.java
@@ -8,7 +8,6 @@
import io.opentelemetry.agents.Agent;
import io.opentelemetry.config.TestConfig;
import io.opentelemetry.util.NamingConventions;
-import java.nio.file.Path;
import java.time.Duration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,7 +34,7 @@ public K6Container(
}
public GenericContainer> build() {
- Path k6OutputFile = namingConventions.container.k6Results(agent);
+ String k6OutputFile = namingConventions.container.k6Results(agent);
return new GenericContainer<>(DockerImageName.parse("loadimpact/k6"))
.withNetwork(network)
.withNetworkAliases("k6")
@@ -52,7 +51,7 @@ public GenericContainer> build() {
"--rps",
String.valueOf(config.getMaxRequestRate()),
"--summary-export",
- k6OutputFile.toString(),
+ k6OutputFile,
"/app/basic.js")
.withStartupCheckStrategy(
new OneShotStartupCheckStrategy().withTimeout(Duration.ofMinutes(15)));
diff --git a/benchmark-overhead/src/test/java/io/opentelemetry/results/ResultsCollector.java b/benchmark-overhead/src/test/java/io/opentelemetry/results/ResultsCollector.java
index c2012cdf41b9..d7b47bb7fbc9 100644
--- a/benchmark-overhead/src/test/java/io/opentelemetry/results/ResultsCollector.java
+++ b/benchmark-overhead/src/test/java/io/opentelemetry/results/ResultsCollector.java
@@ -54,14 +54,14 @@ private AppPerfResults readAgentResults(Agent agent, TestConfig config) {
private AppPerfResults.Builder addStartupTime(AppPerfResults.Builder builder, Agent agent)
throws IOException {
- Path file = namingConvention.startupDurationFile(agent);
+ Path file = Path.of(namingConvention.startupDurationFile(agent));
long startupDuration = Long.parseLong(new String(Files.readAllBytes(file)).trim());
return builder.startupDurationMs(startupDuration);
}
private AppPerfResults.Builder addK6Results(AppPerfResults.Builder builder, Agent agent)
throws IOException {
- Path k6File = namingConvention.k6Results(agent);
+ Path k6File = Path.of(namingConvention.k6Results(agent));
String json = new String(Files.readAllBytes(k6File));
double iterationAvg = read(json, "$.metrics.iteration_duration.avg");
double iterationP95 = read(json, "$.metrics.iteration_duration['p(95)']");
@@ -82,7 +82,7 @@ private static double read(String json, String jsonPath) {
private AppPerfResults.Builder addJfrResults(AppPerfResults.Builder builder, Agent agent)
throws IOException {
- Path jfrFile = namingConvention.jfrFile(agent);
+ Path jfrFile = Path.of(namingConvention.jfrFile(agent));
return builder
.totalGCTime(readTotalGCTime(jfrFile))
.totalAllocated(readTotalAllocated(jfrFile))
diff --git a/benchmark-overhead/src/test/java/io/opentelemetry/util/ContainerNamingConvention.java b/benchmark-overhead/src/test/java/io/opentelemetry/util/ContainerNamingConvention.java
new file mode 100644
index 000000000000..8866ea28e92c
--- /dev/null
+++ b/benchmark-overhead/src/test/java/io/opentelemetry/util/ContainerNamingConvention.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package io.opentelemetry.util;
+
+import io.opentelemetry.agents.Agent;
+
+public class ContainerNamingConvention implements NamingConvention {
+ private final String dir;
+
+ public ContainerNamingConvention(String dir) {
+ this.dir = dir;
+ }
+
+ public String k6Results(Agent agent) {
+
+ return String.join("/", dir, "k6_out_" + agent.getName() + ".json");
+ }
+
+ public String jfrFile(Agent agent) {
+ return String.join("/", dir, "petclinic-" + agent.getName() + ".jfr");
+ }
+
+ public String startupDurationFile(Agent agent) {
+ return String.join("/", dir, "startup-time-" + agent.getName() + ".txt");
+ }
+
+ public String root() {
+ return dir;
+ }
+}
diff --git a/benchmark-overhead/src/test/java/io/opentelemetry/util/LocalNamingConvention.java b/benchmark-overhead/src/test/java/io/opentelemetry/util/LocalNamingConvention.java
new file mode 100644
index 000000000000..4c4305e849a3
--- /dev/null
+++ b/benchmark-overhead/src/test/java/io/opentelemetry/util/LocalNamingConvention.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package io.opentelemetry.util;
+
+import io.opentelemetry.agents.Agent;
+import java.nio.file.Paths;
+
+public class LocalNamingConvention implements NamingConvention {
+ private final String dir;
+
+ public LocalNamingConvention(String dir) {
+ this.dir = dir;
+ }
+
+ public String k6Results(Agent agent) {
+ return Paths.get(dir, "k6_out_" + agent.getName() + ".json").toString();
+ }
+
+ public String jfrFile(Agent agent) {
+ return Paths.get(dir, "petclinic-" + agent.getName() + ".jfr").toString();
+ }
+
+ public String startupDurationFile(Agent agent) {
+ return Paths.get(dir, "startup-time-" + agent.getName() + ".txt").toString();
+ }
+
+ public String root() {
+ return dir;
+ }
+}
diff --git a/benchmark-overhead/src/test/java/io/opentelemetry/util/NamingConvention.java b/benchmark-overhead/src/test/java/io/opentelemetry/util/NamingConvention.java
index 96a45eceeef3..afbdd653e9a5 100644
--- a/benchmark-overhead/src/test/java/io/opentelemetry/util/NamingConvention.java
+++ b/benchmark-overhead/src/test/java/io/opentelemetry/util/NamingConvention.java
@@ -6,51 +6,34 @@
package io.opentelemetry.util;
import io.opentelemetry.agents.Agent;
-import java.nio.file.Path;
-import java.nio.file.Paths;
/**
* This utility class provides the standard file naming conventions, primarily for files that are
* shared between containers and the test runner. It consolidates the naming logic into one place to
* ensure consistency, reduce duplication, and decrease errors.
*/
-public class NamingConvention {
-
- private final String dir;
-
- public NamingConvention(String dir) {
- this.dir = dir;
- }
-
+public interface NamingConvention {
/**
- * Returns a path to the location of the k6 results json file.
+ * Returns a path string to the location of the k6 results json file.
*
* @param agent The agent to get results file path for
*/
- public Path k6Results(Agent agent) {
- return Paths.get(dir, "k6_out_" + agent.getName() + ".json");
- }
+ String k6Results(Agent agent);
/**
- * Returns a path to the location of the jfr output file for a given agent run.
+ * Returns a path string to the location of the jfr output file for a given agent run.
*
* @param agent The agent to get the jfr file path for.
*/
- public Path jfrFile(Agent agent) {
- return Paths.get(dir, "petclinic-" + agent.getName() + ".jfr");
- }
+ String jfrFile(Agent agent);
/**
- * Returns the path to the file that contains the startup duration for a given agent run.
+ * Returns the path string to the file that contains the startup duration for a given agent run.
*
* @param agent The agent to get the startup duration for.
*/
- public Path startupDurationFile(Agent agent) {
- return Paths.get(dir, "startup-time-" + agent.getName() + ".txt");
- }
+ String startupDurationFile(Agent agent);
/** Returns the root path that this naming convention was configured with. */
- public String root() {
- return dir;
- }
+ String root();
}
diff --git a/benchmark-overhead/src/test/java/io/opentelemetry/util/NamingConventions.java b/benchmark-overhead/src/test/java/io/opentelemetry/util/NamingConventions.java
index 6caf28dfef31..4aeca8f7a92e 100644
--- a/benchmark-overhead/src/test/java/io/opentelemetry/util/NamingConventions.java
+++ b/benchmark-overhead/src/test/java/io/opentelemetry/util/NamingConventions.java
@@ -5,18 +5,22 @@
package io.opentelemetry.util;
-/** An container to hold both the local and container naming conventions. */
+/** A container to hold both the local and container naming conventions. */
public class NamingConventions {
- public final NamingConvention container = new NamingConvention("/results");
- public final NamingConvention local = new NamingConvention(".");
+ public final NamingConvention container = new ContainerNamingConvention("/results");
+ public final NamingConvention local = new LocalNamingConvention(".");
- /** @return Root path for the local naming convention (where results are output) */
+ /**
+ * @return Root path for the local naming convention (where results are output)
+ */
public String localResults() {
return local.root();
}
- /** @return Root path for the container naming convention (where results are output) */
+ /**
+ * @return Root path for the container naming convention (where results are output)
+ */
public String containerResults() {
return container.root();
}
diff --git a/benchmark-overhead/src/test/resources/collector.yaml b/benchmark-overhead/src/test/resources/collector.yaml
index 8111a2406edd..99e635ec335c 100644
--- a/benchmark-overhead/src/test/resources/collector.yaml
+++ b/benchmark-overhead/src/test/resources/collector.yaml
@@ -1,10 +1,14 @@
extensions:
health_check:
+ endpoint: 0.0.0.0:13133
receivers:
otlp:
protocols:
grpc:
+ endpoint: 0.0.0.0:4317
+ http:
+ endpoint: 0.0.0.0:4318
processors:
batch:
diff --git a/build.gradle.kts b/build.gradle.kts
index 202f1cb2d8ad..36f6b373affd 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -5,6 +5,15 @@ plugins {
id("io.github.gradle-nexus.publish-plugin")
id("otel.spotless-conventions")
+ /* workaround for
+ What went wrong:
+ Could not determine the dependencies of task ':smoke-tests-otel-starter:spring-boot-3.2:bootJar'.
+ > Could not create task ':smoke-tests-otel-starter:spring-boot-3.2:collectReachabilityMetadata'.
+ > Cannot set the value of task ':smoke-tests-otel-starter:spring-boot-3.2:collectReachabilityMetadata' property 'metadataService' of type org.graalvm.buildtools.gradle.internal.GraalVMReachabilityMetadataService using a provider of type org.graalvm.buildtools.gradle.internal.GraalVMReachabilityMetadataService.
+
+ See https://github.com/gradle/gradle/issues/17559#issuecomment-1327991512
+ */
+ id("org.graalvm.buildtools.native") apply false
}
apply(from = "version.gradle.kts")
@@ -40,56 +49,56 @@ if (project.findProperty("skipTests") as String? == "true") {
}
}
-tasks {
- val listTestsInPartition by registering {
- group = "Help"
- description = "List test tasks in given partition"
-
- // total of 4 partitions (see modulo 4 below)
- var testPartition = (project.findProperty("testPartition") as String?)?.toInt()
- if (testPartition == null) {
- throw GradleException("Test partition must be specified")
- } else if (testPartition < 0 || testPartition >= 4) {
- throw GradleException("Invalid test partition")
- }
+if (gradle.startParameter.taskNames.any { it.equals("listTestsInPartition") }) {
+ tasks {
+ val listTestsInPartition by registering {
+ group = "Help"
+ description = "List test tasks in given partition"
- val partitionTasks = ArrayList()
- var testPartitionCounter = 0
- subprojects {
- // relying on predictable ordering of subprojects
- // (see https://docs.gradle.org/current/dsl/org.gradle.api.Project.html#N14CB4)
- // since we are splitting these tasks across different github action jobs
- val enabled = testPartitionCounter++ % 4 == testPartition
- if (enabled) {
- tasks.withType().configureEach {
- partitionTasks.add(this)
+ // total of 4 partitions (see modulo 4 below)
+ var testPartition = (project.findProperty("testPartition") as String?)?.toInt()
+ if (testPartition == null) {
+ throw GradleException("Test partition must be specified")
+ } else if (testPartition < 0 || testPartition >= 4) {
+ throw GradleException("Invalid test partition")
+ }
+
+ val partitionTasks = ArrayList()
+ var testPartitionCounter = 0
+ subprojects {
+ // relying on predictable ordering of subprojects
+ // (see https://docs.gradle.org/current/dsl/org.gradle.api.Project.html#N14CB4)
+ // since we are splitting these tasks across different github action jobs
+ val enabled = testPartitionCounter++ % 4 == testPartition
+ if (enabled) {
+ tasks.withType().configureEach {
+ partitionTasks.add(this)
+ }
}
}
- }
- doLast {
- File("test-tasks.txt").printWriter().use { writer ->
- partitionTasks.forEach { task ->
- var taskPath = task.project.path + ":" + task.name
- // smoke tests are run separately
- // :instrumentation:test runs all instrumentation tests
- if (taskPath != ":smoke-tests:test" && taskPath != ":instrumentation:test") {
- writer.println(taskPath)
+ doLast {
+ File("test-tasks.txt").printWriter().use { writer ->
+ partitionTasks.forEach { task ->
+ var taskPath = task.project.path + ":" + task.name
+ // smoke tests are run separately
+ // :instrumentation:test runs all instrumentation tests
+ if (taskPath != ":smoke-tests:test" && taskPath != ":instrumentation:test") {
+ writer.println(taskPath)
+ }
}
}
}
- }
- // disable all tasks to stop build
- subprojects {
- tasks.configureEach {
- enabled = false
+ // disable all tasks to stop build
+ subprojects {
+ tasks.configureEach {
+ enabled = false
+ }
}
}
}
-}
-if (gradle.startParameter.taskNames.any { it.equals("listTestsInPartition") }) {
// disable all tasks to stop build
project.tasks.configureEach {
if (this.name != "listTestsInPartition") {
diff --git a/conventions/build.gradle.kts b/conventions/build.gradle.kts
index dd227da8baa7..1454ffa411b8 100644
--- a/conventions/build.gradle.kts
+++ b/conventions/build.gradle.kts
@@ -57,22 +57,22 @@ dependencies {
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0")
implementation("com.google.guava:guava:33.2.1-jre")
implementation("gradle.plugin.com.google.protobuf:protobuf-gradle-plugin:0.8.18")
- implementation("com.github.johnrengelman:shadow:8.1.1")
+ implementation("com.gradleup.shadow:shadow-gradle-plugin:8.3.0")
implementation("org.apache.httpcomponents:httpclient:4.5.14")
- implementation("com.gradle.develocity:com.gradle.develocity.gradle.plugin:3.17.5")
- implementation("org.owasp:dependency-check-gradle:9.2.0")
+ implementation("com.gradle.develocity:com.gradle.develocity.gradle.plugin:3.17.6")
+ implementation("org.owasp:dependency-check-gradle:10.0.3")
implementation("ru.vyarus:gradle-animalsniffer-plugin:1.7.1")
implementation("org.spdx:spdx-gradle-plugin:0.8.0")
// When updating, also update dependencyManagement/build.gradle.kts
- implementation("net.bytebuddy:byte-buddy-gradle-plugin:1.14.17")
+ implementation("net.bytebuddy:byte-buddy-gradle-plugin:1.14.18")
implementation("gradle.plugin.io.morethan.jmhreport:gradle-jmh-report:0.9.6")
implementation("me.champeau.jmh:jmh-gradle-plugin:0.7.2")
- implementation("net.ltgt.gradle:gradle-errorprone-plugin:4.0.0")
+ implementation("net.ltgt.gradle:gradle-errorprone-plugin:4.0.1")
implementation("net.ltgt.gradle:gradle-nullaway-plugin:2.0.0")
implementation("me.champeau.gradle:japicmp-gradle-plugin:0.4.3")
- testImplementation(enforcedPlatform("org.junit:junit-bom:5.10.2"))
+ testImplementation(enforcedPlatform("org.junit:junit-bom:5.10.3"))
testImplementation("org.junit.jupiter:junit-jupiter-api")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
- testImplementation("org.assertj:assertj-core:3.26.0")
+ testImplementation("org.assertj:assertj-core:3.26.3")
}
diff --git a/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-shadowing.gradle.kts b/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-shadowing.gradle.kts
index cf37eadaf5de..7b4e59d77d1d 100644
--- a/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-shadowing.gradle.kts
+++ b/conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-shadowing.gradle.kts
@@ -1,7 +1,7 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
- id("com.github.johnrengelman.shadow")
+ id("com.gradleup.shadow")
}
// NOTE: any modifications below should also be made in
diff --git a/conventions/src/main/kotlin/otel.java-conventions.gradle.kts b/conventions/src/main/kotlin/otel.java-conventions.gradle.kts
index 94b35baa54dc..c3b9ea86c8ff 100644
--- a/conventions/src/main/kotlin/otel.java-conventions.gradle.kts
+++ b/conventions/src/main/kotlin/otel.java-conventions.gradle.kts
@@ -143,7 +143,7 @@ abstract class NettyAlignmentRule : ComponentMetadataRule {
with(ctx.details) {
if (id.group == "io.netty" && id.name != "netty") {
if (id.version.startsWith("4.1.")) {
- belongsTo("io.netty:netty-bom:4.1.111.Final", false)
+ belongsTo("io.netty:netty-bom:4.1.112.Final", false)
} else if (id.version.startsWith("4.0.")) {
belongsTo("io.netty:netty-bom:4.0.56.Final", false)
}
@@ -160,8 +160,8 @@ dependencies {
compileOnly("com.google.code.findbugs:jsr305")
compileOnly("com.google.errorprone:error_prone_annotations")
- codenarc("org.codenarc:CodeNarc:3.4.0")
- codenarc(platform("org.codehaus.groovy:groovy-bom:3.0.21"))
+ codenarc("org.codenarc:CodeNarc:3.5.0")
+ codenarc(platform("org.codehaus.groovy:groovy-bom:3.0.22"))
modules {
// checkstyle uses the very old google-collections which causes Java 9 module conflict with
@@ -294,8 +294,12 @@ tasks {
withType().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
- dirMode = Integer.parseInt("0755", 8)
- fileMode = Integer.parseInt("0644", 8)
+ dirPermissions {
+ unix("755")
+ }
+ filePermissions {
+ unix("644")
+ }
}
// Convenient when updating errorprone
@@ -356,8 +360,10 @@ tasks.withType().configureEach {
val trustStore = project(":testing-common").file("src/misc/testing-keystore.p12")
// Work around payara not working when this is set for some reason.
- // Don't set for camel as we have tests that interact with AWS and need normal trustStore
- if (project.name != "jaxrs-2.0-payara-testing" && project.description != "camel-2-20") {
+ // Don't set for:
+ // - camel as we have tests that interact with AWS and need normal trustStore
+ // - vaadin as tests need to be able to download nodejs when not cached in ~/.vaadin/
+ if (project.name != "jaxrs-2.0-payara-testing" && !project.path.contains("vaadin") && project.description != "camel-2-20") {
jvmArgumentProviders.add(KeystoreArgumentsProvider(trustStore))
}
diff --git a/custom-checks/src/main/java/io/opentelemetry/javaagent/customchecks/OtelCanIgnoreReturnValueSuggester.java b/custom-checks/src/main/java/io/opentelemetry/javaagent/customchecks/OtelCanIgnoreReturnValueSuggester.java
index 559c6200bc19..55e1d0bfcee0 100644
--- a/custom-checks/src/main/java/io/opentelemetry/javaagent/customchecks/OtelCanIgnoreReturnValueSuggester.java
+++ b/custom-checks/src/main/java/io/opentelemetry/javaagent/customchecks/OtelCanIgnoreReturnValueSuggester.java
@@ -15,10 +15,10 @@
import com.google.errorprone.bugpatterns.checkreturnvalue.CanIgnoreReturnValueSuggester;
import com.google.errorprone.bugpatterns.checkreturnvalue.CanIgnoreReturnValueSuggesterFactory;
import com.google.errorprone.matchers.Description;
-import com.google.inject.Inject;
import com.sun.source.tree.ClassTree;
import com.sun.source.tree.MethodTree;
import com.sun.source.util.TreePath;
+import javax.inject.Inject;
@AutoService(BugChecker.class)
@BugPattern(
diff --git a/custom-checks/src/main/java/io/opentelemetry/javaagent/customchecks/OtelInternalJavadoc.java b/custom-checks/src/main/java/io/opentelemetry/javaagent/customchecks/OtelInternalJavadoc.java
index 950632166bd3..3d6693a9574e 100644
--- a/custom-checks/src/main/java/io/opentelemetry/javaagent/customchecks/OtelInternalJavadoc.java
+++ b/custom-checks/src/main/java/io/opentelemetry/javaagent/customchecks/OtelInternalJavadoc.java
@@ -42,7 +42,7 @@ public class OtelInternalJavadoc extends BugChecker implements BugChecker.ClassT
@Override
public Description matchClass(ClassTree tree, VisitorState state) {
- if (!isPublic(tree) || !isInternal(state)) {
+ if (!isPublic(tree) || !isInternal(state) || tree.getSimpleName().toString().endsWith("Test")) {
return Description.NO_MATCH;
}
String javadoc = getJavadoc(state);
diff --git a/dependencyManagement/build.gradle.kts b/dependencyManagement/build.gradle.kts
index 594a154460a3..a607a6b60c5a 100644
--- a/dependencyManagement/build.gradle.kts
+++ b/dependencyManagement/build.gradle.kts
@@ -8,12 +8,12 @@ val dependencyVersions = hashMapOf()
rootProject.extra["versions"] = dependencyVersions
// this line is managed by .github/scripts/update-sdk-version.sh
-val otelSdkVersion = "1.39.0"
-val otelContribVersion = "1.36.0-alpha"
+val otelSdkVersion = "1.40.0"
+val otelContribVersion = "1.37.0-alpha"
val otelSdkAlphaVersion = otelSdkVersion.replaceFirst("(-SNAPSHOT)?$".toRegex(), "-alpha$1")
// Need both BOM and groovy jars
-val groovyVersion = "4.0.21"
+val groovyVersion = "4.0.22"
// We don't force libraries we instrument to new versions since we compile and test against specific
// old baseline versions but we do try to force those libraries' transitive dependencies to new
@@ -27,25 +27,25 @@ val groovyVersion = "4.0.21"
// configurations.testRuntimeClasspath.resolutionStrategy.force "com.google.guava:guava:19.0"
val DEPENDENCY_BOMS = listOf(
- "com.fasterxml.jackson:jackson-bom:2.17.1",
+ "com.fasterxml.jackson:jackson-bom:2.17.2",
"com.squareup.okio:okio-bom:3.9.0", // see https://github.com/open-telemetry/opentelemetry-java/issues/5637
"com.google.guava:guava-bom:33.2.1-jre",
"org.apache.groovy:groovy-bom:${groovyVersion}",
"io.opentelemetry:opentelemetry-bom:${otelSdkVersion}",
"io.opentelemetry:opentelemetry-bom-alpha:${otelSdkAlphaVersion}",
- "org.junit:junit-bom:5.10.2",
- "org.testcontainers:testcontainers-bom:1.19.8",
+ "org.junit:junit-bom:5.10.3",
+ "org.testcontainers:testcontainers-bom:1.20.1",
"org.spockframework:spock-bom:2.4-M4-groovy-4.0"
)
val autoServiceVersion = "1.1.1"
val autoValueVersion = "1.11.0"
-val errorProneVersion = "2.28.0"
-val byteBuddyVersion = "1.14.17"
+val errorProneVersion = "2.30.0"
+val byteBuddyVersion = "1.14.18"
val asmVersion = "9.7"
val jmhVersion = "1.37"
val mockitoVersion = "4.11.0"
-val slf4jVersion = "2.0.13"
+val slf4jVersion = "2.0.16"
val semConvVersion = "1.25.0-alpha"
val CORE_DEPENDENCIES = listOf(
@@ -87,30 +87,31 @@ val DEPENDENCIES = listOf(
"com.github.stefanbirkner:system-lambda:1.2.1",
"com.github.stefanbirkner:system-rules:1.19.0",
"uk.org.webcompere:system-stubs-jupiter:2.0.3",
- "com.uber.nullaway:nullaway:0.11.0",
+ "com.uber.nullaway:nullaway:0.11.1",
"commons-beanutils:commons-beanutils:1.9.4",
"commons-cli:commons-cli:1.8.0",
- "commons-codec:commons-codec:1.17.0",
+ "commons-codec:commons-codec:1.17.1",
"commons-collections:commons-collections:3.2.2",
"commons-digester:commons-digester:2.1",
"commons-fileupload:commons-fileupload:1.5",
"commons-io:commons-io:2.16.1",
"commons-lang:commons-lang:2.6",
- "commons-logging:commons-logging:1.3.2",
+ "commons-logging:commons-logging:1.3.3",
"commons-validator:commons-validator:1.9.0",
"io.netty:netty:3.10.6.Final",
"io.opentelemetry.contrib:opentelemetry-aws-resources:${otelContribVersion}",
"io.opentelemetry.contrib:opentelemetry-aws-xray-propagator:${otelContribVersion}",
"io.opentelemetry.contrib:opentelemetry-gcp-resources:${otelContribVersion}",
- "io.opentelemetry.proto:opentelemetry-proto:1.3.1-alpha",
+ "io.opentelemetry.contrib:opentelemetry-baggage-processor:${otelContribVersion}",
+ "io.opentelemetry.proto:opentelemetry-proto:1.3.2-alpha",
"io.opentelemetry:opentelemetry-extension-annotations:1.18.0", // deprecated, no longer part of bom
- "org.assertj:assertj-core:3.26.0",
- "org.awaitility:awaitility:4.2.1",
+ "org.assertj:assertj-core:3.26.3",
+ "org.awaitility:awaitility:4.2.2",
"com.google.code.findbugs:annotations:3.0.1u2",
"com.google.code.findbugs:jsr305:3.0.2",
"org.apache.groovy:groovy:${groovyVersion}",
"org.apache.groovy:groovy-json:${groovyVersion}",
- "org.codehaus.mojo:animal-sniffer-annotations:1.23",
+ "org.codehaus.mojo:animal-sniffer-annotations:1.24",
"org.junit-pioneer:junit-pioneer:1.9.1",
"org.objenesis:objenesis:3.4",
"javax.validation:validation-api:2.0.1.Final",
diff --git a/docs/agent-features.md b/docs/agent-features.md
index 92b494aa6006..9548c58d8047 100644
--- a/docs/agent-features.md
+++ b/docs/agent-features.md
@@ -4,9 +4,8 @@ This lists out some of the features specific to java agents that OpenTelemetry A
provides.
- Bundled exporters
- - [OTLP](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/otlp.md)
- - Jaeger gRPC
- - Logging
+ - [OTLP](https://opentelemetry.io/docs/specs/otlp/)
+ - Console
- Zipkin
- Bundled propagators
- [W3C TraceContext / Baggage](https://www.w3.org/TR/trace-context/)
diff --git a/docs/apidiffs/current_vs_latest/opentelemetry-instrumentation-annotations.txt b/docs/apidiffs/current_vs_latest/opentelemetry-instrumentation-annotations.txt
index f2ce28a1b43b..9711244d9a5a 100644
--- a/docs/apidiffs/current_vs_latest/opentelemetry-instrumentation-annotations.txt
+++ b/docs/apidiffs/current_vs_latest/opentelemetry-instrumentation-annotations.txt
@@ -1,2 +1,2 @@
-Comparing source compatibility of opentelemetry-instrumentation-annotations-2.5.0-SNAPSHOT.jar against opentelemetry-instrumentation-annotations-2.4.0.jar
+Comparing source compatibility of opentelemetry-instrumentation-annotations-2.7.0-SNAPSHOT.jar against opentelemetry-instrumentation-annotations-2.6.0.jar
No changes.
\ No newline at end of file
diff --git a/docs/apidiffs/current_vs_latest/opentelemetry-instrumentation-api.txt b/docs/apidiffs/current_vs_latest/opentelemetry-instrumentation-api.txt
index c5bcfad8b5f5..e6f29db1607f 100644
--- a/docs/apidiffs/current_vs_latest/opentelemetry-instrumentation-api.txt
+++ b/docs/apidiffs/current_vs_latest/opentelemetry-instrumentation-api.txt
@@ -1,2 +1,2 @@
-Comparing source compatibility of opentelemetry-instrumentation-api-2.5.0-SNAPSHOT.jar against opentelemetry-instrumentation-api-2.4.0.jar
+Comparing source compatibility of opentelemetry-instrumentation-api-2.7.0-SNAPSHOT.jar against opentelemetry-instrumentation-api-2.6.0.jar
No changes.
\ No newline at end of file
diff --git a/docs/apidiffs/current_vs_latest/opentelemetry-spring-boot-autoconfigure.txt b/docs/apidiffs/current_vs_latest/opentelemetry-spring-boot-autoconfigure.txt
new file mode 100644
index 000000000000..f0024ddc916a
--- /dev/null
+++ b/docs/apidiffs/current_vs_latest/opentelemetry-spring-boot-autoconfigure.txt
@@ -0,0 +1,2 @@
+Comparing source compatibility of opentelemetry-spring-boot-autoconfigure-2.7.0-SNAPSHOT.jar against opentelemetry-spring-boot-autoconfigure-2.6.0.jar
+No changes.
\ No newline at end of file
diff --git a/docs/apidiffs/current_vs_latest/opentelemetry-spring-boot-starter.txt b/docs/apidiffs/current_vs_latest/opentelemetry-spring-boot-starter.txt
new file mode 100644
index 000000000000..32590bb0c2c9
--- /dev/null
+++ b/docs/apidiffs/current_vs_latest/opentelemetry-spring-boot-starter.txt
@@ -0,0 +1,2 @@
+Comparing source compatibility of opentelemetry-spring-boot-starter-2.7.0-SNAPSHOT.jar against opentelemetry-spring-boot-starter-2.6.0.jar
+No changes.
\ No newline at end of file
diff --git a/docs/supported-libraries.md b/docs/supported-libraries.md
index 71e9591454d2..68065b23894f 100644
--- a/docs/supported-libraries.md
+++ b/docs/supported-libraries.md
@@ -49,13 +49,14 @@ These are the supported libraries and frameworks:
| [AWS SDK](https://aws.amazon.com/sdk-for-java/) | 1.11.x and 2.2+ | [opentelemetry-aws-sdk-1.11](../instrumentation/aws-sdk/aws-sdk-1.11/library), [opentelemetry-aws-sdk-1.11-autoconfigure](../instrumentation/aws-sdk/aws-sdk-1.11/library-autoconfigure), [opentelemetry-aws-sdk-2.2](../instrumentation/aws-sdk/aws-sdk-2.2/library), [opentelemetry-aws-sdk-2.2-autoconfigure](../instrumentation/aws-sdk/aws-sdk-2.2/library-autoconfigure) | [Messaging Spans], [Database Client Spans], [HTTP Client Spans] |
| [Azure Core](https://docs.microsoft.com/en-us/java/api/overview/azure/core-readme) | 1.14+ | N/A | Context propagation |
| [Cassandra Driver](https://github.com/datastax/java-driver) | 3.0+ | [opentelemetry-cassandra-4.4](../instrumentation/cassandra/cassandra-4.4/library) | [Database Client Spans] |
+| [Clickhouse Client](https://github.com/ClickHouse/clickhouse-java) | 0.5+ | N/A | [Database Client Spans] |
| [Couchbase Client](https://github.com/couchbase/couchbase-java-client) | 2.0+ and 3.1+ | N/A | [Database Client Spans] |
| [c3p0](https://github.com/swaldman/c3p0) | 0.9.2+ | [opentelemetry-c3p0-0.9](../instrumentation/c3p0-0.9/library) | [Database Pool Metrics] |
| [Dropwizard Metrics](https://metrics.dropwizard.io/) | 4.0+ (disabled by default) | N/A | none |
| [Dropwizard Views](https://www.dropwizard.io/en/latest/manual/views.html) | 0.7+ | N/A | Controller Spans [3] |
| [Eclipse Grizzly](https://javaee.github.io/grizzly/httpserverframework.html) | 2.3+ | N/A | [HTTP Server Spans], [HTTP Server Metrics] |
| [Eclipse Jersey](https://eclipse-ee4j.github.io/jersey/) | 2.0+ | N/A | Provides `http.route` [2], Controller Spans [3] |
-| [Eclipse Jetty HTTP Client](https://www.eclipse.org/jetty/javadoc/jetty-9/org/eclipse/jetty/client/HttpClient.html) | 9.2+ (not including 10+ yet) | [opentelemetry-jetty-httpclient-9.2](../instrumentation/jetty-httpclient/jetty-httpclient-9.2/library) | [HTTP Client Spans], [HTTP Client Metrics] |
+| [Eclipse Jetty HTTP Client](https://www.eclipse.org/jetty/javadoc/jetty-9/org/eclipse/jetty/client/HttpClient.html) | 9.2 - 9.4.x, 12.0+ | [opentelemetry-jetty-httpclient-9.2](../instrumentation/jetty-httpclient/jetty-httpclient-9.2/library) [opentelemetry-jetty-httpclient-12.0](../instrumentation/jetty-httpclient/jetty-httpclient-12.0/library) | [HTTP Client Spans], [HTTP Client Metrics] |
| [Eclipse Metro](https://projects.eclipse.org/projects/ee4j.metro) | 2.2+ | N/A | Provides `http.route` [2], Controller Spans [3] |
| [Eclipse Mojarra](https://projects.eclipse.org/projects/ee4j.mojarra) | 1.2+ | N/A | Provides `http.route` [2], Controller Spans [3] |
| [Elasticsearch API Client](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/index.html) | 7.16 - 7.17.19, 8.0 - 8.9.+ [4] | N/A | [Elasticsearch Client Spans] |
@@ -80,6 +81,7 @@ These are the supported libraries and frameworks:
| [Java Http Client](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/package-summary.html) | Java 11+ | [opentelemetry-java-http-client](../instrumentation/java-http-client/library) | [HTTP Client Spans], [HTTP Client Metrics] |
| [java.util.logging](https://docs.oracle.com/javase/8/docs/api/java/util/logging/package-summary.html) | Java 8+ | N/A | none |
| [Java Platform](https://docs.oracle.com/javase/8/docs/api/java/lang/management/ManagementFactory.html) | Java 8+ | [opentelemetry-runtime-telemetry-java8](../instrumentation/runtime-telemetry/runtime-telemetry-java8/library), [opentelemetry-runtime-telemetry-java17](../instrumentation/runtime-telemetry/runtime-telemetry-java17/library), [opentelemetry-resources](../instrumentation/resources/library) | [JVM Runtime Metrics] |
+| [Javalin](https://javalin.io/) | 5.0+ | N/A | Provides `http.route` [2] |
| [JAX-RS](https://javaee.github.io/javaee-spec/javadocs/javax/ws/rs/package-summary.html) | 0.5+ | N/A | Provides `http.route` [2], Controller Spans [3] |
| [JAX-RS Client](https://javaee.github.io/javaee-spec/javadocs/javax/ws/rs/client/package-summary.html) | 1.1+ | N/A | [HTTP Client Spans], [HTTP Client Metrics] |
| [JAX-WS](https://jakarta.ee/specifications/xml-web-services/2.3/apidocs/javax/xml/ws/package-summary.html) | 2.0+ (not including 3.x yet) | N/A | Provides `http.route` [2], Controller Spans [3] |
@@ -114,7 +116,7 @@ These are the supported libraries and frameworks:
| [Reactor Netty](https://github.com/reactor/reactor-netty) | 0.9+ | N/A | [HTTP Client Spans], [HTTP Client Metrics] |
| [Rediscala](https://github.com/etaty/rediscala) | 1.8+ | N/A | [Database Client Spans] |
| [Redisson](https://github.com/redisson/redisson) | 3.0+ | N/A | [Database Client Spans] |
-| [RESTEasy](https://resteasy.github.io/) | 3.0+ | N/A | Provides `http.route` [2], Controller Spans [3] |
+| [RESTEasy](https://resteasy.dev/) | 3.0+ | N/A | Provides `http.route` [2], Controller Spans [3] |
| [Restlet](https://restlet.github.io/) | 1.0+ | [opentelemetry-restlet-1.1](../instrumentation/restlet/restlet-1.1/library), [opentelemetry-restlet-2.0](../instrumentation/restlet/restlet-2.0/library) | [HTTP Server Spans], [HTTP Server Metrics] |
| [RMI](https://docs.oracle.com/en/java/javase/11/docs/api/java.rmi/java/rmi/package-summary.html) | Java 8+ | | [RPC Client Spans], [RPC Server Spans] |
| [RxJava](https://github.com/ReactiveX/RxJava) | 1.0+ | [opentelemetry-rxjava-1.0](../instrumentation/rxjava/rxjava-1.0/library), [opentelemetry-rxjava-2.0](../instrumentation/rxjava/rxjava-2.0/library), [opentelemetry-rxjava-3.0](../instrumentation/rxjava/rxjava-3.0/library), [opentelemetry-rxjava-3.1.1](../instrumentation/rxjava/rxjava-3.1.1/library) | Context propagation |
diff --git a/examples/distro/agent/build.gradle b/examples/distro/agent/build.gradle
index 096b0d0439e5..3045dbaeca8a 100644
--- a/examples/distro/agent/build.gradle
+++ b/examples/distro/agent/build.gradle
@@ -1,7 +1,7 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
- id("com.github.johnrengelman.shadow")
+ id("com.gradleup.shadow")
}
apply from: "$rootDir/gradle/shadow.gradle"
diff --git a/examples/distro/build.gradle b/examples/distro/build.gradle
index dfb5db46e42a..c1539ab6cb71 100644
--- a/examples/distro/build.gradle
+++ b/examples/distro/build.gradle
@@ -13,8 +13,8 @@ buildscript {
}
dependencies {
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.25.0"
- classpath "com.github.johnrengelman:shadow:8.1.1"
- classpath "io.opentelemetry.instrumentation:gradle-plugins:2.5.0-alpha-SNAPSHOT"
+ classpath "com.gradleup.shadow:shadow-gradle-plugin:8.3.0"
+ classpath "io.opentelemetry.instrumentation:gradle-plugins:2.7.0-alpha-SNAPSHOT"
}
}
@@ -27,14 +27,14 @@ subprojects {
ext {
versions = [
// this line is managed by .github/scripts/update-sdk-version.sh
- opentelemetrySdk : "1.39.0",
+ opentelemetrySdk : "1.40.0",
// these lines are managed by .github/scripts/update-version.sh
- opentelemetryJavaagent : "2.5.0-SNAPSHOT",
- opentelemetryJavaagentAlpha: "2.5.0-alpha-SNAPSHOT",
+ opentelemetryJavaagent : "2.7.0-SNAPSHOT",
+ opentelemetryJavaagentAlpha: "2.7.0-alpha-SNAPSHOT",
autoservice : "1.1.1",
- junit : "5.10.2"
+ junit : "5.10.3"
]
deps = [
diff --git a/examples/distro/gradle/instrumentation.gradle b/examples/distro/gradle/instrumentation.gradle
index ccaa22fc12b3..ad484d8d2821 100644
--- a/examples/distro/gradle/instrumentation.gradle
+++ b/examples/distro/gradle/instrumentation.gradle
@@ -1,5 +1,5 @@
apply plugin: 'java'
-apply plugin: 'com.github.johnrengelman.shadow'
+apply plugin: 'com.gradleup.shadow'
apply plugin: 'io.opentelemetry.instrumentation.muzzle-generation'
apply plugin: 'io.opentelemetry.instrumentation.muzzle-check'
@@ -25,7 +25,7 @@ dependencies {
// test dependencies
testImplementation("io.opentelemetry.javaagent:opentelemetry-testing-common")
testImplementation("io.opentelemetry:opentelemetry-sdk-testing")
- testImplementation("org.assertj:assertj-core:3.26.0")
+ testImplementation("org.assertj:assertj-core:3.26.3")
add("codegen", "io.opentelemetry.javaagent:opentelemetry-javaagent-tooling:${versions.opentelemetryJavaagentAlpha}")
add("muzzleBootstrap", "io.opentelemetry.instrumentation:opentelemetry-instrumentation-annotations-support:${versions.opentelemetryJavaagentAlpha}")
diff --git a/examples/distro/gradle/wrapper/gradle-wrapper.jar b/examples/distro/gradle/wrapper/gradle-wrapper.jar
index e6441136f3d4..2c3521197d7c 100644
Binary files a/examples/distro/gradle/wrapper/gradle-wrapper.jar and b/examples/distro/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/examples/distro/gradle/wrapper/gradle-wrapper.properties b/examples/distro/gradle/wrapper/gradle-wrapper.properties
index 8a1f6b97f473..68e8816d71c9 100644
--- a/examples/distro/gradle/wrapper/gradle-wrapper.properties
+++ b/examples/distro/gradle/wrapper/gradle-wrapper.properties
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionSha256Sum=a4b4158601f8636cdeeab09bd76afb640030bb5b144aafe261a5e8af027dc612
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
+distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/examples/distro/gradlew b/examples/distro/gradlew
index b740cf13397a..f5feea6d6b11 100755
--- a/examples/distro/gradlew
+++ b/examples/distro/gradlew
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# SPDX-License-Identifier: Apache-2.0
+#
##############################################################################
#
@@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
-APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
+' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
diff --git a/examples/distro/gradlew.bat b/examples/distro/gradlew.bat
index 25da30dbdeee..9d21a21834d5 100644
--- a/examples/distro/gradlew.bat
+++ b/examples/distro/gradlew.bat
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
diff --git a/examples/distro/smoke-tests/build.gradle b/examples/distro/smoke-tests/build.gradle
index feb12ef9ea33..2db60894f48c 100644
--- a/examples/distro/smoke-tests/build.gradle
+++ b/examples/distro/smoke-tests/build.gradle
@@ -3,11 +3,11 @@ plugins {
}
dependencies {
- testImplementation("org.testcontainers:testcontainers:1.19.8")
- testImplementation("com.fasterxml.jackson.core:jackson-databind:2.17.1")
- testImplementation("com.google.protobuf:protobuf-java-util:3.25.3")
+ testImplementation("org.testcontainers:testcontainers:1.20.1")
+ testImplementation("com.fasterxml.jackson.core:jackson-databind:2.17.2")
+ testImplementation("com.google.protobuf:protobuf-java-util:3.25.4")
testImplementation("com.squareup.okhttp3:okhttp:4.12.0")
- testImplementation("io.opentelemetry.proto:opentelemetry-proto:1.3.1-alpha")
+ testImplementation("io.opentelemetry.proto:opentelemetry-proto:1.3.2-alpha")
testImplementation("io.opentelemetry:opentelemetry-api")
testImplementation("ch.qos.logback:logback-classic:1.5.6")
diff --git a/examples/distro/testing/agent-for-testing/build.gradle b/examples/distro/testing/agent-for-testing/build.gradle
index 0879f3985de4..5eec782efd4c 100644
--- a/examples/distro/testing/agent-for-testing/build.gradle
+++ b/examples/distro/testing/agent-for-testing/build.gradle
@@ -1,7 +1,7 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
- id("com.github.johnrengelman.shadow")
+ id("com.gradleup.shadow")
}
apply from: "$rootDir/gradle/shadow.gradle"
diff --git a/examples/extension/build.gradle b/examples/extension/build.gradle
index 372e1a1f5190..625bb443376d 100644
--- a/examples/extension/build.gradle
+++ b/examples/extension/build.gradle
@@ -10,11 +10,11 @@ plugins {
into a single jar.
See https://imperceptiblethoughts.com/shadow/ for more details about Shadow plugin.
*/
- id "com.github.johnrengelman.shadow" version "8.1.1"
+ id "com.gradleup.shadow" version "8.3.0"
id "com.diffplug.spotless" version "6.25.0"
- id "io.opentelemetry.instrumentation.muzzle-generation" version "2.5.0-alpha-SNAPSHOT"
- id "io.opentelemetry.instrumentation.muzzle-check" version "2.5.0-alpha-SNAPSHOT"
+ id "io.opentelemetry.instrumentation.muzzle-generation" version "2.7.0-alpha-SNAPSHOT"
+ id "io.opentelemetry.instrumentation.muzzle-check" version "2.7.0-alpha-SNAPSHOT"
}
group 'io.opentelemetry.example'
@@ -23,13 +23,13 @@ version '1.0'
ext {
versions = [
// this line is managed by .github/scripts/update-sdk-version.sh
- opentelemetrySdk : "1.39.0",
+ opentelemetrySdk : "1.40.0",
// these lines are managed by .github/scripts/update-version.sh
- opentelemetryJavaagent : "2.5.0-SNAPSHOT",
- opentelemetryJavaagentAlpha: "2.5.0-alpha-SNAPSHOT",
+ opentelemetryJavaagent : "2.7.0-SNAPSHOT",
+ opentelemetryJavaagentAlpha: "2.7.0-alpha-SNAPSHOT",
- junit : "5.10.2"
+ junit : "5.10.3"
]
deps = [
@@ -96,15 +96,15 @@ dependencies {
Only dependencies added to `implementation` configuration will be picked up by Shadow plugin
and added to the resulting jar for our extension's distribution.
*/
- implementation 'org.apache.commons:commons-lang3:3.14.0'
+ implementation 'org.apache.commons:commons-lang3:3.16.0'
//All dependencies below are only for tests
- testImplementation("org.testcontainers:testcontainers:1.19.8")
- testImplementation("com.fasterxml.jackson.core:jackson-databind:2.17.1")
- testImplementation("com.google.protobuf:protobuf-java-util:3.25.3")
+ testImplementation("org.testcontainers:testcontainers:1.20.1")
+ testImplementation("com.fasterxml.jackson.core:jackson-databind:2.17.2")
+ testImplementation("com.google.protobuf:protobuf-java-util:3.25.4")
testImplementation("com.squareup.okhttp3:okhttp:4.12.0")
testImplementation("io.opentelemetry:opentelemetry-api")
- testImplementation("io.opentelemetry.proto:opentelemetry-proto:1.3.1-alpha")
+ testImplementation("io.opentelemetry.proto:opentelemetry-proto:1.3.2-alpha")
testImplementation("org.junit.jupiter:junit-jupiter-api:${versions.junit}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${versions.junit}")
diff --git a/examples/extension/gradle/wrapper/gradle-wrapper.jar b/examples/extension/gradle/wrapper/gradle-wrapper.jar
index e6441136f3d4..2c3521197d7c 100644
Binary files a/examples/extension/gradle/wrapper/gradle-wrapper.jar and b/examples/extension/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/examples/extension/gradle/wrapper/gradle-wrapper.properties b/examples/extension/gradle/wrapper/gradle-wrapper.properties
index 8a1f6b97f473..68e8816d71c9 100644
--- a/examples/extension/gradle/wrapper/gradle-wrapper.properties
+++ b/examples/extension/gradle/wrapper/gradle-wrapper.properties
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionSha256Sum=a4b4158601f8636cdeeab09bd76afb640030bb5b144aafe261a5e8af027dc612
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
+distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/examples/extension/gradlew b/examples/extension/gradlew
index b740cf13397a..f5feea6d6b11 100755
--- a/examples/extension/gradlew
+++ b/examples/extension/gradlew
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# SPDX-License-Identifier: Apache-2.0
+#
##############################################################################
#
@@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
-APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
+' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
diff --git a/examples/extension/gradlew.bat b/examples/extension/gradlew.bat
index 25da30dbdeee..9d21a21834d5 100644
--- a/examples/extension/gradlew.bat
+++ b/examples/extension/gradlew.bat
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
diff --git a/gradle-plugins/build.gradle.kts b/gradle-plugins/build.gradle.kts
index ae63845817b4..01cc58d93509 100644
--- a/gradle-plugins/build.gradle.kts
+++ b/gradle-plugins/build.gradle.kts
@@ -24,7 +24,7 @@ configurations.named("compileOnly") {
extendsFrom(bbGradlePlugin)
}
-val byteBuddyVersion = "1.14.17"
+val byteBuddyVersion = "1.14.18"
val aetherVersion = "1.1.0"
dependencies {
@@ -39,11 +39,11 @@ dependencies {
implementation("org.eclipse.aether:aether-transport-http:${aetherVersion}")
implementation("org.apache.maven:maven-aether-provider:3.3.9")
- implementation("com.github.johnrengelman:shadow:8.1.1")
+ implementation("com.gradleup.shadow:shadow-gradle-plugin:8.3.0")
- testImplementation("org.assertj:assertj-core:3.26.0")
+ testImplementation("org.assertj:assertj-core:3.26.3")
- testImplementation(enforcedPlatform("org.junit:junit-bom:5.10.2"))
+ testImplementation(enforcedPlatform("org.junit:junit-bom:5.10.3"))
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
diff --git a/gradle-plugins/gradle/wrapper/gradle-wrapper.jar b/gradle-plugins/gradle/wrapper/gradle-wrapper.jar
index e6441136f3d4..2c3521197d7c 100644
Binary files a/gradle-plugins/gradle/wrapper/gradle-wrapper.jar and b/gradle-plugins/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle-plugins/gradle/wrapper/gradle-wrapper.properties b/gradle-plugins/gradle/wrapper/gradle-wrapper.properties
index 8a1f6b97f473..68e8816d71c9 100644
--- a/gradle-plugins/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle-plugins/gradle/wrapper/gradle-wrapper.properties
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionSha256Sum=a4b4158601f8636cdeeab09bd76afb640030bb5b144aafe261a5e8af027dc612
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
+distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/gradle-plugins/gradlew b/gradle-plugins/gradlew
index b740cf13397a..f5feea6d6b11 100755
--- a/gradle-plugins/gradlew
+++ b/gradle-plugins/gradlew
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# SPDX-License-Identifier: Apache-2.0
+#
##############################################################################
#
@@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
-APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
+' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
diff --git a/gradle-plugins/gradlew.bat b/gradle-plugins/gradlew.bat
index 25da30dbdeee..9d21a21834d5 100644
--- a/gradle-plugins/gradlew.bat
+++ b/gradle-plugins/gradlew.bat
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
diff --git a/gradle-plugins/src/main/kotlin/io.opentelemetry.instrumentation.muzzle-check.gradle.kts b/gradle-plugins/src/main/kotlin/io.opentelemetry.instrumentation.muzzle-check.gradle.kts
index 1b6cebb97f38..c010f21568fa 100644
--- a/gradle-plugins/src/main/kotlin/io.opentelemetry.instrumentation.muzzle-check.gradle.kts
+++ b/gradle-plugins/src/main/kotlin/io.opentelemetry.instrumentation.muzzle-check.gradle.kts
@@ -28,8 +28,7 @@ import java.util.stream.StreamSupport
plugins {
`java-library`
-
- id("com.github.johnrengelman.shadow")
+ id("com.gradleup.shadow")
}
// Select a random set of versions to test
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index e6441136f3d4..2c3521197d7c 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 8a1f6b97f473..68e8816d71c9 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionSha256Sum=a4b4158601f8636cdeeab09bd76afb640030bb5b144aafe261a5e8af027dc612
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
+distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/gradlew b/gradlew
index b740cf13397a..f5feea6d6b11 100755
--- a/gradlew
+++ b/gradlew
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# SPDX-License-Identifier: Apache-2.0
+#
##############################################################################
#
@@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
-APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
+' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
diff --git a/gradlew.bat b/gradlew.bat
index 25da30dbdeee..9d21a21834d5 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
diff --git a/instrumentation-annotations-support/src/main/java/io/opentelemetry/instrumentation/api/annotation/support/AnnotationReflectionHelper.java b/instrumentation-annotations-support/src/main/java/io/opentelemetry/instrumentation/api/annotation/support/AnnotationReflectionHelper.java
index 4695bb3310b6..5bbe2a77a801 100644
--- a/instrumentation-annotations-support/src/main/java/io/opentelemetry/instrumentation/api/annotation/support/AnnotationReflectionHelper.java
+++ b/instrumentation-annotations-support/src/main/java/io/opentelemetry/instrumentation/api/annotation/support/AnnotationReflectionHelper.java
@@ -14,7 +14,7 @@
import java.util.function.Function;
import javax.annotation.Nullable;
-/** Helper class for reflecting over annotations at runtime.. */
+/** Helper class for reflecting over annotations at runtime. */
public class AnnotationReflectionHelper {
private AnnotationReflectionHelper() {}
diff --git a/instrumentation-api-incubator/build.gradle.kts b/instrumentation-api-incubator/build.gradle.kts
index 6acb75e5f79d..00d887da1b25 100644
--- a/instrumentation-api-incubator/build.gradle.kts
+++ b/instrumentation-api-incubator/build.gradle.kts
@@ -21,6 +21,7 @@ dependencies {
testImplementation(project(":testing-common"))
testImplementation("io.opentelemetry:opentelemetry-sdk")
testImplementation("io.opentelemetry:opentelemetry-sdk-testing")
+ testImplementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating")
}
tasks {
diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java
new file mode 100644
index 000000000000..50f73aa48069
--- /dev/null
+++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpClientInstrumenterBuilder.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package io.opentelemetry.instrumentation.api.incubator.builder.internal;
+
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
+import io.opentelemetry.api.OpenTelemetry;
+import io.opentelemetry.context.propagation.TextMapSetter;
+import io.opentelemetry.instrumentation.api.incubator.config.internal.CommonConfig;
+import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientExperimentalMetrics;
+import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientPeerServiceAttributesExtractor;
+import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpExperimentalAttributesExtractor;
+import io.opentelemetry.instrumentation.api.incubator.semconv.net.PeerServiceResolver;
+import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
+import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
+import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder;
+import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor;
+import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor;
+import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractor;
+import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractorBuilder;
+import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesGetter;
+import io.opentelemetry.instrumentation.api.semconv.http.HttpClientMetrics;
+import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor;
+import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractorBuilder;
+import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+import javax.annotation.Nullable;
+
+/**
+ * This class is internal and is hence not for public use. Its APIs are unstable and can change at
+ * any time.
+ */
+public final class DefaultHttpClientInstrumenterBuilder {
+
+ private final String instrumentationName;
+ private final OpenTelemetry openTelemetry;
+
+ private final List> additionalExtractors =
+ new ArrayList<>();
+ private final HttpClientAttributesExtractorBuilder
+ httpAttributesExtractorBuilder;
+ private final HttpClientAttributesGetter attributesGetter;
+ private final HttpSpanNameExtractorBuilder httpSpanNameExtractorBuilder;
+
+ @Nullable private TextMapSetter headerSetter;
+ private Function, ? extends SpanNameExtractor super REQUEST>>
+ spanNameExtractorTransformer = Function.identity();
+ private boolean emitExperimentalHttpClientMetrics = false;
+ private Consumer> builderCustomizer = b -> {};
+
+ public DefaultHttpClientInstrumenterBuilder(
+ String instrumentationName,
+ OpenTelemetry openTelemetry,
+ HttpClientAttributesGetter attributesGetter) {
+ this.instrumentationName = instrumentationName;
+ this.openTelemetry = openTelemetry;
+ httpSpanNameExtractorBuilder = HttpSpanNameExtractor.builder(attributesGetter);
+ httpAttributesExtractorBuilder = HttpClientAttributesExtractor.builder(attributesGetter);
+ this.attributesGetter = attributesGetter;
+ }
+
+ /**
+ * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
+ * items. The {@link AttributesExtractor} will be executed after all default extractors.
+ */
+ @CanIgnoreReturnValue
+ public DefaultHttpClientInstrumenterBuilder addAttributeExtractor(
+ AttributesExtractor super REQUEST, ? super RESPONSE> attributesExtractor) {
+ additionalExtractors.add(attributesExtractor);
+ return this;
+ }
+
+ /**
+ * Configures the HTTP request headers that will be captured as span attributes.
+ *
+ * @param requestHeaders A list of HTTP header names.
+ */
+ @CanIgnoreReturnValue
+ public DefaultHttpClientInstrumenterBuilder setCapturedRequestHeaders(
+ List requestHeaders) {
+ httpAttributesExtractorBuilder.setCapturedRequestHeaders(requestHeaders);
+ return this;
+ }
+
+ /**
+ * Configures the HTTP response headers that will be captured as span attributes.
+ *
+ * @param responseHeaders A list of HTTP header names.
+ */
+ @CanIgnoreReturnValue
+ public DefaultHttpClientInstrumenterBuilder setCapturedResponseHeaders(
+ List responseHeaders) {
+ httpAttributesExtractorBuilder.setCapturedResponseHeaders(responseHeaders);
+ return this;
+ }
+
+ /**
+ * Configures the instrumentation to recognize an alternative set of HTTP request methods.
+ *
+ *
By default, this instrumentation defines "known" methods as the ones listed in RFC9110 and the PATCH
+ * method defined in RFC5789.
+ *
+ *
Note: calling this method overrides the default known method sets completely; it does
+ * not supplement it.
+ *
+ * @param knownMethods A set of recognized HTTP request methods.
+ * @see HttpClientAttributesExtractorBuilder#setKnownMethods(Set)
+ */
+ @CanIgnoreReturnValue
+ public DefaultHttpClientInstrumenterBuilder setKnownMethods(
+ Set knownMethods) {
+ httpAttributesExtractorBuilder.setKnownMethods(knownMethods);
+ httpSpanNameExtractorBuilder.setKnownMethods(knownMethods);
+ return this;
+ }
+
+ @CanIgnoreReturnValue
+ public DefaultHttpClientInstrumenterBuilder setHeaderSetter(
+ @Nullable TextMapSetter headerSetter) {
+ this.headerSetter = headerSetter;
+ return this;
+ }
+
+ /**
+ * Configures the instrumentation to emit experimental HTTP client metrics.
+ *
+ * @param emitExperimentalHttpClientMetrics {@code true} if the experimental HTTP client metrics
+ * are to be emitted.
+ */
+ @CanIgnoreReturnValue
+ public DefaultHttpClientInstrumenterBuilder
+ setEmitExperimentalHttpClientMetrics(boolean emitExperimentalHttpClientMetrics) {
+ this.emitExperimentalHttpClientMetrics = emitExperimentalHttpClientMetrics;
+ return this;
+ }
+
+ /** Sets custom {@link SpanNameExtractor} via transform function. */
+ @CanIgnoreReturnValue
+ public DefaultHttpClientInstrumenterBuilder setSpanNameExtractor(
+ Function, ? extends SpanNameExtractor super REQUEST>>
+ spanNameExtractorTransformer) {
+ this.spanNameExtractorTransformer = spanNameExtractorTransformer;
+ return this;
+ }
+
+ /** Sets custom {@link PeerServiceResolver}. */
+ @CanIgnoreReturnValue
+ public DefaultHttpClientInstrumenterBuilder setPeerServiceResolver(
+ PeerServiceResolver peerServiceResolver) {
+ return addAttributeExtractor(
+ HttpClientPeerServiceAttributesExtractor.create(attributesGetter, peerServiceResolver));
+ }
+
+ @CanIgnoreReturnValue
+ public DefaultHttpClientInstrumenterBuilder setBuilderCustomizer(
+ Consumer> builderCustomizer) {
+ this.builderCustomizer = builderCustomizer;
+ return this;
+ }
+
+ public Instrumenter build() {
+
+ SpanNameExtractor super REQUEST> spanNameExtractor =
+ spanNameExtractorTransformer.apply(httpSpanNameExtractorBuilder.build());
+
+ InstrumenterBuilder builder =
+ Instrumenter.builder(
+ openTelemetry, instrumentationName, spanNameExtractor)
+ .setSpanStatusExtractor(HttpSpanStatusExtractor.create(attributesGetter))
+ .addAttributesExtractor(httpAttributesExtractorBuilder.build())
+ .addAttributesExtractors(additionalExtractors)
+ .addOperationMetrics(HttpClientMetrics.get());
+ if (emitExperimentalHttpClientMetrics) {
+ builder
+ .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(attributesGetter))
+ .addOperationMetrics(HttpClientExperimentalMetrics.get());
+ }
+ builderCustomizer.accept(builder);
+
+ if (headerSetter != null) {
+ return builder.buildClientInstrumenter(headerSetter);
+ }
+ return builder.buildInstrumenter(SpanKindExtractor.alwaysClient());
+ }
+
+ public OpenTelemetry getOpenTelemetry() {
+ return openTelemetry;
+ }
+
+ @CanIgnoreReturnValue
+ public DefaultHttpClientInstrumenterBuilder configure(CommonConfig config) {
+ set(config::getKnownHttpRequestMethods, this::setKnownMethods);
+ set(config::getClientRequestHeaders, this::setCapturedRequestHeaders);
+ set(config::getClientResponseHeaders, this::setCapturedResponseHeaders);
+ set(config::getPeerServiceResolver, this::setPeerServiceResolver);
+ set(
+ config::shouldEmitExperimentalHttpClientTelemetry,
+ this::setEmitExperimentalHttpClientMetrics);
+ return this;
+ }
+
+ private static void set(Supplier supplier, Consumer consumer) {
+ T t = supplier.get();
+ if (t != null) {
+ consumer.accept(t);
+ }
+ }
+}
diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpServerInstrumenterBuilder.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpServerInstrumenterBuilder.java
new file mode 100644
index 000000000000..b229a7126e48
--- /dev/null
+++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/builder/internal/DefaultHttpServerInstrumenterBuilder.java
@@ -0,0 +1,219 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package io.opentelemetry.instrumentation.api.incubator.builder.internal;
+
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
+import io.opentelemetry.api.OpenTelemetry;
+import io.opentelemetry.context.propagation.TextMapGetter;
+import io.opentelemetry.instrumentation.api.incubator.config.internal.CommonConfig;
+import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpExperimentalAttributesExtractor;
+import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpServerExperimentalMetrics;
+import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
+import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
+import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder;
+import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor;
+import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor;
+import io.opentelemetry.instrumentation.api.instrumenter.SpanStatusExtractor;
+import io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesExtractor;
+import io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesExtractorBuilder;
+import io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesGetter;
+import io.opentelemetry.instrumentation.api.semconv.http.HttpServerMetrics;
+import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRoute;
+import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRouteBuilder;
+import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor;
+import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractorBuilder;
+import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+import javax.annotation.Nullable;
+
+/**
+ * This class is internal and is hence not for public use. Its APIs are unstable and can change at
+ * any time.
+ */
+public final class DefaultHttpServerInstrumenterBuilder {
+
+ private final String instrumentationName;
+ private final OpenTelemetry openTelemetry;
+
+ private final List> additionalExtractors =
+ new ArrayList<>();
+ private Function<
+ SpanStatusExtractor super REQUEST, ? super RESPONSE>,
+ ? extends SpanStatusExtractor super REQUEST, ? super RESPONSE>>
+ statusExtractorTransformer = Function.identity();
+ private final HttpServerAttributesExtractorBuilder
+ httpAttributesExtractorBuilder;
+ private final HttpSpanNameExtractorBuilder httpSpanNameExtractorBuilder;
+
+ @Nullable private TextMapGetter headerGetter;
+ private Function, ? extends SpanNameExtractor super REQUEST>>
+ spanNameExtractorTransformer = Function.identity();
+ private final HttpServerRouteBuilder httpServerRouteBuilder;
+ private final HttpServerAttributesGetter attributesGetter;
+ private boolean emitExperimentalHttpServerMetrics = false;
+
+ public DefaultHttpServerInstrumenterBuilder(
+ String instrumentationName,
+ OpenTelemetry openTelemetry,
+ HttpServerAttributesGetter attributesGetter) {
+ this.instrumentationName = instrumentationName;
+ this.openTelemetry = openTelemetry;
+ httpAttributesExtractorBuilder = HttpServerAttributesExtractor.builder(attributesGetter);
+ httpSpanNameExtractorBuilder = HttpSpanNameExtractor.builder(attributesGetter);
+ httpServerRouteBuilder = HttpServerRoute.builder(attributesGetter);
+ this.attributesGetter = attributesGetter;
+ }
+
+ /**
+ * Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
+ * items.
+ */
+ @CanIgnoreReturnValue
+ public DefaultHttpServerInstrumenterBuilder addAttributesExtractor(
+ AttributesExtractor super REQUEST, ? super RESPONSE> attributesExtractor) {
+ additionalExtractors.add(attributesExtractor);
+ return this;
+ }
+
+ @CanIgnoreReturnValue
+ public DefaultHttpServerInstrumenterBuilder setStatusExtractor(
+ Function<
+ SpanStatusExtractor super REQUEST, ? super RESPONSE>,
+ ? extends SpanStatusExtractor super REQUEST, ? super RESPONSE>>
+ statusExtractor) {
+ this.statusExtractorTransformer = statusExtractor;
+ return this;
+ }
+
+ /**
+ * Configures the HTTP request headers that will be captured as span attributes.
+ *
+ * @param requestHeaders A list of HTTP header names.
+ */
+ @CanIgnoreReturnValue
+ public DefaultHttpServerInstrumenterBuilder setCapturedRequestHeaders(
+ List requestHeaders) {
+ httpAttributesExtractorBuilder.setCapturedRequestHeaders(requestHeaders);
+ return this;
+ }
+
+ /**
+ * Configures the HTTP response headers that will be captured as span attributes.
+ *
+ * @param responseHeaders A list of HTTP header names.
+ */
+ @CanIgnoreReturnValue
+ public DefaultHttpServerInstrumenterBuilder setCapturedResponseHeaders(
+ List responseHeaders) {
+ httpAttributesExtractorBuilder.setCapturedResponseHeaders(responseHeaders);
+ return this;
+ }
+
+ /**
+ * Configures the instrumentation to recognize an alternative set of HTTP request methods.
+ *
+ *
By default, this instrumentation defines "known" methods as the ones listed in RFC9110 and the PATCH
+ * method defined in RFC5789.
+ *
+ *
Note: calling this method overrides the default known method sets completely; it does
+ * not supplement it.
+ *
+ * @param knownMethods A set of recognized HTTP request methods.
+ * @see HttpServerAttributesExtractorBuilder#setKnownMethods(Set)
+ */
+ @CanIgnoreReturnValue
+ public DefaultHttpServerInstrumenterBuilder setKnownMethods(
+ Set knownMethods) {
+ httpAttributesExtractorBuilder.setKnownMethods(knownMethods);
+ httpSpanNameExtractorBuilder.setKnownMethods(knownMethods);
+ httpServerRouteBuilder.setKnownMethods(knownMethods);
+ return this;
+ }
+
+ @CanIgnoreReturnValue
+ public DefaultHttpServerInstrumenterBuilder setHeaderGetter(
+ @Nullable TextMapGetter headerGetter) {
+ this.headerGetter = headerGetter;
+ return this;
+ }
+
+ /**
+ * Configures the instrumentation to emit experimental HTTP server metrics.
+ *
+ * @param emitExperimentalHttpServerMetrics {@code true} if the experimental HTTP server metrics
+ * are to be emitted.
+ */
+ @CanIgnoreReturnValue
+ public DefaultHttpServerInstrumenterBuilder
+ setEmitExperimentalHttpServerMetrics(boolean emitExperimentalHttpServerMetrics) {
+ this.emitExperimentalHttpServerMetrics = emitExperimentalHttpServerMetrics;
+ return this;
+ }
+
+ /** Sets custom {@link SpanNameExtractor} via transform function. */
+ @CanIgnoreReturnValue
+ public DefaultHttpServerInstrumenterBuilder setSpanNameExtractor(
+ Function, ? extends SpanNameExtractor super REQUEST>>
+ spanNameExtractorTransformer) {
+ this.spanNameExtractorTransformer = spanNameExtractorTransformer;
+ return this;
+ }
+
+ public Instrumenter build() {
+ InstrumenterBuilder builder = builder();
+
+ if (headerGetter != null) {
+ return builder.buildServerInstrumenter(headerGetter);
+ }
+ return builder.buildInstrumenter(SpanKindExtractor.alwaysServer());
+ }
+
+ private InstrumenterBuilder builder() {
+ SpanNameExtractor super REQUEST> spanNameExtractor =
+ spanNameExtractorTransformer.apply(httpSpanNameExtractorBuilder.build());
+
+ InstrumenterBuilder builder =
+ Instrumenter.builder(
+ openTelemetry, instrumentationName, spanNameExtractor)
+ .setSpanStatusExtractor(
+ statusExtractorTransformer.apply(HttpSpanStatusExtractor.create(attributesGetter)))
+ .addAttributesExtractor(httpAttributesExtractorBuilder.build())
+ .addAttributesExtractors(additionalExtractors)
+ .addContextCustomizer(httpServerRouteBuilder.build())
+ .addOperationMetrics(HttpServerMetrics.get());
+ if (emitExperimentalHttpServerMetrics) {
+ builder
+ .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(attributesGetter))
+ .addOperationMetrics(HttpServerExperimentalMetrics.get());
+ }
+
+ return builder;
+ }
+
+ @CanIgnoreReturnValue
+ public DefaultHttpServerInstrumenterBuilder configure(CommonConfig config) {
+ set(config::getKnownHttpRequestMethods, this::setKnownMethods);
+ set(config::getServerRequestHeaders, this::setCapturedRequestHeaders);
+ set(config::getServerResponseHeaders, this::setCapturedResponseHeaders);
+ set(
+ config::shouldEmitExperimentalHttpServerTelemetry,
+ this::setEmitExperimentalHttpServerMetrics);
+ return this;
+ }
+
+ private static void set(Supplier supplier, Consumer consumer) {
+ T t = supplier.get();
+ if (t != null) {
+ consumer.accept(t);
+ }
+ }
+}
diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CommonConfig.java
similarity index 94%
rename from javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java
rename to instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CommonConfig.java
index f6d5a5479001..23875d7e8b5f 100644
--- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java
+++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/CommonConfig.java
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
-package io.opentelemetry.javaagent.bootstrap.internal;
+package io.opentelemetry.instrumentation.api.incubator.config.internal;
import static java.util.Collections.emptyMap;
@@ -21,12 +21,6 @@
*/
public final class CommonConfig {
- private static final CommonConfig instance = new CommonConfig(InstrumentationConfig.get());
-
- public static CommonConfig get() {
- return instance;
- }
-
private final PeerServiceResolver peerServiceResolver;
private final List clientRequestHeaders;
private final List clientResponseHeaders;
@@ -41,7 +35,7 @@ public static CommonConfig get() {
private final String loggingSpanIdKey;
private final String loggingTraceFlagsKey;
- CommonConfig(InstrumentationConfig config) {
+ public CommonConfig(InstrumentationConfig config) {
peerServiceResolver =
PeerServiceResolver.create(
config.getMap("otel.instrumentation.common.peer-service-mapping", emptyMap()));
diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EnduserConfig.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/EnduserConfig.java
similarity index 97%
rename from javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EnduserConfig.java
rename to instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/EnduserConfig.java
index fbde1c90aaa2..b44057c75f90 100644
--- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/EnduserConfig.java
+++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/EnduserConfig.java
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
-package io.opentelemetry.javaagent.bootstrap.internal;
+package io.opentelemetry.instrumentation.api.incubator.config.internal;
import java.util.Objects;
diff --git a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/InstrumentationConfig.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/InstrumentationConfig.java
similarity index 63%
rename from javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/InstrumentationConfig.java
rename to instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/InstrumentationConfig.java
index fc4b7aabc6c2..8ce777b270a7 100644
--- a/javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/InstrumentationConfig.java
+++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/config/internal/InstrumentationConfig.java
@@ -3,15 +3,13 @@
* SPDX-License-Identifier: Apache-2.0
*/
-package io.opentelemetry.javaagent.bootstrap.internal;
+package io.opentelemetry.instrumentation.api.incubator.config.internal;
import static java.util.Collections.emptyList;
-import static java.util.Objects.requireNonNull;
import java.time.Duration;
import java.util.List;
import java.util.Map;
-import java.util.logging.Logger;
import javax.annotation.Nullable;
/**
@@ -28,72 +26,44 @@
*
This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
-public abstract class InstrumentationConfig {
-
- private static final Logger logger = Logger.getLogger(InstrumentationConfig.class.getName());
-
- private static final InstrumentationConfig DEFAULT = new EmptyInstrumentationConfig();
-
- // lazy initialized, so that javaagent can set it
- private static volatile InstrumentationConfig instance = DEFAULT;
-
- /**
- * Sets the instrumentation configuration singleton. This method is only supposed to be called
- * once, during the agent initialization, just before {@link InstrumentationConfig#get()} is used
- * for the first time.
- *
- *
This method is internal and is hence not for public use. Its API is unstable and can change
- * at any time.
- */
- public static void internalInitializeConfig(InstrumentationConfig config) {
- if (instance != DEFAULT) {
- logger.warning("InstrumentationConfig#instance was already set earlier");
- return;
- }
- instance = requireNonNull(config);
- }
-
- /** Returns the global instrumentation configuration. */
- public static InstrumentationConfig get() {
- return instance;
- }
+public interface InstrumentationConfig {
/**
* Returns a string-valued configuration property or {@code null} if a property with name {@code
* name} has not been configured.
*/
@Nullable
- public abstract String getString(String name);
+ String getString(String name);
/**
* Returns a string-valued configuration property or {@code defaultValue} if a property with name
* {@code name} has not been configured.
*/
- public abstract String getString(String name, String defaultValue);
+ String getString(String name, String defaultValue);
/**
* Returns a boolean-valued configuration property or {@code defaultValue} if a property with name
* {@code name} has not been configured.
*/
- public abstract boolean getBoolean(String name, boolean defaultValue);
+ boolean getBoolean(String name, boolean defaultValue);
/**
* Returns an integer-valued configuration property or {@code defaultValue} if a property with
* name {@code name} has not been configured or when parsing has failed.
*/
- public abstract int getInt(String name, int defaultValue);
+ int getInt(String name, int defaultValue);
/**
* Returns a long-valued configuration property or {@code defaultValue} if a property with name
* {@code name} has not been configured or when parsing has failed.
*/
- public abstract long getLong(String name, long defaultValue);
+ long getLong(String name, long defaultValue);
/**
* Returns a double-valued configuration property or {@code defaultValue} if a property with name
* {@code name} has not been configured or when parsing has failed.
*/
- public abstract double getDouble(String name, double defaultValue);
+ double getDouble(String name, double defaultValue);
/**
* Returns a duration-valued configuration property or {@code defaultValue} if a property with
@@ -113,13 +83,13 @@ public static InstrumentationConfig get() {
*
*
Examples: 10s, 20ms, 5000
*/
- public abstract Duration getDuration(String name, Duration defaultValue);
+ Duration getDuration(String name, Duration defaultValue);
/**
* This is the same as calling {@code getList(String, List)} with the defaultValue equal to the
* emptyList()/
*/
- public List getList(String name) {
+ default List getList(String name) {
return getList(name, emptyList());
}
@@ -128,7 +98,7 @@ public List getList(String name) {
* {@code name} has not been configured. The format of the original value must be comma-separated,
* e.g. {@code one,two,three}. The returned list is unmodifiable.
*/
- public abstract List getList(String name, List defaultValue);
+ List getList(String name, List defaultValue);
/**
* Returns a map-valued configuration property or {@code defaultValue} if a property with name
@@ -136,5 +106,5 @@ public List getList(String name) {
* value must be comma-separated for each key, with an '=' separating the key and value, e.g.
* {@code key=value,anotherKey=anotherValue}. The returned map is unmodifiable.
*/
- public abstract Map getMap(String name, Map defaultValue);
+ Map getMap(String name, Map defaultValue);
}
diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/http/HttpClientExperimentalMetrics.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/http/HttpClientExperimentalMetrics.java
index 0beb49456245..dd08cbe493ff 100644
--- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/http/HttpClientExperimentalMetrics.java
+++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/http/HttpClientExperimentalMetrics.java
@@ -24,9 +24,9 @@
* {@link OperationListener} which keeps track of non-stable
* HTTP client metrics: the
+ * href="https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-metrics.md#metric-httpclientrequestbodysize">the
* request size and
+ * href="https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-metrics.md#metric-httpclientresponsebodysize">
* the response size.
*/
public final class HttpClientExperimentalMetrics implements OperationListener {
@@ -53,7 +53,7 @@ public static OperationMetrics get() {
private HttpClientExperimentalMetrics(Meter meter) {
LongHistogramBuilder requestSizeBuilder =
meter
- .histogramBuilder("http.client.request.size")
+ .histogramBuilder("http.client.request.body.size")
.setUnit("By")
.setDescription("Size of HTTP client request bodies.")
.ofLongs();
@@ -61,7 +61,7 @@ private HttpClientExperimentalMetrics(Meter meter) {
requestSize = requestSizeBuilder.build();
LongHistogramBuilder responseSizeBuilder =
meter
- .histogramBuilder("http.client.response.size")
+ .histogramBuilder("http.client.response.body.size")
.setUnit("By")
.setDescription("Size of HTTP client response bodies.")
.ofLongs();
diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/http/HttpServerExperimentalMetrics.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/http/HttpServerExperimentalMetrics.java
index d6bf144385d5..7c91292f513e 100644
--- a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/http/HttpServerExperimentalMetrics.java
+++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/http/HttpServerExperimentalMetrics.java
@@ -28,9 +28,9 @@
* HTTP server metrics: the
* number of in-flight request, the
+ * href="https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-metrics.md#metric-httpserverrequestbodysize">the
* request size and the
+ * href="https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-metrics.md#metric-httpserverresponsebodysize">the
* response size.
*/
public final class HttpServerExperimentalMetrics implements OperationListener {
@@ -65,7 +65,7 @@ private HttpServerExperimentalMetrics(Meter meter) {
activeRequests = activeRequestsBuilder.build();
LongHistogramBuilder requestSizeBuilder =
meter
- .histogramBuilder("http.server.request.size")
+ .histogramBuilder("http.server.request.body.size")
.setUnit("By")
.setDescription("Size of HTTP server request bodies.")
.ofLongs();
@@ -73,7 +73,7 @@ private HttpServerExperimentalMetrics(Meter meter) {
requestSize = requestSizeBuilder.build();
LongHistogramBuilder responseSizeBuilder =
meter
- .histogramBuilder("http.server.response.size")
+ .histogramBuilder("http.server.response.body.size")
.setUnit("By")
.setDescription("Size of HTTP server response bodies.")
.ofLongs();
diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingMetricsAdvice.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingMetricsAdvice.java
new file mode 100644
index 000000000000..8ada61c1683f
--- /dev/null
+++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingMetricsAdvice.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package io.opentelemetry.instrumentation.api.incubator.semconv.messaging;
+
+import static java.util.Arrays.asList;
+import static java.util.Collections.unmodifiableList;
+
+import io.opentelemetry.api.common.AttributeKey;
+import io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder;
+import io.opentelemetry.api.metrics.DoubleHistogramBuilder;
+import io.opentelemetry.semconv.ErrorAttributes;
+import io.opentelemetry.semconv.ServerAttributes;
+import java.util.List;
+
+final class MessagingMetricsAdvice {
+ static final List DURATION_SECONDS_BUCKETS =
+ unmodifiableList(
+ asList(0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1.0, 2.5, 5.0, 7.5, 10.0));
+
+ // copied from MessagingIncubatingAttributes
+ private static final AttributeKey MESSAGING_SYSTEM =
+ AttributeKey.stringKey("messaging.system");
+ private static final AttributeKey MESSAGING_DESTINATION_NAME =
+ AttributeKey.stringKey("messaging.destination.name");
+ private static final AttributeKey MESSAGING_OPERATION =
+ AttributeKey.stringKey("messaging.operation");
+ private static final AttributeKey MESSAGING_BATCH_MESSAGE_COUNT =
+ AttributeKey.longKey("messaging.batch.message_count");
+
+ static void applyPublishDurationAdvice(DoubleHistogramBuilder builder) {
+ if (!(builder instanceof ExtendedDoubleHistogramBuilder)) {
+ return;
+ }
+ ((ExtendedDoubleHistogramBuilder) builder)
+ .setAttributesAdvice(
+ asList(
+ MESSAGING_SYSTEM,
+ MESSAGING_DESTINATION_NAME,
+ MESSAGING_OPERATION,
+ MESSAGING_BATCH_MESSAGE_COUNT,
+ ErrorAttributes.ERROR_TYPE,
+ ServerAttributes.SERVER_PORT,
+ ServerAttributes.SERVER_ADDRESS));
+ }
+
+ private MessagingMetricsAdvice() {}
+}
diff --git a/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingProducerMetrics.java b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingProducerMetrics.java
new file mode 100644
index 000000000000..44d5b243744a
--- /dev/null
+++ b/instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingProducerMetrics.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package io.opentelemetry.instrumentation.api.incubator.semconv.messaging;
+
+import static java.util.logging.Level.FINE;
+
+import com.google.auto.value.AutoValue;
+import com.google.errorprone.annotations.CanIgnoreReturnValue;
+import io.opentelemetry.api.common.Attributes;
+import io.opentelemetry.api.metrics.DoubleHistogram;
+import io.opentelemetry.api.metrics.DoubleHistogramBuilder;
+import io.opentelemetry.api.metrics.Meter;
+import io.opentelemetry.context.Context;
+import io.opentelemetry.context.ContextKey;
+import io.opentelemetry.instrumentation.api.instrumenter.OperationListener;
+import io.opentelemetry.instrumentation.api.instrumenter.OperationMetrics;
+import io.opentelemetry.instrumentation.api.internal.OperationMetricsUtil;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Logger;
+
+/**
+ * {@link OperationListener} which keeps track of Producer
+ * metrics.
+ */
+public final class MessagingProducerMetrics implements OperationListener {
+ private static final double NANOS_PER_S = TimeUnit.SECONDS.toNanos(1);
+
+ private static final ContextKey MESSAGING_PRODUCER_METRICS_STATE =
+ ContextKey.named("messaging-producer-metrics-state");
+ private static final Logger logger = Logger.getLogger(MessagingProducerMetrics.class.getName());
+
+ private final DoubleHistogram publishDurationHistogram;
+
+ private MessagingProducerMetrics(Meter meter) {
+ DoubleHistogramBuilder durationBuilder =
+ meter
+ .histogramBuilder("messaging.publish.duration")
+ .setDescription("Measures the duration of publish operation.")
+ .setExplicitBucketBoundariesAdvice(MessagingMetricsAdvice.DURATION_SECONDS_BUCKETS)
+ .setUnit("s");
+ MessagingMetricsAdvice.applyPublishDurationAdvice(durationBuilder);
+ publishDurationHistogram = durationBuilder.build();
+ }
+
+ public static OperationMetrics get() {
+ return OperationMetricsUtil.create("messaging produce", MessagingProducerMetrics::new);
+ }
+
+ @Override
+ @CanIgnoreReturnValue
+ public Context onStart(Context context, Attributes startAttributes, long startNanos) {
+ return context.with(
+ MESSAGING_PRODUCER_METRICS_STATE,
+ new AutoValue_MessagingProducerMetrics_State(startAttributes, startNanos));
+ }
+
+ @Override
+ public void onEnd(Context context, Attributes endAttributes, long endNanos) {
+ MessagingProducerMetrics.State state = context.get(MESSAGING_PRODUCER_METRICS_STATE);
+ if (state == null) {
+ logger.log(
+ FINE,
+ "No state present when ending context {0}. Cannot record produce publish metrics.",
+ context);
+ return;
+ }
+
+ Attributes attributes = state.startAttributes().toBuilder().putAll(endAttributes).build();
+
+ publishDurationHistogram.record(
+ (endNanos - state.startTimeNanos()) / NANOS_PER_S, attributes, context);
+ }
+
+ @AutoValue
+ abstract static class State {
+
+ abstract Attributes startAttributes();
+
+ abstract long startTimeNanos();
+ }
+}
diff --git a/instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/http/HttpClientExperimentalMetricsTest.java b/instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/http/HttpClientExperimentalMetricsTest.java
index 9d8748ab61c4..b15b58f71df7 100644
--- a/instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/http/HttpClientExperimentalMetricsTest.java
+++ b/instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/http/HttpClientExperimentalMetricsTest.java
@@ -83,7 +83,7 @@ void collectsMetrics() {
.satisfiesExactlyInAnyOrder(
metric ->
assertThat(metric)
- .hasName("http.client.request.size")
+ .hasName("http.client.request.body.size")
.hasUnit("By")
.hasDescription("Size of HTTP client request bodies.")
.hasHistogramSatisfying(
@@ -109,7 +109,7 @@ void collectsMetrics() {
.hasSpanId("090a0b0c0d0e0f00")))),
metric ->
assertThat(metric)
- .hasName("http.client.response.size")
+ .hasName("http.client.response.body.size")
.hasUnit("By")
.hasDescription("Size of HTTP client response bodies.")
.hasHistogramSatisfying(
@@ -140,13 +140,13 @@ void collectsMetrics() {
.satisfiesExactlyInAnyOrder(
metric ->
assertThat(metric)
- .hasName("http.client.request.size")
+ .hasName("http.client.request.body.size")
.hasHistogramSatisfying(
histogram ->
histogram.hasPointsSatisfying(point -> point.hasSum(200 /* bytes */))),
metric ->
assertThat(metric)
- .hasName("http.client.response.size")
+ .hasName("http.client.response.body.size")
.hasHistogramSatisfying(
histogram ->
histogram.hasPointsSatisfying(point -> point.hasSum(400 /* bytes */))));
diff --git a/instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/http/HttpServerExperimentalMetricsTest.java b/instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/http/HttpServerExperimentalMetricsTest.java
index 95cc458ab13a..13796304b236 100644
--- a/instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/http/HttpServerExperimentalMetricsTest.java
+++ b/instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/http/HttpServerExperimentalMetricsTest.java
@@ -147,7 +147,7 @@ void collectsMetrics() {
.hasSpanId(spanContext1.getSpanId())))),
metric ->
assertThat(metric)
- .hasName("http.server.request.size")
+ .hasName("http.server.request.body.size")
.hasUnit("By")
.hasDescription("Size of HTTP server request bodies.")
.hasHistogramSatisfying(
@@ -172,7 +172,7 @@ void collectsMetrics() {
.hasSpanId(spanContext1.getSpanId())))),
metric ->
assertThat(metric)
- .hasName("http.server.response.size")
+ .hasName("http.server.response.body.size")
.hasUnit("By")
.hasDescription("Size of HTTP server response bodies.")
.hasHistogramSatisfying(
@@ -216,7 +216,7 @@ void collectsMetrics() {
.hasSpanId(spanContext2.getSpanId())))),
metric ->
assertThat(metric)
- .hasName("http.server.request.size")
+ .hasName("http.server.request.body.size")
.hasHistogramSatisfying(
histogram ->
histogram.hasPointsSatisfying(
@@ -230,7 +230,7 @@ void collectsMetrics() {
.hasSpanId(spanContext2.getSpanId())))),
metric ->
assertThat(metric)
- .hasName("http.server.response.size")
+ .hasName("http.server.response.body.size")
.hasHistogramSatisfying(
histogram ->
histogram.hasPointsSatisfying(
diff --git a/instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingProducerMetricsTest.java b/instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingProducerMetricsTest.java
new file mode 100644
index 000000000000..491387253ee9
--- /dev/null
+++ b/instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingProducerMetricsTest.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package io.opentelemetry.instrumentation.api.incubator.semconv.messaging;
+
+import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import io.opentelemetry.api.common.Attributes;
+import io.opentelemetry.api.trace.Span;
+import io.opentelemetry.api.trace.SpanContext;
+import io.opentelemetry.api.trace.TraceFlags;
+import io.opentelemetry.api.trace.TraceState;
+import io.opentelemetry.context.Context;
+import io.opentelemetry.instrumentation.api.instrumenter.OperationListener;
+import io.opentelemetry.sdk.metrics.SdkMeterProvider;
+import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions;
+import io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader;
+import io.opentelemetry.semconv.ServerAttributes;
+import io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes;
+import java.util.concurrent.TimeUnit;
+import org.junit.jupiter.api.Test;
+
+class MessagingProducerMetricsTest {
+
+ private static final double[] DURATION_BUCKETS =
+ MessagingMetricsAdvice.DURATION_SECONDS_BUCKETS.stream().mapToDouble(d -> d).toArray();
+
+ @Test
+ void collectsMetrics() {
+ InMemoryMetricReader metricReader = InMemoryMetricReader.create();
+ SdkMeterProvider meterProvider =
+ SdkMeterProvider.builder().registerMetricReader(metricReader).build();
+
+ OperationListener listener = MessagingProducerMetrics.get().create(meterProvider.get("test"));
+
+ Attributes requestAttributes =
+ Attributes.builder()
+ .put(MessagingIncubatingAttributes.MESSAGING_SYSTEM, "pulsar")
+ .put(
+ MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME,
+ "persistent://public/default/topic")
+ .put(MessagingIncubatingAttributes.MESSAGING_OPERATION, "publish")
+ .put(ServerAttributes.SERVER_PORT, 6650)
+ .put(ServerAttributes.SERVER_ADDRESS, "localhost")
+ .build();
+
+ Attributes responseAttributes =
+ Attributes.builder()
+ .put(MessagingIncubatingAttributes.MESSAGING_MESSAGE_ID, "1:1:0:0")
+ .put(MessagingIncubatingAttributes.MESSAGING_BATCH_MESSAGE_COUNT, 2)
+ .build();
+
+ Context parent =
+ Context.root()
+ .with(
+ Span.wrap(
+ SpanContext.create(
+ "ff01020304050600ff0a0b0c0d0e0f00",
+ "090a0b0c0d0e0f00",
+ TraceFlags.getSampled(),
+ TraceState.getDefault())));
+
+ Context context1 = listener.onStart(parent, requestAttributes, nanos(100));
+
+ assertThat(metricReader.collectAllMetrics()).isEmpty();
+
+ Context context2 = listener.onStart(Context.root(), requestAttributes, nanos(150));
+
+ assertThat(metricReader.collectAllMetrics()).isEmpty();
+
+ listener.onEnd(context1, responseAttributes, nanos(250));
+
+ assertThat(metricReader.collectAllMetrics())
+ .satisfiesExactlyInAnyOrder(
+ metric ->
+ OpenTelemetryAssertions.assertThat(metric)
+ .hasName("messaging.publish.duration")
+ .hasUnit("s")
+ .hasDescription("Measures the duration of publish operation.")
+ .hasHistogramSatisfying(
+ histogram ->
+ histogram.hasPointsSatisfying(
+ point ->
+ point
+ .hasSum(0.15 /* seconds */)
+ .hasAttributesSatisfying(
+ equalTo(
+ MessagingIncubatingAttributes.MESSAGING_SYSTEM,
+ "pulsar"),
+ equalTo(
+ MessagingIncubatingAttributes
+ .MESSAGING_DESTINATION_NAME,
+ "persistent://public/default/topic"),
+ equalTo(ServerAttributes.SERVER_PORT, 6650),
+ equalTo(ServerAttributes.SERVER_ADDRESS, "localhost"))
+ .hasExemplarsSatisfying(
+ exemplar ->
+ exemplar
+ .hasTraceId("ff01020304050600ff0a0b0c0d0e0f00")
+ .hasSpanId("090a0b0c0d0e0f00"))
+ .hasBucketBoundaries(DURATION_BUCKETS))));
+
+ listener.onEnd(context2, responseAttributes, nanos(300));
+
+ assertThat(metricReader.collectAllMetrics())
+ .satisfiesExactlyInAnyOrder(
+ metric ->
+ OpenTelemetryAssertions.assertThat(metric)
+ .hasName("messaging.publish.duration")
+ .hasHistogramSatisfying(
+ histogram ->
+ histogram.hasPointsSatisfying(
+ point -> point.hasSum(0.3 /* seconds */))));
+ }
+
+ private static long nanos(int millis) {
+ return TimeUnit.MILLISECONDS.toNanos(millis);
+ }
+}
diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/Instrumenter.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/Instrumenter.java
index cee163f4a12e..a51990317067 100644
--- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/Instrumenter.java
+++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/Instrumenter.java
@@ -11,6 +11,7 @@
import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.api.trace.Tracer;
import io.opentelemetry.context.Context;
+import io.opentelemetry.context.ContextKey;
import io.opentelemetry.instrumentation.api.internal.HttpRouteState;
import io.opentelemetry.instrumentation.api.internal.InstrumenterAccess;
import io.opentelemetry.instrumentation.api.internal.InstrumenterUtil;
@@ -41,6 +42,9 @@
*/
public class Instrumenter {
+ private static final ContextKey START_OPERATION_LISTENERS =
+ ContextKey.named("instrumenter-start-operation-listeners");
+
/**
* Returns a new {@link InstrumenterBuilder}.
*
@@ -74,6 +78,7 @@ public static InstrumenterBuilder builder
private final ContextCustomizer super REQUEST>[] contextCustomizers;
private final OperationListener[] operationListeners;
private final ErrorCauseExtractor errorCauseExtractor;
+ private final boolean propagateOperationListenersToOnEnd;
private final boolean enabled;
private final SpanSuppressor spanSuppressor;
@@ -89,6 +94,7 @@ public static InstrumenterBuilder builder
this.contextCustomizers = builder.contextCustomizers.toArray(new ContextCustomizer[0]);
this.operationListeners = builder.buildOperationListeners().toArray(new OperationListener[0]);
this.errorCauseExtractor = builder.errorCauseExtractor;
+ this.propagateOperationListenersToOnEnd = builder.propagateOperationListenersToOnEnd;
this.enabled = builder.enabled;
this.spanSuppressor = builder.buildSpanSuppressor();
}
@@ -198,6 +204,15 @@ private Context doStart(Context parentContext, REQUEST request, @Nullable Instan
context = operationListeners[i].onStart(context, attributes, startNanos);
}
}
+ if (propagateOperationListenersToOnEnd || context.get(START_OPERATION_LISTENERS) != null) {
+ // when start and end are not called on the same instrumenter we need to use the operation
+ // listeners that were used during start in end to correctly handle metrics like
+ // http.server.active_requests that is recorded both in start and end
+ //
+ // need to also add when there is already START_OPERATION_LISTENERS, otherwise this
+ // instrumenter will call its parent's operation listeners in doEnd
+ context = context.with(START_OPERATION_LISTENERS, operationListeners);
+ }
if (localRoot) {
context = LocalRootSpan.store(context, span);
@@ -228,6 +243,10 @@ private void doEnd(
}
span.setAllAttributes(attributes);
+ OperationListener[] operationListeners = context.get(START_OPERATION_LISTENERS);
+ if (operationListeners == null) {
+ operationListeners = this.operationListeners;
+ }
if (operationListeners.length != 0) {
long endNanos = getNanos(endTime);
for (int i = operationListeners.length - 1; i >= 0; i--) {
diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java
index 8c68cd0890d4..6b41ae6c60ab 100644
--- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java
+++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java
@@ -66,6 +66,7 @@ public final class InstrumenterBuilder {
SpanStatusExtractor super REQUEST, ? super RESPONSE> spanStatusExtractor =
SpanStatusExtractor.getDefault();
ErrorCauseExtractor errorCauseExtractor = ErrorCauseExtractor.getDefault();
+ boolean propagateOperationListenersToOnEnd = false;
boolean enabled = true;
InstrumenterBuilder(
@@ -370,6 +371,10 @@ private Set getSpanKeysFromAttributesExtractors() {
.collect(Collectors.toSet());
}
+ private void propagateOperationListenersToOnEnd() {
+ propagateOperationListenersToOnEnd = true;
+ }
+
private interface InstrumenterConstructor {
Instrumenter create(InstrumenterBuilder builder);
@@ -406,6 +411,12 @@ public Instrumenter buildDownstreamInstrumenter(
SpanKindExtractor spanKindExtractor) {
return builder.buildDownstreamInstrumenter(setter, spanKindExtractor);
}
+
+ @Override
+ public void propagateOperationListenersToOnEnd(
+ InstrumenterBuilder builder) {
+ builder.propagateOperationListenersToOnEnd();
+ }
});
}
}
diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/internal/InstrumenterBuilderAccess.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/internal/InstrumenterBuilderAccess.java
index d8c40af3e47a..2c660577b17c 100644
--- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/internal/InstrumenterBuilderAccess.java
+++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/internal/InstrumenterBuilderAccess.java
@@ -26,4 +26,7 @@ Instrumenter buildDownstreamInstrumenter(
InstrumenterBuilder builder,
TextMapSetter setter,
SpanKindExtractor spanKindExtractor);
+
+ void propagateOperationListenersToOnEnd(
+ InstrumenterBuilder builder);
}
diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/internal/InstrumenterUtil.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/internal/InstrumenterUtil.java
index 24648b4b2fb6..d61a6e8fe367 100644
--- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/internal/InstrumenterUtil.java
+++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/internal/InstrumenterUtil.java
@@ -67,5 +67,11 @@ public static Instrumenter buildDownstrea
builder, setter, spanKindExtractor);
}
+ public static void propagateOperationListenersToOnEnd(
+ InstrumenterBuilder builder) {
+ // instrumenterBuilderAccess is guaranteed to be non-null here
+ instrumenterBuilderAccess.propagateOperationListenersToOnEnd(builder);
+ }
+
private InstrumenterUtil() {}
}
diff --git a/instrumentation/akka/akka-http-10.0/javaagent/build.gradle.kts b/instrumentation/akka/akka-http-10.0/javaagent/build.gradle.kts
index 0c4f96c18022..ff1e6c9cccfc 100644
--- a/instrumentation/akka/akka-http-10.0/javaagent/build.gradle.kts
+++ b/instrumentation/akka/akka-http-10.0/javaagent/build.gradle.kts
@@ -42,6 +42,22 @@ dependencies {
latestDepTestLibrary("com.typesafe.akka:akka-stream_2.13:+")
}
+testing {
+ suites {
+ val javaRouteTest by registering(JvmTestSuite::class) {
+ dependencies {
+ if (findProperty("testLatestDeps") as Boolean) {
+ implementation("com.typesafe.akka:akka-http_2.13:+")
+ implementation("com.typesafe.akka:akka-stream_2.13:+")
+ } else {
+ implementation("com.typesafe.akka:akka-http_2.12:10.2.0")
+ implementation("com.typesafe.akka:akka-stream_2.12:2.6.21")
+ }
+ }
+ }
+ }
+}
+
tasks {
withType().configureEach {
// required on jdk17
@@ -52,6 +68,10 @@ tasks {
systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
}
+
+ check {
+ dependsOn(testing.suites)
+ }
}
if (findProperty("testLatestDeps") as Boolean) {
diff --git a/instrumentation/akka/akka-http-10.0/javaagent/src/javaRouteTest/java/io/opentelemetry/javaagent/instrumentation/akkahttp/AkkaHttpServerJavaRouteTest.java b/instrumentation/akka/akka-http-10.0/javaagent/src/javaRouteTest/java/io/opentelemetry/javaagent/instrumentation/akkahttp/AkkaHttpServerJavaRouteTest.java
new file mode 100644
index 000000000000..be1357c8d9bf
--- /dev/null
+++ b/instrumentation/akka/akka-http-10.0/javaagent/src/javaRouteTest/java/io/opentelemetry/javaagent/instrumentation/akkahttp/AkkaHttpServerJavaRouteTest.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package io.opentelemetry.javaagent.instrumentation.akkahttp;
+
+import static akka.http.javadsl.server.PathMatchers.integerSegment;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import akka.actor.ActorSystem;
+import akka.http.javadsl.Http;
+import akka.http.javadsl.ServerBinding;
+import akka.http.javadsl.server.AllDirectives;
+import akka.http.javadsl.server.Route;
+import io.opentelemetry.instrumentation.test.utils.PortUtils;
+import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
+import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
+import io.opentelemetry.testing.internal.armeria.client.WebClient;
+import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpRequest;
+import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpResponse;
+import io.opentelemetry.testing.internal.armeria.common.HttpMethod;
+import java.util.concurrent.CompletionStage;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+class AkkaHttpServerJavaRouteTest extends AllDirectives {
+ @RegisterExtension
+ private static final InstrumentationExtension testing = AgentInstrumentationExtension.create();
+
+ private final WebClient client = WebClient.of();
+
+ @Test
+ void testRoute() {
+ ActorSystem system = ActorSystem.create("my-system");
+ int port = PortUtils.findOpenPort();
+ Http http = Http.get(system);
+
+ Route route =
+ concat(
+ pathEndOrSingleSlash(() -> complete("root")),
+ pathPrefix(
+ "test",
+ () ->
+ concat(
+ pathSingleSlash(() -> complete("test")),
+ path(integerSegment(), (i) -> complete("ok")))));
+
+ CompletionStage binding = http.newServerAt("localhost", port).bind(route);
+ try {
+ AggregatedHttpRequest request =
+ AggregatedHttpRequest.of(HttpMethod.GET, "h1c://localhost:" + port + "/test/1");
+ AggregatedHttpResponse response = client.execute(request).aggregate().join();
+
+ assertThat(response.status().code()).isEqualTo(200);
+ assertThat(response.contentUtf8()).isEqualTo("ok");
+
+ testing.waitAndAssertTraces(
+ trace -> trace.hasSpansSatisfyingExactly(span -> span.hasName("GET /test/*")));
+ } finally {
+ binding.thenCompose(ServerBinding::unbind).thenAccept(unbound -> system.terminate());
+ }
+ }
+}
diff --git a/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/client/AkkaHttpClientSingletons.java b/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/client/AkkaHttpClientSingletons.java
index feac2dac6281..aa20eeec9f93 100644
--- a/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/client/AkkaHttpClientSingletons.java
+++ b/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/client/AkkaHttpClientSingletons.java
@@ -8,17 +8,8 @@
import akka.http.scaladsl.model.HttpRequest;
import akka.http.scaladsl.model.HttpResponse;
import io.opentelemetry.api.GlobalOpenTelemetry;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientExperimentalMetrics;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientPeerServiceAttributesExtractor;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpExperimentalAttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
-import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder;
-import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientMetrics;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor;
-import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig;
+import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenters;
import io.opentelemetry.javaagent.instrumentation.akkahttp.AkkaHttpUtil;
public class AkkaHttpClientSingletons {
@@ -28,31 +19,9 @@ public class AkkaHttpClientSingletons {
static {
SETTER = new HttpHeaderSetter(GlobalOpenTelemetry.getPropagators());
- AkkaHttpClientAttributesGetter httpAttributesGetter = new AkkaHttpClientAttributesGetter();
- InstrumenterBuilder builder =
- Instrumenter.builder(
- GlobalOpenTelemetry.get(),
- AkkaHttpUtil.instrumentationName(),
- HttpSpanNameExtractor.builder(httpAttributesGetter)
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
- .build())
- .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter))
- .addAttributesExtractor(
- HttpClientAttributesExtractor.builder(httpAttributesGetter)
- .setCapturedRequestHeaders(CommonConfig.get().getClientRequestHeaders())
- .setCapturedResponseHeaders(CommonConfig.get().getClientResponseHeaders())
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
- .build())
- .addAttributesExtractor(
- HttpClientPeerServiceAttributesExtractor.create(
- httpAttributesGetter, CommonConfig.get().getPeerServiceResolver()))
- .addOperationMetrics(HttpClientMetrics.get());
- if (CommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()) {
- builder
- .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter))
- .addOperationMetrics(HttpClientExperimentalMetrics.get());
- }
- INSTRUMENTER = builder.buildInstrumenter(SpanKindExtractor.alwaysClient());
+ INSTRUMENTER =
+ JavaagentHttpClientInstrumenters.create(
+ AkkaHttpUtil.instrumentationName(), new AkkaHttpClientAttributesGetter());
}
public static Instrumenter instrumenter() {
diff --git a/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/AkkaHttpServerSingletons.java b/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/AkkaHttpServerSingletons.java
index 71338fca4212..af0a3d61da82 100644
--- a/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/AkkaHttpServerSingletons.java
+++ b/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/AkkaHttpServerSingletons.java
@@ -17,7 +17,7 @@
import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRoute;
import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor;
import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor;
-import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig;
+import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig;
import io.opentelemetry.javaagent.instrumentation.akkahttp.AkkaHttpUtil;
public final class AkkaHttpServerSingletons {
@@ -31,21 +31,21 @@ public final class AkkaHttpServerSingletons {
GlobalOpenTelemetry.get(),
AkkaHttpUtil.instrumentationName(),
HttpSpanNameExtractor.builder(httpAttributesGetter)
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
+ .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods())
.build())
.setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter))
.addAttributesExtractor(
HttpServerAttributesExtractor.builder(httpAttributesGetter)
- .setCapturedRequestHeaders(CommonConfig.get().getServerRequestHeaders())
- .setCapturedResponseHeaders(CommonConfig.get().getServerResponseHeaders())
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
+ .setCapturedRequestHeaders(AgentCommonConfig.get().getServerRequestHeaders())
+ .setCapturedResponseHeaders(AgentCommonConfig.get().getServerResponseHeaders())
+ .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods())
.build())
.addOperationMetrics(HttpServerMetrics.get())
.addContextCustomizer(
HttpServerRoute.builder(httpAttributesGetter)
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
+ .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods())
.build());
- if (CommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) {
+ if (AgentCommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) {
builder
.addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter))
.addOperationMetrics(HttpServerExperimentalMetrics.get());
diff --git a/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/route/AkkaRouteHolder.java b/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/route/AkkaRouteHolder.java
index 9fa98d8c2add..3f192e5c7d2c 100644
--- a/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/route/AkkaRouteHolder.java
+++ b/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/route/AkkaRouteHolder.java
@@ -19,7 +19,7 @@ public class AkkaRouteHolder implements ImplicitContextKeyed {
private static final ContextKey KEY = named("opentelemetry-akka-route");
private String route = "";
- private boolean newSegment;
+ private boolean newSegment = true;
private boolean endMatched;
private final Deque stack = new ArrayDeque<>();
@@ -70,6 +70,15 @@ public static void restore() {
}
}
+ // reset the state to when save was called
+ public static void reset() {
+ AkkaRouteHolder holder = Context.current().get(KEY);
+ if (holder != null) {
+ holder.route = holder.stack.peek();
+ holder.newSegment = true;
+ }
+ }
+
@Override
public Context storeInContext(Context context) {
return context.with(KEY, this);
diff --git a/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/route/RouteConcatenationInstrumentation.java b/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/route/RouteConcatenationInstrumentation.java
index de13aba9fb30..eb13f402bc1e 100644
--- a/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/route/RouteConcatenationInstrumentation.java
+++ b/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/route/RouteConcatenationInstrumentation.java
@@ -17,14 +17,26 @@ public class RouteConcatenationInstrumentation implements TypeInstrumentation {
@Override
public ElementMatcher typeMatcher() {
return namedOneOf(
+ // scala 2.11
"akka.http.scaladsl.server.RouteConcatenation$RouteWithConcatenation$$anonfun$$tilde$1",
+ // scala 2.12 and later
"akka.http.scaladsl.server.RouteConcatenation$RouteWithConcatenation");
}
@Override
public void transform(TypeTransformer transformer) {
transformer.applyAdviceToMethod(
- namedOneOf("apply", "$anonfun$$tilde$1"), this.getClass().getName() + "$ApplyAdvice");
+ namedOneOf(
+ // scala 2.11
+ "apply",
+ // scala 2.12 and later
+ "$anonfun$$tilde$1"),
+ this.getClass().getName() + "$ApplyAdvice");
+
+ // This advice seems to be only needed when defining routes with java dsl. Since java dsl tests
+ // use scala 2.12 we are going to skip instrumenting this for scala 2.11.
+ transformer.applyAdviceToMethod(
+ namedOneOf("$anonfun$$tilde$2"), this.getClass().getName() + "$Apply2Advice");
}
@SuppressWarnings("unused")
@@ -43,4 +55,13 @@ public static void onExit() {
AkkaRouteHolder.restore();
}
}
+
+ @SuppressWarnings("unused")
+ public static class Apply2Advice {
+
+ @Advice.OnMethodEnter(suppress = Throwable.class)
+ public static void onEnter() {
+ AkkaRouteHolder.reset();
+ }
+ }
}
diff --git a/instrumentation/akka/akka-http-10.0/javaagent/src/test/scala/io/opentelemetry/javaagent/instrumentation/akkahttp/AkkaHttpServerRouteTest.scala b/instrumentation/akka/akka-http-10.0/javaagent/src/test/scala/io/opentelemetry/javaagent/instrumentation/akkahttp/AkkaHttpServerRouteTest.scala
new file mode 100644
index 000000000000..3920c6aeb15e
--- /dev/null
+++ b/instrumentation/akka/akka-http-10.0/javaagent/src/test/scala/io/opentelemetry/javaagent/instrumentation/akkahttp/AkkaHttpServerRouteTest.scala
@@ -0,0 +1,113 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package io.opentelemetry.javaagent.instrumentation.akkahttp
+
+import akka.actor.ActorSystem
+import akka.http.scaladsl.Http
+import akka.http.scaladsl.server.Directives.{
+ IntNumber,
+ complete,
+ concat,
+ path,
+ pathEndOrSingleSlash,
+ pathPrefix,
+ pathSingleSlash
+}
+import akka.http.scaladsl.server.Route
+import akka.stream.ActorMaterializer
+import io.opentelemetry.instrumentation.test.utils.PortUtils
+import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension
+import io.opentelemetry.sdk.testing.assertj.{SpanDataAssert, TraceAssert}
+import io.opentelemetry.testing.internal.armeria.client.WebClient
+import io.opentelemetry.testing.internal.armeria.common.{
+ AggregatedHttpRequest,
+ HttpMethod
+}
+import org.assertj.core.api.Assertions.assertThat
+import org.junit.jupiter.api.{AfterAll, Test, TestInstance}
+import org.junit.jupiter.api.extension.RegisterExtension
+
+import java.net.{URI, URISyntaxException}
+import java.util.function.Consumer
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Await
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+class AkkaHttpServerRouteTest {
+ @RegisterExtension private val testing: AgentInstrumentationExtension =
+ AgentInstrumentationExtension.create
+ private val client: WebClient = WebClient.of()
+
+ implicit val system: ActorSystem = ActorSystem("my-system")
+ implicit val materializer: ActorMaterializer = ActorMaterializer()
+
+ private def buildAddress(port: Int): URI = try
+ new URI("http://localhost:" + port + "/")
+ catch {
+ case exception: URISyntaxException =>
+ throw new IllegalStateException(exception)
+ }
+
+ @Test def testSimple(): Unit = {
+ val route = path("test") {
+ complete("ok")
+ }
+
+ test(route, "/test", "GET /test")
+ }
+
+ @Test def testRoute(): Unit = {
+ val route = concat(
+ pathEndOrSingleSlash {
+ complete("root")
+ },
+ pathPrefix("test") {
+ concat(
+ pathSingleSlash {
+ complete("test")
+ },
+ path(IntNumber) { _ =>
+ complete("ok")
+ }
+ )
+ }
+ )
+
+ test(route, "/test/1", "GET /test/*")
+ }
+
+ def test(route: Route, path: String, spanName: String): Unit = {
+ val port = PortUtils.findOpenPort
+ val address: URI = buildAddress(port)
+ val binding =
+ Await.result(Http().bindAndHandle(route, "localhost", port), 10.seconds)
+ try {
+ val request = AggregatedHttpRequest.of(
+ HttpMethod.GET,
+ address.resolve(path).toString
+ )
+ val response = client.execute(request).aggregate.join
+ assertThat(response.status.code).isEqualTo(200)
+ assertThat(response.contentUtf8).isEqualTo("ok")
+
+ testing.waitAndAssertTraces(new Consumer[TraceAssert] {
+ override def accept(trace: TraceAssert): Unit =
+ trace.hasSpansSatisfyingExactly(new Consumer[SpanDataAssert] {
+ override def accept(span: SpanDataAssert): Unit = {
+ span.hasName(spanName)
+ }
+ })
+ })
+ } finally {
+ binding.unbind()
+ }
+ }
+
+ @AfterAll
+ def cleanUp(): Unit = {
+ system.terminate()
+ }
+}
diff --git a/instrumentation/apache-dubbo-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachedubbo/v2_7/OpenTelemetryFilter.java b/instrumentation/apache-dubbo-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachedubbo/v2_7/OpenTelemetryFilter.java
index 98f7306bfd56..550f469ad9df 100644
--- a/instrumentation/apache-dubbo-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachedubbo/v2_7/OpenTelemetryFilter.java
+++ b/instrumentation/apache-dubbo-2.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachedubbo/v2_7/OpenTelemetryFilter.java
@@ -9,7 +9,7 @@
import io.opentelemetry.instrumentation.apachedubbo.v2_7.DubboTelemetry;
import io.opentelemetry.instrumentation.apachedubbo.v2_7.internal.DubboClientNetworkAttributesGetter;
import io.opentelemetry.instrumentation.api.incubator.semconv.net.PeerServiceAttributesExtractor;
-import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig;
+import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.Filter;
import org.apache.dubbo.rpc.Invocation;
@@ -27,7 +27,7 @@ public OpenTelemetryFilter() {
.addAttributesExtractor(
PeerServiceAttributesExtractor.create(
new DubboClientNetworkAttributesGetter(),
- CommonConfig.get().getPeerServiceResolver()))
+ AgentCommonConfig.get().getPeerServiceResolver()))
.build()
.newFilter();
}
diff --git a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientSingletons.java b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientSingletons.java
index cc0605af1092..6a2af90f730e 100644
--- a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientSingletons.java
+++ b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientSingletons.java
@@ -5,17 +5,8 @@
package io.opentelemetry.javaagent.instrumentation.apachehttpasyncclient;
-import io.opentelemetry.api.GlobalOpenTelemetry;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientExperimentalMetrics;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientPeerServiceAttributesExtractor;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpExperimentalAttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
-import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientMetrics;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor;
-import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig;
+import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenters;
import org.apache.http.HttpResponse;
public final class ApacheHttpAsyncClientSingletons {
@@ -24,33 +15,11 @@ public final class ApacheHttpAsyncClientSingletons {
private static final Instrumenter INSTRUMENTER;
static {
- ApacheHttpAsyncClientHttpAttributesGetter httpAttributesGetter =
- new ApacheHttpAsyncClientHttpAttributesGetter();
-
- InstrumenterBuilder builder =
- Instrumenter.builder(
- GlobalOpenTelemetry.get(),
- INSTRUMENTATION_NAME,
- HttpSpanNameExtractor.builder(httpAttributesGetter)
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
- .build())
- .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter))
- .addAttributesExtractor(
- HttpClientAttributesExtractor.builder(httpAttributesGetter)
- .setCapturedRequestHeaders(CommonConfig.get().getClientRequestHeaders())
- .setCapturedResponseHeaders(CommonConfig.get().getClientResponseHeaders())
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
- .build())
- .addAttributesExtractor(
- HttpClientPeerServiceAttributesExtractor.create(
- httpAttributesGetter, CommonConfig.get().getPeerServiceResolver()))
- .addOperationMetrics(HttpClientMetrics.get());
- if (CommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()) {
- builder
- .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter))
- .addOperationMetrics(HttpClientExperimentalMetrics.get());
- }
- INSTRUMENTER = builder.buildClientInstrumenter(HttpHeaderSetter.INSTANCE);
+ INSTRUMENTER =
+ JavaagentHttpClientInstrumenters.create(
+ INSTRUMENTATION_NAME,
+ new ApacheHttpAsyncClientHttpAttributesGetter(),
+ HttpHeaderSetter.INSTANCE);
}
public static Instrumenter instrumenter() {
diff --git a/instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientSingletons.java b/instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientSingletons.java
index d54ca9c2f35b..ef8e120c78c9 100644
--- a/instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientSingletons.java
+++ b/instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientSingletons.java
@@ -5,17 +5,8 @@
package io.opentelemetry.javaagent.instrumentation.apachehttpclient.v2_0;
-import io.opentelemetry.api.GlobalOpenTelemetry;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientExperimentalMetrics;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientPeerServiceAttributesExtractor;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpExperimentalAttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
-import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientMetrics;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor;
-import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig;
+import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenters;
import org.apache.commons.httpclient.HttpMethod;
public final class ApacheHttpClientSingletons {
@@ -24,33 +15,11 @@ public final class ApacheHttpClientSingletons {
private static final Instrumenter INSTRUMENTER;
static {
- ApacheHttpClientHttpAttributesGetter httpAttributesGetter =
- new ApacheHttpClientHttpAttributesGetter();
-
- InstrumenterBuilder builder =
- Instrumenter.builder(
- GlobalOpenTelemetry.get(),
- INSTRUMENTATION_NAME,
- HttpSpanNameExtractor.builder(httpAttributesGetter)
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
- .build())
- .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter))
- .addAttributesExtractor(
- HttpClientAttributesExtractor.builder(httpAttributesGetter)
- .setCapturedRequestHeaders(CommonConfig.get().getClientRequestHeaders())
- .setCapturedResponseHeaders(CommonConfig.get().getClientResponseHeaders())
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
- .build())
- .addAttributesExtractor(
- HttpClientPeerServiceAttributesExtractor.create(
- httpAttributesGetter, CommonConfig.get().getPeerServiceResolver()))
- .addOperationMetrics(HttpClientMetrics.get());
- if (CommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()) {
- builder
- .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter))
- .addOperationMetrics(HttpClientExperimentalMetrics.get());
- }
- INSTRUMENTER = builder.buildClientInstrumenter(HttpHeaderSetter.INSTANCE);
+ INSTRUMENTER =
+ JavaagentHttpClientInstrumenters.create(
+ INSTRUMENTATION_NAME,
+ new ApacheHttpClientHttpAttributesGetter(),
+ HttpHeaderSetter.INSTANCE);
}
public static Instrumenter instrumenter() {
diff --git a/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientSingletons.java b/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientSingletons.java
index 146dd8f08727..a93209c3f42a 100644
--- a/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientSingletons.java
+++ b/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientSingletons.java
@@ -5,17 +5,8 @@
package io.opentelemetry.javaagent.instrumentation.apachehttpclient.v4_0;
-import io.opentelemetry.api.GlobalOpenTelemetry;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientExperimentalMetrics;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientPeerServiceAttributesExtractor;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpExperimentalAttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
-import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientMetrics;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor;
-import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig;
+import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenters;
import org.apache.http.HttpResponse;
public final class ApacheHttpClientSingletons {
@@ -24,33 +15,11 @@ public final class ApacheHttpClientSingletons {
private static final Instrumenter INSTRUMENTER;
static {
- ApacheHttpClientHttpAttributesGetter httpAttributesGetter =
- new ApacheHttpClientHttpAttributesGetter();
-
- InstrumenterBuilder builder =
- Instrumenter.builder(
- GlobalOpenTelemetry.get(),
- INSTRUMENTATION_NAME,
- HttpSpanNameExtractor.builder(httpAttributesGetter)
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
- .build())
- .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter))
- .addAttributesExtractor(
- HttpClientAttributesExtractor.builder(httpAttributesGetter)
- .setCapturedRequestHeaders(CommonConfig.get().getClientRequestHeaders())
- .setCapturedResponseHeaders(CommonConfig.get().getClientResponseHeaders())
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
- .build())
- .addAttributesExtractor(
- HttpClientPeerServiceAttributesExtractor.create(
- httpAttributesGetter, CommonConfig.get().getPeerServiceResolver()))
- .addOperationMetrics(HttpClientMetrics.get());
- if (CommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()) {
- builder
- .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter))
- .addOperationMetrics(HttpClientExperimentalMetrics.get());
- }
- INSTRUMENTER = builder.buildClientInstrumenter(HttpHeaderSetter.INSTANCE);
+ INSTRUMENTER =
+ JavaagentHttpClientInstrumenters.create(
+ INSTRUMENTATION_NAME,
+ new ApacheHttpClientHttpAttributesGetter(),
+ HttpHeaderSetter.INSTANCE);
}
public static Instrumenter instrumenter() {
diff --git a/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientTelemetryBuilder.java b/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientTelemetryBuilder.java
index daf0d8c6889e..3526ca01436a 100644
--- a/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientTelemetryBuilder.java
+++ b/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientTelemetryBuilder.java
@@ -7,20 +7,10 @@
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.api.OpenTelemetry;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientExperimentalMetrics;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpExperimentalAttributesExtractor;
+import io.opentelemetry.instrumentation.api.incubator.builder.internal.DefaultHttpClientInstrumenterBuilder;
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
-import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
-import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder;
-import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractor;
import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractorBuilder;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientMetrics;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractorBuilder;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor;
-import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
@@ -30,24 +20,12 @@
public final class ApacheHttpClientTelemetryBuilder {
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.apache-httpclient-4.3";
-
- private final OpenTelemetry openTelemetry;
-
- private final List>
- additionalExtractors = new ArrayList<>();
- private final HttpClientAttributesExtractorBuilder
- httpAttributesExtractorBuilder =
- HttpClientAttributesExtractor.builder(ApacheHttpClientHttpAttributesGetter.INSTANCE);
- private final HttpSpanNameExtractorBuilder httpSpanNameExtractorBuilder =
- HttpSpanNameExtractor.builder(ApacheHttpClientHttpAttributesGetter.INSTANCE);
- private Function<
- SpanNameExtractor,
- ? extends SpanNameExtractor super ApacheHttpClientRequest>>
- spanNameExtractorTransformer = Function.identity();
- private boolean emitExperimentalHttpClientMetrics = false;
+ private final DefaultHttpClientInstrumenterBuilder builder;
ApacheHttpClientTelemetryBuilder(OpenTelemetry openTelemetry) {
- this.openTelemetry = openTelemetry;
+ builder =
+ new DefaultHttpClientInstrumenterBuilder<>(
+ INSTRUMENTATION_NAME, openTelemetry, ApacheHttpClientHttpAttributesGetter.INSTANCE);
}
/**
@@ -58,7 +36,7 @@ public final class ApacheHttpClientTelemetryBuilder {
public ApacheHttpClientTelemetryBuilder addAttributeExtractor(
AttributesExtractor super ApacheHttpClientRequest, ? super HttpResponse>
attributesExtractor) {
- additionalExtractors.add(attributesExtractor);
+ builder.addAttributeExtractor(attributesExtractor);
return this;
}
@@ -69,7 +47,7 @@ public ApacheHttpClientTelemetryBuilder addAttributeExtractor(
*/
@CanIgnoreReturnValue
public ApacheHttpClientTelemetryBuilder setCapturedRequestHeaders(List requestHeaders) {
- httpAttributesExtractorBuilder.setCapturedRequestHeaders(requestHeaders);
+ builder.setCapturedRequestHeaders(requestHeaders);
return this;
}
@@ -80,7 +58,7 @@ public ApacheHttpClientTelemetryBuilder setCapturedRequestHeaders(List r
*/
@CanIgnoreReturnValue
public ApacheHttpClientTelemetryBuilder setCapturedResponseHeaders(List responseHeaders) {
- httpAttributesExtractorBuilder.setCapturedResponseHeaders(responseHeaders);
+ builder.setCapturedResponseHeaders(responseHeaders);
return this;
}
@@ -99,8 +77,7 @@ public ApacheHttpClientTelemetryBuilder setCapturedResponseHeaders(List
*/
@CanIgnoreReturnValue
public ApacheHttpClientTelemetryBuilder setKnownMethods(Set knownMethods) {
- httpAttributesExtractorBuilder.setKnownMethods(knownMethods);
- httpSpanNameExtractorBuilder.setKnownMethods(knownMethods);
+ builder.setKnownMethods(knownMethods);
return this;
}
@@ -113,7 +90,7 @@ public ApacheHttpClientTelemetryBuilder setKnownMethods(Set knownMethods
@CanIgnoreReturnValue
public ApacheHttpClientTelemetryBuilder setEmitExperimentalHttpClientMetrics(
boolean emitExperimentalHttpClientMetrics) {
- this.emitExperimentalHttpClientMetrics = emitExperimentalHttpClientMetrics;
+ builder.setEmitExperimentalHttpClientMetrics(emitExperimentalHttpClientMetrics);
return this;
}
@@ -124,7 +101,7 @@ public ApacheHttpClientTelemetryBuilder setSpanNameExtractor(
SpanNameExtractor,
? extends SpanNameExtractor super ApacheHttpClientRequest>>
spanNameExtractorTransformer) {
- this.spanNameExtractorTransformer = spanNameExtractorTransformer;
+ builder.setSpanNameExtractor(spanNameExtractorTransformer);
return this;
}
@@ -133,29 +110,7 @@ public ApacheHttpClientTelemetryBuilder setSpanNameExtractor(
* ApacheHttpClientTelemetryBuilder}.
*/
public ApacheHttpClientTelemetry build() {
- ApacheHttpClientHttpAttributesGetter httpAttributesGetter =
- ApacheHttpClientHttpAttributesGetter.INSTANCE;
- SpanNameExtractor super ApacheHttpClientRequest> spanNameExtractor =
- spanNameExtractorTransformer.apply(httpSpanNameExtractorBuilder.build());
-
- InstrumenterBuilder builder =
- Instrumenter.builder(
- openTelemetry, INSTRUMENTATION_NAME, spanNameExtractor)
- .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter))
- .addAttributesExtractor(httpAttributesExtractorBuilder.build())
- .addAttributesExtractors(additionalExtractors)
- .addOperationMetrics(HttpClientMetrics.get());
- if (emitExperimentalHttpClientMetrics) {
- builder
- .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter))
- .addOperationMetrics(HttpClientExperimentalMetrics.get());
- }
-
- Instrumenter instrumenter =
- builder
- // We manually inject because we need to inject internal requests for redirects.
- .buildInstrumenter(SpanKindExtractor.alwaysClient());
-
- return new ApacheHttpClientTelemetry(instrumenter, openTelemetry.getPropagators());
+ return new ApacheHttpClientTelemetry(
+ builder.build(), builder.getOpenTelemetry().getPropagators());
}
}
diff --git a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientSingletons.java b/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientSingletons.java
index 8f6ccbdd6a02..e1cc0a667cef 100644
--- a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientSingletons.java
+++ b/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientSingletons.java
@@ -5,17 +5,8 @@
package io.opentelemetry.javaagent.instrumentation.apachehttpclient.v5_0;
-import io.opentelemetry.api.GlobalOpenTelemetry;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientExperimentalMetrics;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientPeerServiceAttributesExtractor;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpExperimentalAttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
-import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientMetrics;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor;
-import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig;
+import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenters;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
@@ -25,33 +16,11 @@ public final class ApacheHttpClientSingletons {
private static final Instrumenter INSTRUMENTER;
static {
- ApacheHttpClientHttpAttributesGetter httpAttributesGetter =
- new ApacheHttpClientHttpAttributesGetter();
-
- InstrumenterBuilder builder =
- Instrumenter.builder(
- GlobalOpenTelemetry.get(),
- INSTRUMENTATION_NAME,
- HttpSpanNameExtractor.builder(httpAttributesGetter)
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
- .build())
- .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter))
- .addAttributesExtractor(
- HttpClientAttributesExtractor.builder(httpAttributesGetter)
- .setCapturedRequestHeaders(CommonConfig.get().getClientRequestHeaders())
- .setCapturedResponseHeaders(CommonConfig.get().getClientResponseHeaders())
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
- .build())
- .addAttributesExtractor(
- HttpClientPeerServiceAttributesExtractor.create(
- httpAttributesGetter, CommonConfig.get().getPeerServiceResolver()))
- .addOperationMetrics(HttpClientMetrics.get());
- if (CommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()) {
- builder
- .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter))
- .addOperationMetrics(HttpClientExperimentalMetrics.get());
- }
- INSTRUMENTER = builder.buildClientInstrumenter(HttpHeaderSetter.INSTANCE);
+ INSTRUMENTER =
+ JavaagentHttpClientInstrumenters.create(
+ INSTRUMENTATION_NAME,
+ new ApacheHttpClientHttpAttributesGetter(),
+ HttpHeaderSetter.INSTANCE);
}
public static Instrumenter instrumenter() {
diff --git a/instrumentation/apache-httpclient/apache-httpclient-5.2/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v5_2/ApacheHttpClient5TelemetryBuilder.java b/instrumentation/apache-httpclient/apache-httpclient-5.2/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v5_2/ApacheHttpClient5TelemetryBuilder.java
index 176555846849..e9a5eb273de0 100644
--- a/instrumentation/apache-httpclient/apache-httpclient-5.2/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v5_2/ApacheHttpClient5TelemetryBuilder.java
+++ b/instrumentation/apache-httpclient/apache-httpclient-5.2/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v5_2/ApacheHttpClient5TelemetryBuilder.java
@@ -7,20 +7,10 @@
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.api.OpenTelemetry;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientExperimentalMetrics;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpExperimentalAttributesExtractor;
+import io.opentelemetry.instrumentation.api.incubator.builder.internal.DefaultHttpClientInstrumenterBuilder;
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
-import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
-import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder;
-import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractor;
import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractorBuilder;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientMetrics;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractorBuilder;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor;
-import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
@@ -30,26 +20,13 @@
public final class ApacheHttpClient5TelemetryBuilder {
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.apache-httpclient-5.2";
-
- private final OpenTelemetry openTelemetry;
-
- private final List>
- additionalExtractors = new ArrayList<>();
- private final HttpClientAttributesExtractorBuilder
- httpAttributesExtractorBuilder =
- HttpClientAttributesExtractor.builder(ApacheHttpClient5HttpAttributesGetter.INSTANCE);
-
- private final HttpSpanNameExtractorBuilder
- httpSpanNameExtractorBuilder =
- HttpSpanNameExtractor.builder(ApacheHttpClient5HttpAttributesGetter.INSTANCE);
- private Function<
- SpanNameExtractor,
- ? extends SpanNameExtractor super ApacheHttpClient5Request>>
- spanNameExtractorTransformer = Function.identity();
- private boolean emitExperimentalHttpClientMetrics = false;
+ private final DefaultHttpClientInstrumenterBuilder
+ builder;
ApacheHttpClient5TelemetryBuilder(OpenTelemetry openTelemetry) {
- this.openTelemetry = openTelemetry;
+ builder =
+ new DefaultHttpClientInstrumenterBuilder<>(
+ INSTRUMENTATION_NAME, openTelemetry, ApacheHttpClient5HttpAttributesGetter.INSTANCE);
}
/**
@@ -60,7 +37,7 @@ public final class ApacheHttpClient5TelemetryBuilder {
public ApacheHttpClient5TelemetryBuilder addAttributeExtractor(
AttributesExtractor super ApacheHttpClient5Request, ? super HttpResponse>
attributesExtractor) {
- additionalExtractors.add(attributesExtractor);
+ builder.addAttributeExtractor(attributesExtractor);
return this;
}
@@ -71,7 +48,7 @@ public ApacheHttpClient5TelemetryBuilder addAttributeExtractor(
*/
@CanIgnoreReturnValue
public ApacheHttpClient5TelemetryBuilder setCapturedRequestHeaders(List requestHeaders) {
- httpAttributesExtractorBuilder.setCapturedRequestHeaders(requestHeaders);
+ builder.setCapturedRequestHeaders(requestHeaders);
return this;
}
@@ -83,7 +60,7 @@ public ApacheHttpClient5TelemetryBuilder setCapturedRequestHeaders(List
@CanIgnoreReturnValue
public ApacheHttpClient5TelemetryBuilder setCapturedResponseHeaders(
List responseHeaders) {
- httpAttributesExtractorBuilder.setCapturedResponseHeaders(responseHeaders);
+ builder.setCapturedResponseHeaders(responseHeaders);
return this;
}
@@ -102,8 +79,7 @@ public ApacheHttpClient5TelemetryBuilder setCapturedResponseHeaders(
*/
@CanIgnoreReturnValue
public ApacheHttpClient5TelemetryBuilder setKnownMethods(Set knownMethods) {
- httpAttributesExtractorBuilder.setKnownMethods(knownMethods);
- httpSpanNameExtractorBuilder.setKnownMethods(knownMethods);
+ builder.setKnownMethods(knownMethods);
return this;
}
@@ -116,7 +92,7 @@ public ApacheHttpClient5TelemetryBuilder setKnownMethods(Set knownMethod
@CanIgnoreReturnValue
public ApacheHttpClient5TelemetryBuilder setEmitExperimentalHttpClientMetrics(
boolean emitExperimentalHttpClientMetrics) {
- this.emitExperimentalHttpClientMetrics = emitExperimentalHttpClientMetrics;
+ builder.setEmitExperimentalHttpClientMetrics(emitExperimentalHttpClientMetrics);
return this;
}
@@ -127,7 +103,7 @@ public ApacheHttpClient5TelemetryBuilder setSpanNameExtractor(
SpanNameExtractor,
? extends SpanNameExtractor super ApacheHttpClient5Request>>
spanNameExtractorTransformer) {
- this.spanNameExtractorTransformer = spanNameExtractorTransformer;
+ builder.setSpanNameExtractor(spanNameExtractorTransformer);
return this;
}
@@ -136,29 +112,7 @@ public ApacheHttpClient5TelemetryBuilder setSpanNameExtractor(
* ApacheHttpClient5TelemetryBuilder}.
*/
public ApacheHttpClient5Telemetry build() {
- ApacheHttpClient5HttpAttributesGetter httpAttributesGetter =
- ApacheHttpClient5HttpAttributesGetter.INSTANCE;
- SpanNameExtractor super ApacheHttpClient5Request> spanNameExtractor =
- spanNameExtractorTransformer.apply(httpSpanNameExtractorBuilder.build());
-
- InstrumenterBuilder builder =
- Instrumenter.builder(
- openTelemetry, INSTRUMENTATION_NAME, spanNameExtractor)
- .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter))
- .addAttributesExtractor(httpAttributesExtractorBuilder.build())
- .addAttributesExtractors(additionalExtractors)
- .addOperationMetrics(HttpClientMetrics.get());
- if (emitExperimentalHttpClientMetrics) {
- builder
- .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter))
- .addOperationMetrics(HttpClientExperimentalMetrics.get());
- }
-
- Instrumenter instrumenter =
- builder
- // We manually inject because we need to inject internal requests for redirects.
- .buildInstrumenter(SpanKindExtractor.alwaysClient());
-
- return new ApacheHttpClient5Telemetry(instrumenter, openTelemetry.getPropagators());
+ return new ApacheHttpClient5Telemetry(
+ builder.build(), builder.getOpenTelemetry().getPropagators());
}
}
diff --git a/instrumentation/apache-shenyu-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheshenyu/v2_4/MetaDataHelper.java b/instrumentation/apache-shenyu-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheshenyu/v2_4/MetaDataHelper.java
index 15645b8ea6f7..4414e6eeb628 100644
--- a/instrumentation/apache-shenyu-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheshenyu/v2_4/MetaDataHelper.java
+++ b/instrumentation/apache-shenyu-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apacheshenyu/v2_4/MetaDataHelper.java
@@ -9,7 +9,7 @@
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.instrumenter.LocalRootSpan;
-import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig;
+import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig;
import org.apache.shenyu.common.dto.MetaData;
public final class MetaDataHelper {
@@ -58,7 +58,7 @@ public final class MetaDataHelper {
static {
CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES =
- InstrumentationConfig.get()
+ AgentInstrumentationConfig.get()
.getBoolean("otel.instrumentation.apache-shenyu.experimental-span-attributes", false);
}
diff --git a/instrumentation/armeria/armeria-1.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/armeria/v1_3/ArmeriaSingletons.java b/instrumentation/armeria/armeria-1.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/armeria/v1_3/ArmeriaSingletons.java
index 99a3b2c6c17f..8f4800ebca34 100644
--- a/instrumentation/armeria/armeria-1.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/armeria/v1_3/ArmeriaSingletons.java
+++ b/instrumentation/armeria/armeria-1.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/armeria/v1_3/ArmeriaSingletons.java
@@ -11,7 +11,7 @@
import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientPeerServiceAttributesExtractor;
import io.opentelemetry.instrumentation.armeria.v1_3.ArmeriaTelemetry;
import io.opentelemetry.instrumentation.armeria.v1_3.internal.ArmeriaHttpClientAttributesGetter;
-import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig;
+import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig;
import java.util.function.Function;
// Holds singleton references to decorators to match against during suppression.
@@ -24,19 +24,19 @@ public final class ArmeriaSingletons {
static {
ArmeriaTelemetry telemetry =
ArmeriaTelemetry.builder(GlobalOpenTelemetry.get())
- .setCapturedClientRequestHeaders(CommonConfig.get().getClientRequestHeaders())
- .setCapturedClientResponseHeaders(CommonConfig.get().getClientResponseHeaders())
- .setCapturedServerRequestHeaders(CommonConfig.get().getServerRequestHeaders())
- .setCapturedServerResponseHeaders(CommonConfig.get().getServerResponseHeaders())
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
+ .setCapturedClientRequestHeaders(AgentCommonConfig.get().getClientRequestHeaders())
+ .setCapturedClientResponseHeaders(AgentCommonConfig.get().getClientResponseHeaders())
+ .setCapturedServerRequestHeaders(AgentCommonConfig.get().getServerRequestHeaders())
+ .setCapturedServerResponseHeaders(AgentCommonConfig.get().getServerResponseHeaders())
+ .setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods())
.addClientAttributeExtractor(
HttpClientPeerServiceAttributesExtractor.create(
ArmeriaHttpClientAttributesGetter.INSTANCE,
- CommonConfig.get().getPeerServiceResolver()))
+ AgentCommonConfig.get().getPeerServiceResolver()))
.setEmitExperimentalHttpClientMetrics(
- CommonConfig.get().shouldEmitExperimentalHttpClientTelemetry())
+ AgentCommonConfig.get().shouldEmitExperimentalHttpClientTelemetry())
.setEmitExperimentalHttpServerMetrics(
- CommonConfig.get().shouldEmitExperimentalHttpServerTelemetry())
+ AgentCommonConfig.get().shouldEmitExperimentalHttpServerTelemetry())
.build();
CLIENT_DECORATOR = telemetry.newClientDecorator();
diff --git a/instrumentation/async-http-client/async-http-client-1.9/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v1_9/AsyncHttpClientSingletons.java b/instrumentation/async-http-client/async-http-client-1.9/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v1_9/AsyncHttpClientSingletons.java
index 7963e1d2b3d0..c886631a93cc 100644
--- a/instrumentation/async-http-client/async-http-client-1.9/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v1_9/AsyncHttpClientSingletons.java
+++ b/instrumentation/async-http-client/async-http-client-1.9/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v1_9/AsyncHttpClientSingletons.java
@@ -7,17 +7,8 @@
import com.ning.http.client.Request;
import com.ning.http.client.Response;
-import io.opentelemetry.api.GlobalOpenTelemetry;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientExperimentalMetrics;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientPeerServiceAttributesExtractor;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpExperimentalAttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
-import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientMetrics;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor;
-import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig;
+import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenters;
public final class AsyncHttpClientSingletons {
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.async-http-client-1.9";
@@ -25,33 +16,11 @@ public final class AsyncHttpClientSingletons {
private static final Instrumenter INSTRUMENTER;
static {
- AsyncHttpClientHttpAttributesGetter httpAttributesGetter =
- new AsyncHttpClientHttpAttributesGetter();
-
- InstrumenterBuilder builder =
- Instrumenter.builder(
- GlobalOpenTelemetry.get(),
- INSTRUMENTATION_NAME,
- HttpSpanNameExtractor.builder(httpAttributesGetter)
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
- .build())
- .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter))
- .addAttributesExtractor(
- HttpClientAttributesExtractor.builder(httpAttributesGetter)
- .setCapturedRequestHeaders(CommonConfig.get().getClientRequestHeaders())
- .setCapturedResponseHeaders(CommonConfig.get().getClientResponseHeaders())
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
- .build())
- .addAttributesExtractor(
- HttpClientPeerServiceAttributesExtractor.create(
- httpAttributesGetter, CommonConfig.get().getPeerServiceResolver()))
- .addOperationMetrics(HttpClientMetrics.get());
- if (CommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()) {
- builder
- .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter))
- .addOperationMetrics(HttpClientExperimentalMetrics.get());
- }
- INSTRUMENTER = builder.buildClientInstrumenter(HttpHeaderSetter.INSTANCE);
+ INSTRUMENTER =
+ JavaagentHttpClientInstrumenters.create(
+ INSTRUMENTATION_NAME,
+ new AsyncHttpClientHttpAttributesGetter(),
+ HttpHeaderSetter.INSTANCE);
}
public static Instrumenter instrumenter() {
diff --git a/instrumentation/async-http-client/async-http-client-2.0/javaagent/build.gradle.kts b/instrumentation/async-http-client/async-http-client-2.0/javaagent/build.gradle.kts
index 30b722110c08..9c573a0fd4ec 100644
--- a/instrumentation/async-http-client/async-http-client-2.0/javaagent/build.gradle.kts
+++ b/instrumentation/async-http-client/async-http-client-2.0/javaagent/build.gradle.kts
@@ -18,14 +18,32 @@ dependencies {
testInstrumentation(project(":instrumentation:netty:netty-4.1:javaagent"))
}
-otelJava {
- // AHC uses Unsafe and so does not run on later java version
- maxJavaVersionForTests.set(JavaVersion.VERSION_1_8)
+val latestDepTest = findProperty("testLatestDeps") as Boolean
+val testJavaVersion =
+ gradle.startParameter.projectProperties["testJavaVersion"]?.let(JavaVersion::toVersion)
+ ?: JavaVersion.current()
+
+if (!latestDepTest) {
+ otelJava {
+ // AHC uses Unsafe and so does not run on later java version
+ maxJavaVersionForTests.set(JavaVersion.VERSION_1_8)
+ }
+}
+
+tasks.withType().configureEach {
+ systemProperty("testLatestDeps", latestDepTest)
+ // async-http-client 3.0 requires java 11
+ // We are not using minJavaVersionSupported for latestDepTest because that way the instrumentation
+ // gets compiled with java 11 when running latestDepTest. This causes play-mvc-2.4 latest dep tests
+ // to fail because they require java 8 and instrumentation compiled with java 11 won't apply.
+ if (latestDepTest && testJavaVersion.isJava8) {
+ enabled = false
+ }
}
// async-http-client 2.0.0 does not work with Netty versions newer than this due to referencing an
// internal file.
-if (!(findProperty("testLatestDeps") as Boolean)) {
+if (!latestDepTest) {
configurations.configureEach {
if (!name.contains("muzzle")) {
resolutionStrategy {
diff --git a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientSingletons.java b/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientSingletons.java
index 56e8706a3317..2e140594f0bd 100644
--- a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientSingletons.java
+++ b/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientSingletons.java
@@ -5,17 +5,8 @@
package io.opentelemetry.javaagent.instrumentation.asynchttpclient.v2_0;
-import io.opentelemetry.api.GlobalOpenTelemetry;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientExperimentalMetrics;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientPeerServiceAttributesExtractor;
-import io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpExperimentalAttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
-import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpClientMetrics;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor;
-import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor;
-import io.opentelemetry.javaagent.bootstrap.internal.CommonConfig;
+import io.opentelemetry.javaagent.bootstrap.internal.JavaagentHttpClientInstrumenters;
import org.asynchttpclient.Response;
public final class AsyncHttpClientSingletons {
@@ -24,33 +15,11 @@ public final class AsyncHttpClientSingletons {
private static final Instrumenter INSTRUMENTER;
static {
- AsyncHttpClientHttpAttributesGetter httpAttributesGetter =
- new AsyncHttpClientHttpAttributesGetter();
-
- InstrumenterBuilder builder =
- Instrumenter.builder(
- GlobalOpenTelemetry.get(),
- INSTRUMENTATION_NAME,
- HttpSpanNameExtractor.builder(httpAttributesGetter)
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
- .build())
- .setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter))
- .addAttributesExtractor(
- HttpClientAttributesExtractor.builder(httpAttributesGetter)
- .setCapturedRequestHeaders(CommonConfig.get().getClientRequestHeaders())
- .setCapturedResponseHeaders(CommonConfig.get().getClientResponseHeaders())
- .setKnownMethods(CommonConfig.get().getKnownHttpRequestMethods())
- .build())
- .addAttributesExtractor(
- HttpClientPeerServiceAttributesExtractor.create(
- httpAttributesGetter, CommonConfig.get().getPeerServiceResolver()))
- .addOperationMetrics(HttpClientMetrics.get());
- if (CommonConfig.get().shouldEmitExperimentalHttpClientTelemetry()) {
- builder
- .addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter))
- .addOperationMetrics(HttpClientExperimentalMetrics.get());
- }
- INSTRUMENTER = builder.buildClientInstrumenter(HttpHeaderSetter.INSTANCE);
+ INSTRUMENTER =
+ JavaagentHttpClientInstrumenters.create(
+ INSTRUMENTATION_NAME,
+ new AsyncHttpClientHttpAttributesGetter(),
+ HttpHeaderSetter.INSTANCE);
}
public static Instrumenter instrumenter() {
diff --git a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientTest.java b/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientTest.java
index e8b25349aca9..6e968d6b9759 100644
--- a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientTest.java
+++ b/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientTest.java
@@ -10,11 +10,14 @@
import io.opentelemetry.instrumentation.testing.junit.http.HttpClientInstrumentationExtension;
import io.opentelemetry.instrumentation.testing.junit.http.HttpClientResult;
import io.opentelemetry.instrumentation.testing.junit.http.HttpClientTestOptions;
+import java.lang.reflect.Method;
import java.net.URI;
+import java.time.Duration;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import org.asynchttpclient.AsyncCompletionHandler;
import org.asynchttpclient.AsyncHttpClient;
+import org.asynchttpclient.DefaultAsyncHttpClientConfig;
import org.asynchttpclient.Dsl;
import org.asynchttpclient.Request;
import org.asynchttpclient.RequestBuilder;
@@ -31,11 +34,26 @@ class AsyncHttpClientTest extends AbstractHttpClientTest {
private static final int CONNECTION_TIMEOUT_MS = (int) CONNECTION_TIMEOUT.toMillis();
// request timeout is needed in addition to connect timeout on async-http-client versions 2.1.0+
- private static final AsyncHttpClient client =
- Dsl.asyncHttpClient(
- Dsl.config()
- .setConnectTimeout(CONNECTION_TIMEOUT_MS)
- .setRequestTimeout(CONNECTION_TIMEOUT_MS));
+ private static final AsyncHttpClient client = Dsl.asyncHttpClient(configureTimeout(Dsl.config()));
+
+ private static DefaultAsyncHttpClientConfig.Builder configureTimeout(
+ DefaultAsyncHttpClientConfig.Builder builder) {
+ setTimeout(builder, "setConnectTimeout", CONNECTION_TIMEOUT_MS);
+ setTimeout(builder, "setRequestTimeout", CONNECTION_TIMEOUT_MS);
+ return builder;
+ }
+
+ private static void setTimeout(
+ DefaultAsyncHttpClientConfig.Builder builder, String methodName, int timeout) {
+ boolean testLatestDeps = Boolean.getBoolean("testLatestDeps");
+ try {
+ Method method =
+ builder.getClass().getMethod(methodName, testLatestDeps ? Duration.class : int.class);
+ method.invoke(builder, testLatestDeps ? Duration.ofMillis(timeout) : timeout);
+ } catch (Exception exception) {
+ throw new IllegalStateException("Failed to set timeout " + methodName, exception);
+ }
+ }
@Override
public Request buildRequest(String method, URI uri, Map headers) {
diff --git a/instrumentation/aws-lambda/aws-lambda-core-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambdacore/v1_0/TracingRequestStreamHandler.java b/instrumentation/aws-lambda/aws-lambda-core-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambdacore/v1_0/TracingRequestStreamHandler.java
index fced56818f52..ae6a42bd6de4 100644
--- a/instrumentation/aws-lambda/aws-lambda-core-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambdacore/v1_0/TracingRequestStreamHandler.java
+++ b/instrumentation/aws-lambda/aws-lambda-core-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambdacore/v1_0/TracingRequestStreamHandler.java
@@ -7,6 +7,7 @@
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestStreamHandler;
+import io.opentelemetry.api.trace.Span;
import io.opentelemetry.context.Scope;
import io.opentelemetry.instrumentation.awslambdacore.v1_0.internal.ApiGatewayProxyRequest;
import io.opentelemetry.instrumentation.awslambdacore.v1_0.internal.AwsLambdaFunctionInstrumenter;
@@ -67,49 +68,55 @@ protected TracingRequestStreamHandler(
@Override
public void handleRequest(InputStream input, OutputStream output, Context context)
throws IOException {
-
ApiGatewayProxyRequest proxyRequest = ApiGatewayProxyRequest.forStream(input);
- AwsLambdaRequest request =
- AwsLambdaRequest.create(context, proxyRequest, proxyRequest.getHeaders());
+ AwsLambdaRequest request = createRequest(input, context, proxyRequest);
io.opentelemetry.context.Context parentContext = instrumenter.extract(request);
if (!instrumenter.shouldStart(parentContext, request)) {
- doHandleRequest(proxyRequest.freshStream(), output, context);
+ doHandleRequest(proxyRequest.freshStream(), output, context, request);
return;
}
io.opentelemetry.context.Context otelContext = instrumenter.start(parentContext, request);
+ Throwable error = null;
try (Scope ignored = otelContext.makeCurrent()) {
doHandleRequest(
proxyRequest.freshStream(),
- new OutputStreamWrapper(output, otelContext, request, openTelemetrySdk),
- context);
+ new OutputStreamWrapper(output, otelContext),
+ context,
+ request);
} catch (Throwable t) {
- instrumenter.end(otelContext, request, null, t);
- LambdaUtils.forceFlush(openTelemetrySdk, flushTimeoutNanos, TimeUnit.NANOSECONDS);
+ error = t;
throw t;
+ } finally {
+ instrumenter.end(otelContext, request, null, error);
+ LambdaUtils.forceFlush(openTelemetrySdk, flushTimeoutNanos, TimeUnit.NANOSECONDS);
}
}
+ protected AwsLambdaRequest createRequest(
+ InputStream input, Context context, ApiGatewayProxyRequest proxyRequest) throws IOException {
+ return AwsLambdaRequest.create(context, proxyRequest, proxyRequest.getHeaders());
+ }
+
+ protected void doHandleRequest(
+ InputStream input, OutputStream output, Context context, AwsLambdaRequest request)
+ throws IOException {
+ doHandleRequest(input, output, context);
+ }
+
protected abstract void doHandleRequest(InputStream input, OutputStream output, Context context)
throws IOException;
- private class OutputStreamWrapper extends OutputStream {
+ private static class OutputStreamWrapper extends OutputStream {
private final OutputStream delegate;
private final io.opentelemetry.context.Context otelContext;
- private final AwsLambdaRequest request;
- private final OpenTelemetrySdk openTelemetrySdk;
private OutputStreamWrapper(
- OutputStream delegate,
- io.opentelemetry.context.Context otelContext,
- AwsLambdaRequest request,
- OpenTelemetrySdk openTelemetrySdk) {
+ OutputStream delegate, io.opentelemetry.context.Context otelContext) {
this.delegate = delegate;
this.otelContext = otelContext;
- this.request = request;
- this.openTelemetrySdk = openTelemetrySdk;
}
@Override
@@ -135,8 +142,8 @@ public void flush() throws IOException {
@Override
public void close() throws IOException {
delegate.close();
- instrumenter.end(otelContext, request, null, null);
- LambdaUtils.forceFlush(openTelemetrySdk, flushTimeoutNanos, TimeUnit.NANOSECONDS);
+ Span span = Span.fromContext(otelContext);
+ span.addEvent("Output stream closed");
}
}
}
diff --git a/instrumentation/aws-lambda/aws-lambda-core-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambdacore/v1_0/TracingRequestStreamWrapper.java b/instrumentation/aws-lambda/aws-lambda-core-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambdacore/v1_0/TracingRequestStreamWrapper.java
index 18ceb38cbf1b..d20564ffc805 100644
--- a/instrumentation/aws-lambda/aws-lambda-core-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambdacore/v1_0/TracingRequestStreamWrapper.java
+++ b/instrumentation/aws-lambda/aws-lambda-core-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambdacore/v1_0/TracingRequestStreamWrapper.java
@@ -23,7 +23,7 @@
*/
public class TracingRequestStreamWrapper extends TracingRequestStreamHandler {
- private final WrappedLambda wrappedLambda;
+ protected final WrappedLambda wrappedLambda;
public TracingRequestStreamWrapper() {
this(
@@ -32,7 +32,8 @@ public TracingRequestStreamWrapper() {
}
// Visible for testing
- TracingRequestStreamWrapper(OpenTelemetrySdk openTelemetrySdk, WrappedLambda wrappedLambda) {
+ protected TracingRequestStreamWrapper(
+ OpenTelemetrySdk openTelemetrySdk, WrappedLambda wrappedLambda) {
super(openTelemetrySdk, WrapperConfiguration.flushTimeout());
this.wrappedLambda = wrappedLambda;
}
diff --git a/instrumentation/aws-lambda/aws-lambda-core-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambdacore/v1_0/internal/AwsLambdaFunctionInstrumenter.java b/instrumentation/aws-lambda/aws-lambda-core-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambdacore/v1_0/internal/AwsLambdaFunctionInstrumenter.java
index 4136e7bed954..9341bf6f79dc 100644
--- a/instrumentation/aws-lambda/aws-lambda-core-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambdacore/v1_0/internal/AwsLambdaFunctionInstrumenter.java
+++ b/instrumentation/aws-lambda/aws-lambda-core-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambdacore/v1_0/internal/AwsLambdaFunctionInstrumenter.java
@@ -11,6 +11,7 @@
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.instrumentation.api.internal.ContextPropagationDebug;
import io.opentelemetry.instrumentation.awslambdacore.v1_0.AwsLambdaRequest;
+import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.annotation.Nullable;
@@ -48,11 +49,20 @@ public void end(
public Context extract(AwsLambdaRequest input) {
ContextPropagationDebug.debugContextLeakIfEnabled();
+ // Look in both the http headers and the custom client context
+ Map headers = input.getHeaders();
+ if (input.getAwsContext() != null && input.getAwsContext().getClientContext() != null) {
+ Map customContext = input.getAwsContext().getClientContext().getCustom();
+ if (customContext != null) {
+ headers = new HashMap<>(headers);
+ headers.putAll(customContext);
+ }
+ }
return openTelemetry
.getPropagators()
.getTextMapPropagator()
- .extract(Context.root(), input.getHeaders(), MapGetter.INSTANCE);
+ .extract(Context.root(), headers, MapGetter.INSTANCE);
}
private enum MapGetter implements TextMapGetter