Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update upstream agent #49

Merged
merged 13 commits into from
Nov 29, 2023
Merged
11 changes: 10 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
version: 2
updates:

registries:

updates:
# GitHub actions
- package-ecosystem: "github-actions"
directory: "/"
Expand All @@ -15,3 +17,10 @@ updates:
github-actions:
patterns:
- "*"

# Gradle
- package-ecosystem: "gradle"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[for reviewer] this configures dependabot to attempt updating gradle dependencies in gradle/libs.versions.toml, maybe other files are covered as well (but this will be the central place where we attempt to configure dependencies in the future).

directory: "/gradle/" # for now only on the version catalog to prevent noise
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[for reviewer] for now we only try to update versions set in "version catalog", covering all dependencies should be part of #8

schedule:
interval: "daily"
open-pull-requests-limit: 10
8 changes: 4 additions & 4 deletions agent/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
alias gradlePlugins.plugins.shadow
alias gradlePlugins.plugins.taskinfo
alias catalog.plugins.shadow
alias catalog.plugins.taskinfo
}

base.archivesName.set("elastic-otel-javaagent")
Expand Down Expand Up @@ -38,7 +38,7 @@ dependencies {
// This is where we should add custom instrumentations
// javaagentLibs(project(":instrumentation:servlet-3"))

upstreamAgent("io.opentelemetry.javaagent:opentelemetry-javaagent:" + libraries.versions.opentelemetryJavaagent.get().toString())
upstreamAgent(catalog.opentelemetryJavaagent)
}

CopySpec isolateClasses(Iterable<File> jars) {
Expand Down Expand Up @@ -124,7 +124,7 @@ tasks {
attributes.put("Can-Retransform-Classes", "true")
attributes.put("Implementation-Vendor", "Elastic")
// TODO : add git hash to version for easier support
attributes.put("Implementation-Version", "elastic-${project.version}-otel-" + libraries.versions.opentelemetryJavaagent.get().toString())
attributes.put("Implementation-Version", "elastic-${project.version}-otel-" + catalog.versions.opentelemetryJavaagent.get().toString())
}
}

Expand Down
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ subprojects {
ext {
deps = [
autoservice: [
"com.google.auto.service:auto-service:" + libraries.versions.autoservice.get(),
"com.google.auto.service:auto-service-annotations:" + libraries.versions.autoservice.get(),
"com.google.auto.service:auto-service:" + catalog.versions.autoservice.get(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can't use libraries instead of versions here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know yet for those and plan to tackle it with #8 later to focus on the otel parts.

"com.google.auto.service:auto-service-annotations:" + catalog.versions.autoservice.get(),
]
]
}
Expand All @@ -40,15 +40,15 @@ subprojects {

dependencies {

implementation(platform("io.opentelemetry:opentelemetry-bom:" + libraries.versions.opentelemetrySdk.get().toString()))
implementation(platform(catalog.opentelemetryBom))

// these serve as a test of the instrumentation boms
implementation(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom:" + libraries.versions.opentelemetryJavaagent.get().toString()))
implementation(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:" + libraries.versions.opentelemetryJavaagentAlpha.get().toString()))
implementation(platform(catalog.opentelemetryInstrumentationBom))
implementation(platform(catalog.opentelemetryInstrumentationAlphaBom))

testImplementation("org.mockito:mockito-core:5.5.0")

testImplementation(enforcedPlatform("org.junit:junit-bom:" + libraries.versions.junit.get().toString()))
testImplementation(enforcedPlatform("org.junit:junit-bom:" + catalog.versions.junit.get().toString()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here: Impossible to use a library instead of version, correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, here it's possible to use the catalog in a declarative way, but I will do that when dealing with #8 to keep changes minimal here.

testImplementation("org.junit.jupiter:junit-jupiter")
}

Expand Down
32 changes: 32 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[versions]
shadow = "8.1.1"
jib = "3.4.0"
spotless = "6.21.0"
junit = "5.10.0"
autoservice = "1.1.1"

opentelemetrySdk = "1.29.0"
opentelemetryJavaagent = "1.30.0"
opentelemetryJavaagentAlpha = "1.30.0-alpha"
opentelemetryContribAlpha = "1.30.0-alpha"

[libraries]

SylvainJuge marked this conversation as resolved.
Show resolved Hide resolved
opentelemetryJavaagent = { group = "io.opentelemetry.javaagent", name = "opentelemetry-javaagent", version.ref = "opentelemetryJavaagent" }
opentelemetryJavaagentForTesting = { group = "io.opentelemetry.javaagent", name = "opentelemetry-agent-for-testing", version.ref = "opentelemetryJavaagent" }

opentelemetryBom = { group = "io.opentelemetry", name = "opentelemetry-bom", version.ref = "opentelemetrySdk" }
opentelemetryInstrumentationBom = { group = "io.opentelemetry.instrumentation", name = "opentelemetry-instrumentation-bom", version.ref = "opentelemetryJavaagent" }
opentelemetryInstrumentationAlphaBom = { group = "io.opentelemetry.instrumentation", name = "opentelemetry-instrumentation-bom-alpha", version.ref = "opentelemetryJavaagentAlpha" }

awsContribResources = { group = "io.opentelemetry.contrib", name = "opentelemetry-aws-resources", version.ref = "opentelemetryContribAlpha" }
contribResources = { group = "io.opentelemetry.contrib", name = "opentelemetry-resource-providers", version.ref = "opentelemetryContribAlpha" }

[bundles]

[plugins]

shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
jib = { id = "com.google.cloud.tools.jib", version.ref = "jib" }
spotless = { id = "com.diffplug.spotless:spotless", version.ref = "spotless" }
taskinfo = { id = "org.barfuin.gradle.taskinfo", version = '2.1.0' }
8 changes: 4 additions & 4 deletions resources/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
java
alias(gradlePlugins.plugins.shadow)
alias(gradlePlugins.plugins.taskinfo)
alias(catalog.plugins.shadow)
alias(catalog.plugins.taskinfo)
}

dependencies {
Expand All @@ -19,8 +19,8 @@ dependencies {
implementation("com.squareup.okhttp3:okhttp:4.11.0")

// required to make the IDE compile our own resource provider, won't be included as dependency
compileOnly("io.opentelemetry.contrib:opentelemetry-aws-resources:" + libraries.versions.opentelemetryContribAlpha.get())
compileOnly("io.opentelemetry.contrib:opentelemetry-resource-providers:" + libraries.versions.opentelemetryContribAlpha.get())
compileOnly(catalog.awsContribResources)
compileOnly(catalog.contribResources)
}
}

Expand Down
8 changes: 4 additions & 4 deletions resources/repackaged/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
java
alias(gradlePlugins.plugins.shadow)
alias(gradlePlugins.plugins.taskinfo)
alias(catalog.plugins.shadow)
alias(catalog.plugins.taskinfo)
}

val shadowedImplementation by configurations.creating {
Expand All @@ -12,13 +12,13 @@ val shadowedImplementation by configurations.creating {
dependencies {

// AWS cloud resource providers
shadowedImplementation("io.opentelemetry.contrib:opentelemetry-aws-resources:" + libraries.versions.opentelemetryContribAlpha.get())
shadowedImplementation(catalog.awsContribResources)

// TODO : GCP resource providers
// "com.google.cloud.opentelemetry:detector-resources:0.25.2-alpha"

// application servers resource providers
shadowedImplementation("io.opentelemetry.contrib:opentelemetry-resource-providers:" + libraries.versions.opentelemetryContribAlpha.get())
shadowedImplementation(catalog.contribResources)
}

tasks {
Expand Down
26 changes: 5 additions & 21 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,11 @@ include("testing:agent-for-testing")

dependencyResolutionManagement {
versionCatalogs {
create("gradlePlugins") {
version("shadow", "8.1.1")
version("jib", "3.4.0")
version("spotless", "6.21.0")

plugin("shadow", "com.github.johnrengelman.shadow").versionRef("shadow")
plugin("jib", "com.google.cloud.tools.jib").versionRef("jib")
plugin("spotless", "com.diffplug.spotless").versionRef("spotless")
plugin("taskinfo", "org.barfuin.gradle.taskinfo").version("2.1.0")
}

create("libraries") {
version("junit", "5.10.0")

version("opentelemetrySdk", "1.29.0")
version("opentelemetryJavaagent", "1.30.0")
version("opentelemetryJavaagentAlpha", "1.30.0-alpha")
version("opentelemetryContribAlpha", "1.30.0-alpha")

version("autoservice", "1.1.1")
create("catalog") {
// the version catalog is currently limited to a single file due to dependabot
// see https://github.com/dependabot/dependabot-core/issues/8079 for details.
// Also, only the 'gradle/libs.versions.toml' path is supported for now.
from(files("gradle/libs.versions.toml"))
}

}
}
2 changes: 1 addition & 1 deletion smoke-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import jdk.internal.joptsimple.internal.Strings
// TODO : convert to kotlin for consistency
plugins {
id "java"
alias gradlePlugins.plugins.taskinfo
alias catalog.plugins.taskinfo
}

configurations {
Expand Down
2 changes: 1 addition & 1 deletion smoke-tests/test-app-war/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
alias(gradlePlugins.plugins.taskinfo)
alias(catalog.plugins.taskinfo)
war
}

Expand Down
6 changes: 3 additions & 3 deletions smoke-tests/test-app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
alias(gradlePlugins.plugins.shadow)
alias(gradlePlugins.plugins.jib)
alias(gradlePlugins.plugins.taskinfo)
alias(catalog.plugins.shadow)
alias(catalog.plugins.jib)
alias(catalog.plugins.taskinfo)
}

dependencies {
Expand Down
6 changes: 3 additions & 3 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 {
alias(gradlePlugins.plugins.shadow)
alias(catalog.plugins.shadow)
}

apply from: "$rootDir/gradle/shadow.gradle"
Expand Down Expand Up @@ -29,7 +29,7 @@ configurations {
dependencies {
bootstrapLibs(project(":bootstrap"))
// and finally include everything from otel agent for testing
upstreamAgent("io.opentelemetry.javaagent:opentelemetry-agent-for-testing:"+libraries.versions.opentelemetryJavaagentAlpha.get().toString())
upstreamAgent(catalog.opentelemetryJavaagentForTesting)
}

CopySpec isolateClasses(Iterable<File> jars) {
Expand Down Expand Up @@ -114,7 +114,7 @@ tasks {
attributes.put("Can-Redefine-Classes", "true")
attributes.put("Can-Retransform-Classes", "true")
attributes.put("Implementation-Vendor", "Elastic")
attributes.put("Implementation-Version", "elastic-${project.version}-otel-" + libraries.versions.opentelemetryJavaagent.get().toString())
attributes.put("Implementation-Version", "elastic-${project.version}-otel-" + catalog.versions.opentelemetryJavaagent.get().toString())
}
}

Expand Down
Loading