-
Notifications
You must be signed in to change notification settings - Fork 37
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
A Natchez-like "continuation" API to avoid MonadCancelThrow leakage? #85
Comments
I think the |
I added a naive spanK to def spanK(name: String, attributes: Attribute[_]*): F ~> F =
macro TracerMacro.spanK But the macro inlines the implementation, and thus need for a |
Not ideal, but we can hide some instances there https://github.com/typelevel/otel4s/blob/main/core/common/src/main/scala/org/typelevel/otel4s/meta/InstrumentMeta.scala |
That Tracer[F].span("Work.DoWork").use { span =>
span.addEvent("Starting the work.") *>
doWorkInternal *>
span.addEvent("Finished working.")
} |
This is an uphill climb, because |
We still need a |
Compared to
natchez.Trace
, a library instrumented withorg.typelevel.otel4s.trace.Tracer
may require stronger constraints.Natchez
The Natchez
Trace
API includes:Typical usage is:
Spanning
someEffect
only requires aTrace
constraint.Otel4s
As of #37, our Tracer provides the following API, via TracerMacro:
We might do:
Or, equivalently, and closer to Natchez:
.use
and.surround
both introduce aMonadCancelThrow
constraint on spanned code, even if the concrete tracer is the simple, applicative noop. It's nice to have the full power of resource, but it's also now difficult to instrument an existing library without constraints rippling beyondTracer
.The text was updated successfully, but these errors were encountered: