Fix inconsistent exception logging patterns and add guidance#8231
Fix inconsistent exception logging patterns and add guidance#8231VamshikrishnaMonagari wants to merge 1 commit intoopen-telemetry:mainfrom
Conversation
699d1bd to
e01ec36
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8231 +/- ##
=========================================
Coverage 90.27% 90.28%
+ Complexity 7695 7692 -3
=========================================
Files 850 850
Lines 23207 23201 -6
Branches 2356 2356
=========================================
- Hits 20951 20946 -5
+ Misses 1531 1528 -3
- Partials 725 727 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Sorry for the delayed review. I've reworked the CONTRIBUTING.md and introduced a knowledge base at https://github.com/open-telemetry/opentelemetry-java/tree/main/docs/knowledge Can you merge main and include a section about this guidance in https://github.com/open-telemetry/opentelemetry-java/blob/main/docs/knowledge/general-patterns.md? Thanks! |
e01ec36 to
86fd832
Compare
…uidance Category A — Remove redundant e.getMessage() where exception is already passed as the Throwable parameter: - GrpcExporter.java - HttpExporter.java - JaegerRemoteSampler.java (also fix stale FINEST log to pass exception as Throwable instead of concatenating) Category B — Pass exception as Throwable instead of stringifying via getMessage(), so logging frameworks can render full stack traces: - AutoConfiguredOpenTelemetrySdkBuilder.java - DeclarativeConfiguration.java - TracerShim.java - SdkDoubleHistogram.java - SdkLongHistogram.java Add best practice guidance to CONTRIBUTING.md recommending the use of dedicated logger overloads that accept a Throwable parameter. Resolves open-telemetry#8228
86fd832 to
718b3c7
Compare
Thanks for the heads up, @jack-berg ! I've rebased on main and moved the logging guidance over to the Logging section in |
Category A : Remove redundant
e.getMessage()where exception is already passed as the Throwable parameter:GrpcExporter.javaHttpExporter.javaJaegerRemoteSampler.java(also fix stale FINEST log to pass exception as Throwable instead of concatenating)Category B : Pass exception as Throwable instead of stringifying via
getMessage(), so logging frameworks can render full stack traces:AutoConfiguredOpenTelemetrySdkBuilder.javaDeclarativeConfiguration.javaTracerShim.javaSdkDoubleHistogram.javaSdkLongHistogram.javaAdd best practice guidance to
CONTRIBUTING.mdrecommending the use of dedicated logger overloads that accept a Throwable parameter.Resolves #8228