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

Move diagnostics package out of bootstrap module #3190

Merged
merged 10 commits into from
Jul 12, 2023

Conversation

trask
Copy link
Member

@trask trask commented Jul 11, 2023

Bonus: also upgrades to SLF4J 2.x

This will also allow follow-up PR to remove moshi dependency

@trask trask force-pushed the move-diagnostics-to-tooling branch 5 times, most recently from fc5ae22 to 289c1df Compare July 11, 2023 21:44
Comment on lines -19 to -21
// not using gson because it has dependency on java.sql.*, which is not available in Java 9+ bootstrap class loader
// only complaint so far about moshi is that it doesn"t give line numbers when there are json formatting errors
implementation("com.squareup.moshi:moshi")
Copy link
Member Author

Choose a reason for hiding this comment

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

this was what motivated moving this code out of the bootstrap module (in addition to it being a generally good thing to minimize amount of classes in the bootstrap module)

(although this comment is now very outdated, and we'll move to jackson)

@trask trask force-pushed the move-diagnostics-to-tooling branch from 289c1df to a33abc5 Compare July 11, 2023 22:05
@trask trask force-pushed the move-diagnostics-to-tooling branch from 79cdc18 to be679e7 Compare July 11, 2023 22:12
Comment on lines +164 to +167
@SuppressFBWarnings(
value = "SECCRLFLOG", // CRLF injection into log messages
justification =
"Logging params cannot be controlled by an end user of the instrumented application")
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 idea why this warning only started showing up with this change (https://find-sec-bugs.github.io/bugs.htm#CRLF_INJECTION_LOGS)

@trask trask force-pushed the move-diagnostics-to-tooling branch from ec796b9 to e34db74 Compare July 11, 2023 23:50
Comment on lines +78 to +84
// spring boot 2.x requires slf4j 1.x
val slf4jVersion = "1.7.36"
resolutionStrategy.force("org.slf4j:slf4j-api:${slf4jVersion}")
resolutionStrategy.force("org.slf4j:log4j-over-slf4j:${slf4jVersion}")
resolutionStrategy.force("org.slf4j:jcl-over-slf4j:${slf4jVersion}")
resolutionStrategy.force("org.slf4j:jul-to-slf4j:${slf4jVersion}")
resolutionStrategy.force("ch.qos.logback:logback-classic:1.2.12")
Copy link
Member Author

Choose a reason for hiding this comment

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

need to override dependencyManagement for slf4j version in smoke tests

// moving to 2.0 is problematic because the SPI mechanism in 2.0 doesn't work in the
// bootstrap class loader because, while we add the agent jar to the bootstrap class loader
// via Instrumentation.appendToBootstrapClassLoaderSearch(), there's nothing similar for
// resources (which is a known problem in the java agent world), and so the META-INF/services
// resource is not found
val slf4jVersion = "1.7.36"
val slf4jVersion = "2.0.7"
Copy link
Member Author

Choose a reason for hiding this comment

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

🥳

Comment on lines +112 to 111
// unfortunately, this also excludes the same from our distro (which points to logback)
// and so we have to hackily re-add it via agent/agent/src/main/resources
exclude("inst/META-INF/services/io.opentelemetry.javaagent.slf4j.spi.SLF4JServiceProvider")
Copy link
Member Author

Choose a reason for hiding this comment

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

yuck 🙈

@trask trask force-pushed the move-diagnostics-to-tooling branch from 8407aa9 to 3e3abf3 Compare July 12, 2023 02:02
@trask trask marked this pull request as ready for review July 12, 2023 02:47
@trask trask enabled auto-merge (squash) July 12, 2023 18:29
@trask trask merged commit 9a143f0 into main Jul 12, 2023
84 checks passed
@trask trask deleted the move-diagnostics-to-tooling branch July 12, 2023 19:05
@heyams heyams mentioned this pull request Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants