-
Notifications
You must be signed in to change notification settings - Fork 909
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
Change the default javaagent artifact to have exporters #4106
Changes from 21 commits
af7a83e
d99849d
9c6f04f
9b20ff0
6ea1a07
6ab2c68
6e53ea0
2a4839c
64df703
9c43849
5113576
42f4830
1687020
ae7e2d1
2b9de15
cc35263
6cdfbce
f01fbf6
e6e4e3d
7b4b731
73226a0
f6c3a94
1fa5ef6
49e1aa8
3db6c45
61ab8fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -265,6 +265,18 @@ jobs: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: javaagent/build/libs/opentelemetry-javaagent-${{ github.event.inputs.version }}-all.jar | ||
asset_path: javaagent/build/libs/opentelemetry-javaagent-${{ github.event.inputs.version }}.jar | ||
asset_name: opentelemetry-javaagent.jar | ||
asset_content_type: application/java-archive | ||
|
||
# TODO (trask) delete this after the 1.7.0 release (to make sure it is used for any 1.6.x patches) | ||
- name: Upload Release Asset (backwards compatible "all" artifact) | ||
id: upload-release-asset | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: javaagent/build/libs/opentelemetry-javaagent-${{ github.event.inputs.version }}.jar | ||
asset_name: opentelemetry-javaagent-all.jar | ||
asset_content_type: application/java-archive |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,6 +173,18 @@ jobs: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: javaagent/build/libs/opentelemetry-javaagent-${{ github.event.inputs.version }}-all.jar | ||
asset_path: javaagent/build/libs/opentelemetry-javaagent-${{ github.event.inputs.version }}.jar | ||
asset_name: opentelemetry-javaagent.jar | ||
asset_content_type: application/java-archive | ||
|
||
# TODO (trask) delete this after the 1.7.0 release | ||
- name: Upload Release Asset (backwards compatible "all" artifact) | ||
id: upload-release-asset | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: javaagent/build/libs/opentelemetry-javaagent-${{ github.event.inputs.version }}.jar | ||
asset_name: opentelemetry-javaagent-all.jar | ||
asset_content_type: application/java-archive |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,11 +18,6 @@ or they might want to manually create spans for their own custom code. | |
|
||
# Dependencies | ||
|
||
> :warning: prior to version 1.0.0, `opentelemetry-javaagent-all.jar` | ||
only supports manual instrumentation using the `opentelemetry-api` version with the same version | ||
number as the Java agent you are using. Starting with 1.0.0, the Java agent will start supporting | ||
multiple (1.0.0+) versions of `opentelemetry-api`. | ||
|
||
Comment on lines
-21
to
-25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we sure about that? Have we tested that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we have a smoke test that verifies interop with opentelemetry-api 1.0.0, and #3044 to track doing better than that with muzzle (also, this is old doc, I'm removing it, see #4106 (comment)) |
||
You'll need to add a dependency on the `opentelemetry-api` library to get started; if you intend to | ||
use the `@WithSpan` annotation, also include the `opentelemetry-extension-annotations` dependency. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,9 +35,14 @@ val exporterLibs by configurations.creating { | |
isCanBeResolved = true | ||
isCanBeConsumed = false | ||
} | ||
// this configuration collects just exporter libs for slim artifact (also placed in the agent classloader & isolated from the instrumented application) | ||
val exporterSlimLibs by configurations.creating { | ||
isCanBeResolved = true | ||
isCanBeConsumed = false | ||
} | ||
|
||
// exclude dependencies that are to be placed in bootstrap from agent libs - they won't be added to inst/ | ||
listOf(javaagentLibs, exporterLibs).forEach { | ||
listOf(javaagentLibs, exporterLibs, exporterSlimLibs).forEach { | ||
it.run { | ||
exclude("org.slf4j") | ||
exclude("io.opentelemetry", "opentelemetry-api") | ||
|
@@ -73,6 +78,10 @@ dependencies { | |
|
||
exporterLibs(project(":javaagent-exporters")) | ||
|
||
exporterSlimLibs("io.opentelemetry:opentelemetry-exporter-otlp") | ||
exporterSlimLibs("io.opentelemetry:opentelemetry-exporter-otlp-metrics") | ||
exporterSlimLibs("io.grpc:grpc-okhttp:1.41.0") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just realized that because this is using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well assuming it doesn't cause dependency hell, wow that's old https://github.com/grpc/grpc-java/blob/master/build.gradle#L158 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Err - nevermind, yeah it wouldn't cause dependency hell since it's a different artifact So scratch the almost-no-additional-bytecode idea. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By the way, just some random trivia grpc/grpc-java#6119 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
this thread helped my mental picture 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It appears that we can exclude okhttp 2 from the transitive dependencies open-telemetry/opentelemetry-java#3678 though I added a comment on the grpc-java issue to see if there is anything obviously bad with that. Currently I guess we effectively have two copies of okhttp2, the forked-into-grpc one and the transitive dependency which we don't seem to need. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added #4240 to discuss/track |
||
|
||
// We only have compileOnly dependencies on these to make sure they don't leak into POMs. | ||
licenseReportDependencies("com.github.ben-manes.caffeine:caffeine") { | ||
isTransitive = false | ||
|
@@ -143,12 +152,23 @@ tasks { | |
archiveFileName.set("exporterLibs-relocated.jar") | ||
} | ||
|
||
// Includes instrumentations, but not exporters | ||
val relocateExporterSlimLibs by registering(ShadowJar::class) { | ||
configurations = listOf(exporterSlimLibs) | ||
|
||
archiveFileName.set("exporterSlimLibs-relocated.jar") | ||
} | ||
|
||
// Includes everything needed for OOTB experience | ||
val shadowJar by existing(ShadowJar::class) { | ||
configurations = listOf(bootstrapLibs) | ||
|
||
dependsOn(relocateJavaagentLibs) | ||
// without an explicit dependency on jar here, :javaagent:test fails on CI because :javaagent:jar | ||
// runs after :javaagent:shadowJar and loses (at least) the manifest entries | ||
dependsOn(jar, relocateJavaagentLibs, relocateExporterLibs) | ||
isolateClasses(relocateJavaagentLibs.get().outputs.files) | ||
isolateClasses(relocateExporterLibs.get().outputs.files) | ||
|
||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
|
||
archiveClassifier.set("") | ||
|
||
|
@@ -164,17 +184,15 @@ tasks { | |
} | ||
} | ||
|
||
// Includes everything needed for OOTB experience | ||
val fullJavaagentJar by registering(ShadowJar::class) { | ||
// Includes instrumentations, but not exporters | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Slim does include OTLP exporter, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed 👍 |
||
val slimShadowJar by registering(ShadowJar::class) { | ||
configurations = listOf(bootstrapLibs) | ||
|
||
dependsOn(relocateJavaagentLibs, relocateExporterLibs) | ||
dependsOn(relocateJavaagentLibs, relocateExporterSlimLibs) | ||
isolateClasses(relocateJavaagentLibs.get().outputs.files) | ||
isolateClasses(relocateExporterLibs.get().outputs.files) | ||
|
||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
isolateClasses(relocateExporterSlimLibs.get().outputs.files) | ||
|
||
archiveClassifier.set("all") | ||
archiveClassifier.set("slim") | ||
|
||
manifest { | ||
attributes(shadowJar.get().manifest.attributes) | ||
|
@@ -207,18 +225,18 @@ tasks { | |
} | ||
|
||
assemble { | ||
dependsOn(shadowJar, fullJavaagentJar, baseJavaagentJar) | ||
dependsOn(shadowJar, slimShadowJar, baseJavaagentJar) | ||
} | ||
|
||
withType<Test>().configureEach { | ||
dependsOn(fullJavaagentJar) | ||
inputs.file(fullJavaagentJar.get().archiveFile) | ||
dependsOn(shadowJar) | ||
inputs.file(shadowJar.get().archiveFile) | ||
|
||
jvmArgs("-Dotel.javaagent.debug=true") | ||
|
||
doFirst { | ||
// Defining here to allow jacoco to be first on the command line. | ||
jvmArgs("-javaagent:${fullJavaagentJar.get().archiveFile.get().asFile}") | ||
jvmArgs("-javaagent:${shadowJar.get().archiveFile.get().asFile}") | ||
} | ||
|
||
testLogging { | ||
|
@@ -237,7 +255,7 @@ tasks { | |
publishing { | ||
publications { | ||
named<MavenPublication>("maven") { | ||
artifact(fullJavaagentJar) | ||
artifact(slimShadowJar) | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the rename but it's sort of a breaking change for e.g., Dockerfiles that may be curling the "latest release" URL. Should we upload both at least for one release?
We may also consider whether it is bad practice in general to point at an unversioned URL - if so we can probably update our README to not point at the latest version URL to discourage usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense to me, I added attaching backwards compatible "all" artifact step to both release and patch release builds
I like explicit versions in docs (and keeping it updated), IIRC we were stuck on how to automate this? maybe we can tack this problem on to #3516 @iNikem?