Remove duplicative FINEST-level error logging in GrpcExporter#8216
Conversation
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #8216 +/- ##
============================================
- Coverage 90.33% 90.31% -0.03%
+ Complexity 7655 7652 -3
============================================
Files 843 843
Lines 23071 23071
Branches 2311 2311
============================================
- Hits 20841 20836 -5
- Misses 1515 1516 +1
- Partials 715 719 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
exporters/common/src/main/java/io/opentelemetry/exporter/internal/grpc/GrpcExporter.java
Show resolved
Hide resolved
The FINEST log in onError used string concatenation (+ e) which only called toString(), missing the full stack trace. Changed to pass the exception as the Throwable parameter so the logging framework can properly render the complete stack trace at FINEST level. Resolves open-telemetry#8098
6eff0da to
dfd0240
Compare
| e); | ||
| if (logger.isLoggable(Level.FINEST)) { | ||
| logger.log(Level.FINEST, "Failed to export " + type + "s. Details follow: " + e); | ||
| logger.log(Level.FINEST, "Failed to export " + type + "s. Details follow:", e); |
There was a problem hiding this comment.
We actually have inconsistent and probably bad patterns around this in other places:
In these cases we log both the exception message and record the the exception itself:
In these cases we include the stringified caught exception message and don't record the exception, preventing the user from seeing the stacktrace:
We should add some guidance to https://github.com/open-telemetry/opentelemetry-java/blob/main/CONTRIBUTING.md#best-practices-that-we-follow to recommend not stringifying the exception and recording the exception using dedicated log overloads.
|
Thank you for your contribution @VamshikrishnaMonagari! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. |
The
onErrormethod inGrpcExporterlogged failures twice: once atSEVERE(with the exception object) and again atFINEST. TheFINESTlog is redundant since anyone who configures their logging framework to display stack traces will get them from theSEVERElog's exception parameter.HttpExporterdoes not have this pattern and required no changes.Resolves #8098