-
Notifications
You must be signed in to change notification settings - Fork 7
Add syntactic sugar for wrapping operations with a span #55
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #55 +/- ##
==========================================
+ Coverage 90.60% 90.61% +0.01%
==========================================
Files 215 215
Lines 2298 2302 +4
Branches 233 233
==========================================
+ Hits 2082 2086 +4
Misses 163 163
Partials 53 53 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a3cd282 to
e2f5bd6
Compare
bidetofevil
left a comment
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.
LGTM with a comment about whether we need to fail a span if we are auto-closing due to an exception/error.
Also added a comment about adding a test that verifies thrown exceptions/errors still lead to the span being closed
compat/src/jvmTest/kotlin/io/opentelemetry/kotlin/tracing/model/ReadWriteSpanAdapterTest.kt
Outdated
Show resolved
Hide resolved
implementation/src/commonMain/kotlin/io/opentelemetry/kotlin/tracing/model/SpanModel.kt
Outdated
Show resolved
Hide resolved
|
There's some discussion on #4 about how opentelemetry-java decided against |
e2f5bd6 to
be48906
Compare
be48906 to
60ff6a7
Compare
Review is stale as I've changed approach to use an extension function instead.
|
Based on discussion in #4 I've tweaked this changeset to use an extension function instead of |
bidetofevil
left a comment
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.
Nice. LGTM.
Goal
Adds syntactic sugar to make it easier for library consumers to wrap operations with a
Span. This works by providing a higher-order function that ends the span after its execution is ended.This has the added bonus of:
Errorif the operation throws an exceptionOriginally the approach suggested
AutoCloseablebut I feel this approach is preferable given that it's now in an opt-in module of syntactic enhancements.Closes #4
Testing
Added unit tests.