Auto-update OTel SDK
MODIFY
.github/dependabot.yml
.github/dependabot.yml
@@ -17,6 +17,9 @@ updates:
registries:
- gradle-plugin-portal
ignore:
+ - dependency-name: "io.opentelemetry:*"
+ # OpenTelemetry SDK updates are handled by auto-update-otel-sdk.yml
+ versions: [ "(,)" ]
- dependency-name: "ch.qos.logback:logback-classic"
# logback 1.4+ requires Java 11
versions: [ "[1.4,)" ]

ADD
.github/scripts/update-sdk-version.sh
+#!/bin/bash -e
+
+version=$1
+
+sed -Ei "s/val otelSdkVersion = \"[^\"]*\"/val otelSdkVersion = \"$version\"/" dependencyManagement/build.gradle.kts
+
+sed -Ei "s/(opentelemetrySdk *: )\"[^\"]*\"/\1\"$version\"/" examples/distro/build.gradle
+
+sed -Ei "s/(opentelemetrySdk *: )\"[^\"]*\"/\1\"$version\"/" examples/extension/build.gradle

ADD
.github/workflows/auto-update-otel-sdk.yml
+name: Auto-update OpenTelemetry SDK
+
+on:
+ schedule:
+ # hourly at minute 46
+ - cron: "46 * * * *"
+ workflow_dispatch:
+
+jobs:
+ check-versions:
+ runs-on: ubuntu-latest
+ outputs:
+ current-version: ${{ steps.check-versions.outputs.current-version }}
+ latest-version: ${{ steps.check-versions.outputs.latest-version }}
+ steps:
+ - uses: actions/checkout@v3
+
+ - id: check-versions
+ name: Check versions
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ current_version=$(grep -Po "val otelSdkVersion = \"\K[0-9]+.[0-9]+.[0-9]+" \
+ dependencyManagement/build.gradle.kts)
+ latest_version=$(gh release view \
+ --repo open-telemetry/opentelemetry-java \
+ --json tagName \
+ --jq .tagName \
+ | sed 's/^v//')
+
+ echo "current-version=$current_version" >> $GITHUB_OUTPUT
+ echo "latest-version=$latest_version" >> $GITHUB_OUTPUT
+
+ update-otel-sdk:
+ runs-on: ubuntu-latest
+ if: needs.check-versions.outputs.current-version != needs.check-versions.outputs.latest-version
+ needs:
+ - check-versions
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Update version
+ env:
+ VERSION: ${{ needs.check-versions.outputs.latest-version }}
+ run: ./.github/scripts/update-sdk-version.sh $VERSION
+
+ - name: Update license report
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: generateLicenseReport
+
+ - name: Use CLA approved github bot
+ run: .github/scripts/use-cla-approved-github-bot.sh
+
+ - name: Create pull request against main
+ env:
+ VERSION: ${{ needs.check-versions.outputs.latest-version }}
+ # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
+ GH_TOKEN: ${{ secrets.BOT_TOKEN }}
+ run: |
+ message="Update the OpenTelemetry SDK version to $VERSION"
+ body="Update the OpenTelemetry SDK version to \`$VERSION\`."
+ branch="opentelemetrybot/update-opentelemetry-sdk-to-${VERSION}"
+
+ git checkout -b $branch
+ git commit -a -m "$message"
+ git push --set-upstream origin $branch
+ gh pr create --title "$message" \
+ --body "$body" \
+ --base main

MODIFY
.github/workflows/build-daily-no-build-cache.yml
.github/workflows/build-daily-no-build-cache.yml
@@ -2,7 +2,7 @@ name: Build (daily, --no-build-cache)
on:
schedule:
- # strange schedule to reduce the risk of DDOS GitHub infra
+ # daily at 4:48 UTC
- cron: "48 4 * * *"
workflow_dispatch:

MODIFY
.github/workflows/build-daily.yml
.github/workflows/build-daily.yml
@@ -2,7 +2,7 @@ name: Build (daily)
on:
schedule:
- # strange schedule to reduce the risk of DDOS GitHub infra
+ # daily at 3:24 UTC
- cron: "24 3 * * *"
workflow_dispatch:

MODIFY
.github/workflows/build.yml
.github/workflows/build.yml
@@ -47,7 +47,7 @@ jobs:
markdown-lint-check:
# release branches are excluded
- if: ${{ !startsWith(github.ref_name, 'release/') }}
+ if: "!startsWith(github.ref_name, 'release/')"
uses: ./.github/workflows/reusable-markdown-lint-check.yml
misspell-check:

MODIFY
.github/workflows/codeql-daily.yml
.github/workflows/codeql-daily.yml
@@ -2,7 +2,8 @@ name: CodeQL (daily)
on:
schedule:
- - cron: '30 1 * * *'
+ # daily at 1:30 UTC
+ - cron: "30 1 * * *"
workflow_dispatch:
jobs:

MODIFY
.github/workflows/issue-management-stale-action.yml
.github/workflows/issue-management-stale-action.yml
@@ -2,7 +2,7 @@ name: Issue management - run stale action
on:
schedule:
- # Hourly at minute 23
+ # hourly at minute 23
- cron: "23 * * * *"
jobs:

MODIFY
.github/workflows/overhead-benchmark-daily.yml
.github/workflows/overhead-benchmark-daily.yml
name: Overhead benchmark (daily)
on:
schedule:
- # 5am GMT
+ # daily at 5:00 UTC
- cron: '0 5 * * *'
workflow_dispatch:

MODIFY
.github/workflows/owasp-dependency-check-daily.yml
.github/workflows/owasp-dependency-check-daily.yml
@@ -4,7 +4,8 @@ name: OWASP dependency check (daily)
on:
schedule:
- - cron: '30 1 * * *'
+ # daily at 1:30 UTC
+ - cron: "30 1 * * *"
workflow_dispatch:
jobs:

MODIFY
dependencyManagement/build.gradle.kts
dependencyManagement/build.gradle.kts
@@ -11,6 +11,9 @@ data class DependencySet(val group: String, val version: String, val modules: Li
val dependencyVersions = hashMapOf<String, String>()
rootProject.extra["versions"] = dependencyVersions
+// this line is managed by .github/scripts/update-sdk-version.sh
+val otelSdkVersion = "1.22.0"
+
// Need both BOM and groovy jars
val groovyVersion = "4.0.9"
@@ -29,8 +32,8 @@ val DEPENDENCY_BOMS = listOf(
"com.fasterxml.jackson:jackson-bom:2.14.2",
"com.google.guava:guava-bom:31.1-jre",
"org.apache.groovy:groovy-bom:${groovyVersion}",
- "io.opentelemetry:opentelemetry-bom:1.22.0",
- "io.opentelemetry:opentelemetry-bom-alpha:1.22.0-alpha",
+ "io.opentelemetry:opentelemetry-bom:${otelSdkVersion}",
+ "io.opentelemetry:opentelemetry-bom-alpha:${otelSdkVersion}-alpha",
"org.junit:junit-bom:5.9.2",
"org.testcontainers:testcontainers-bom:1.17.6",
"org.spockframework:spock-bom:2.4-M1-groovy-4.0"

MODIFY
examples/distro/build.gradle
examples/distro/build.gradle
@@ -26,8 +26,8 @@ subprojects {
ext {
versions = [
- // these lines are managed by .github/scripts/update-sdk-version.sh
- opentelemetry : "1.22.0",
+ // this line is managed by .github/scripts/update-sdk-version.sh
+ opentelemetrySdk : "1.22.0",
// these lines are managed by .github/scripts/update-version.sh
opentelemetryJavaagent : "1.23.0-SNAPSHOT",
@@ -64,6 +64,12 @@ subprojects {
}
dependencies {
+ implementation(platform("io.opentelemetry:opentelemetry-bom:${versions.opentelemetrySdk}"))
+
+ // these serve as a test of the instrumentation boms
+ implementation(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom:${versions.opentelemetryJavaagent}"))
+ implementation(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:${versions.opentelemetryJavaagentAlpha}"))
+
testImplementation("org.mockito:mockito-core:5.1.1")
testImplementation(enforcedPlatform("org.junit:junit-bom:${versions.junit}"))
testImplementation("org.junit.jupiter:junit-jupiter-api:${versions.junit}")

MODIFY
examples/distro/custom/build.gradle
examples/distro/custom/build.gradle
@@ -4,8 +4,8 @@ plugins {
dependencies {
compileOnly(project(":bootstrap"))
- compileOnly("io.opentelemetry:opentelemetry-sdk:${versions.opentelemetry}")
- compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi:${versions.opentelemetry}")
- compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api:${versions.opentelemetryJavaagentAlpha}")
- compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling:${versions.opentelemetryJavaagentAlpha}")
+ compileOnly("io.opentelemetry:opentelemetry-sdk")
+ compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi")
+ compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api")
+ compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling")
}

MODIFY
examples/distro/gradle/instrumentation.gradle
examples/distro/gradle/instrumentation.gradle
@@ -13,9 +13,9 @@ configurations {
}
dependencies {
- compileOnly("io.opentelemetry:opentelemetry-sdk:${versions.opentelemetry}")
- compileOnly("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:${versions.opentelemetryJavaagent}")
- compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api:${versions.opentelemetryJavaagentAlpha}")
+ compileOnly("io.opentelemetry:opentelemetry-sdk")
+ compileOnly("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api")
+ compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api")
compileOnly deps.bytebuddy
annotationProcessor deps.autoservice
@@ -24,8 +24,8 @@ dependencies {
// the javaagent that is going to be used when running instrumentation unit tests
testAgent(project(path: ":testing:agent-for-testing", configuration: "shadow"))
// test dependencies
- testImplementation("io.opentelemetry.javaagent:opentelemetry-testing-common:${versions.opentelemetryJavaagentAlpha}")
- testImplementation("io.opentelemetry:opentelemetry-sdk-testing:${versions.opentelemetry}")
+ testImplementation("io.opentelemetry.javaagent:opentelemetry-testing-common")
+ testImplementation("io.opentelemetry:opentelemetry-sdk-testing")
testImplementation("org.assertj:assertj-core:3.19.0")
add("codegen", "io.opentelemetry.javaagent:opentelemetry-javaagent-tooling:${versions.opentelemetryJavaagentAlpha}")

MODIFY
examples/distro/instrumentation/servlet-3/build.gradle
examples/distro/instrumentation/servlet-3/build.gradle
@@ -23,7 +23,7 @@ dependencies {
testInstrumentation "io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-servlet-2.2:${versions.opentelemetryJavaagentAlpha}"
testInstrumentation "io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-servlet-3.0:${versions.opentelemetryJavaagentAlpha}"
- testImplementation("io.opentelemetry.javaagent:opentelemetry-testing-common:${versions.opentelemetryJavaagentAlpha}") {
+ testImplementation("io.opentelemetry.javaagent:opentelemetry-testing-common") {
exclude group: 'org.eclipse.jetty', module: 'jetty-server'
}

MODIFY
examples/extension/build.gradle
examples/extension/build.gradle
@@ -22,6 +22,9 @@ version '1.0'
ext {
versions = [
+ // this line is managed by .github/scripts/update-sdk-version.sh
+ opentelemetrySdk : "1.22.0",
+
// these lines are managed by .github/scripts/update-version.sh
opentelemetryJavaagent : "1.23.0-SNAPSHOT",
opentelemetryJavaagentAlpha: "1.23.0-alpha-SNAPSHOT",
@@ -60,11 +63,11 @@ spotless {
}
dependencies {
- api(platform("io.opentelemetry:opentelemetry-bom:1.22.0"))
+ implementation(platform("io.opentelemetry:opentelemetry-bom:${versions.opentelemetrySdk}"))
// these serve as a test of the instrumentation boms
- api(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom:${versions.opentelemetryJavaagent}"))
- api(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:${versions.opentelemetryJavaagentAlpha}"))
+ implementation(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom:${versions.opentelemetryJavaagent}"))
+ implementation(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:${versions.opentelemetryJavaagentAlpha}"))
/*
Interfaces and SPIs that we implement. We use `compileOnly` dependency because during

Auto-update OTel SDK (#7633)

Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>