Skip to content

Commit

Permalink
Update otelInstrumentationVersion to v2.10.0 (#803)
Browse files Browse the repository at this point in the history
* Update otelInstrumentationVersion to v2.10.0

* sync with upstream example

---------

Co-authored-by: grafanarenovatebot[bot] <146220760+grafanarenovatebot[bot]@users.noreply.github.com>
Co-authored-by: Gregor Zeitlinger <[email protected]>
  • Loading branch information
grafanarenovatebot[bot] and zeitlinger authored Nov 14, 2024
1 parent 1e85ea9 commit de18cc7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 25 deletions.
12 changes: 4 additions & 8 deletions agent/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -65,18 +65,14 @@ tasks {

mergeServiceFiles()
exclude("**/module-info.class")
exclude("META-INF/versions/21/**/*.class") // unused but cause problems due to https://github.com/johnrengelman/shadow/issues/888
relocatePackages(it)

// exclude known bootstrap dependencies - they can't appear in the inst/ directory
dependencies {
exclude("io.opentelemetry:opentelemetry-api")
exclude("io.opentelemetry:opentelemetry-api-events")
exclude("io.opentelemetry:opentelemetry-context")
exclude("io.opentelemetry:opentelemetry-semconv")
exclude("io.opentelemetry.semconv:opentelemetry-semconv")
// metrics advice API
exclude("io.opentelemetry:opentelemetry-extension-incubator")
// events API and metrics advice API
exclude("io.opentelemetry:opentelemetry-api-incubator")
}
}

Expand All @@ -88,7 +84,7 @@ tasks {
dependsOn(tasks.relocateJavaagentLibs)
with isolateClasses(tasks.relocateJavaagentLibs.outputs.files)

into("$buildDir/isolated/javaagentLibs")
into(layout.buildDirectory.dir("isolated/javaagentLibs"))
}

// 3. the relocated and isolated javaagent libs are merged together with the bootstrap libs (which undergo relocation
Expand Down
9 changes: 2 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version '2.9.0'

buildscript {
ext {
otelInstrumentationVersion = "2.9.0"
otelInstrumentationVersion = "2.10.0"
}
repositories {
maven {
Expand All @@ -12,7 +12,7 @@ buildscript {
}
dependencies {
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.25.0"
classpath "gradle.plugin.com.github.johnrengelman:shadow:8.0.0"
classpath "com.gradleup.shadow:shadow-gradle-plugin:8.3.5"
classpath "io.opentelemetry.instrumentation:gradle-plugins:${otelInstrumentationVersion}-alpha"
}
}
Expand All @@ -25,8 +25,6 @@ subprojects {

ext {
versions = [
opentelemetrySdk : "1.44.1",

opentelemetryJavaagent : otelInstrumentationVersion,
opentelemetryJavaagentAlpha: "${otelInstrumentationVersion}-alpha",

Expand Down Expand Up @@ -77,10 +75,7 @@ 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.assertj:assertj-core:${versions.assertj}")
Expand Down
6 changes: 2 additions & 4 deletions gradle/instrumentation.gradle
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -17,7 +17,6 @@ dependencies {
compileOnly("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api")
compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api")

compileOnly deps.bytebuddy
annotationProcessor deps.autoservice
compileOnly deps.autoservice

Expand Down Expand Up @@ -53,15 +52,14 @@ tasks.withType(Test).configureEach {
jvmArgs "-Dotel.javaagent.testing.fail-on-context-leak=true"
// prevent sporadic gradle deadlocks, see SafeLogger for more details
jvmArgs "-Dotel.javaagent.testing.transform-safe-logging.enabled=true"
jvmArgs "-Dotel.metrics.exporter=otlp"

dependsOn shadowJar
dependsOn configurations.testAgent.buildDependencies

// The sources are packaged into the testing jar so we need to make sure to exclude from the test
// classpath, which automatically inherits them, to ensure our shaded versions are used.
classpath = classpath.filter {
if (it == file("$buildDir/resources/main") || it == file("$buildDir/classes/java/main")) {
if (it == file(layout.buildDirectory.dir("resources/main")) || it == file(layout.buildDirectory.dir("classes/java/main"))) {
return false
}
return true
Expand Down
10 changes: 4 additions & 6 deletions testing/agent-for-testing/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -69,11 +69,9 @@ tasks {
// exclude known bootstrap dependencies - they can't appear in the inst/ directory
dependencies {
exclude("io.opentelemetry:opentelemetry-api")
exclude("io.opentelemetry:opentelemetry-api-events")
exclude("io.opentelemetry:opentelemetry-context")
exclude("io.opentelemetry.semconv:opentelemetry-semconv")
// metrics advice API
exclude("io.opentelemetry:opentelemetry-extension-incubator")
// events API and metrics advice API
exclude("io.opentelemetry:opentelemetry-api-incubator")
}
}

Expand All @@ -85,7 +83,7 @@ tasks {
dependsOn(tasks.relocateJavaagentLibs)
with isolateClasses(tasks.relocateJavaagentLibs.outputs.files)

into("$buildDir/isolated/javaagentLibs")
into(layout.buildDirectory.dir("isolated/javaagentLibs"))
}

// 3. the relocated and isolated javaagent libs are merged together with the bootstrap libs (which undergo relocation
Expand Down

0 comments on commit de18cc7

Please sign in to comment.