-
Notifications
You must be signed in to change notification settings - Fork 36
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
sdk-trace: add SpanProcessor
#374
Conversation
d488cd9
to
04d067c
Compare
sdk/trace/src/main/scala/org/typelevel/otel4s/sdk/trace/SpanProcessor.scala
Outdated
Show resolved
Hide resolved
sdk/trace/src/main/scala/org/typelevel/otel4s/sdk/trace/SpanRef.scala
Outdated
Show resolved
Hide resolved
04d067c
to
4f4a3dc
Compare
4f4a3dc
to
d93d4a6
Compare
* @tparam F | ||
* the higher-kinded type of a polymorphic effect | ||
*/ | ||
trait SpanRef[F[_]] { self: Span.Backend[F] => |
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.
Sorry to be late 😅 but I do think we should bikeshed this name. As far as I understand there is nothing Ref
-like here, i.e. you can't set
anything. But you may read effectually, which does make it similar to RefSource
.
Sorry, I don't have better naming ideas 😕
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.
Java SDK uses ReadWriteSpan and ReadableSpan.
ReadWriteSpan is not ideal, but more meaningful
def isEndRequired: Boolean = endOnly.nonEmpty | ||
|
||
def onStart(parentCtx: Option[SpanContext], span: SpanRef[F]): F[Unit] = | ||
startOnly.parTraverse_(_.onStart(parentCtx, span)) |
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.
Usual issue here about failure and short-circuiting.
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.
.attempt should be enough
ReadWriteSpan.java
ReadableSpan.java
Why do we need a
SpanRef
?Some
SpanProcessor
s may require access to the internal state of a span (e.g. actual name, SpanData, etc). The changes made to the span must be accessible by the processor. For example, we can implement a span leak detector that determines whether the span is leaked based on the state.P.S. Java SDK calls the interface
ReadableSpan
rather thanSpanRef
. So, I'm open to better name suggestions :)