-
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
Unable to start span as current #202
Comments
This is a tricky problem and worth much more thought. Our "current" span is based on a
|
@rossabaker Thanks, for the reply. Yeah, I totally agree with both points:
I just wanted to callout problem that as of now Happy to hear your thoughts. |
Right now at work, we're tracing JDBC via Doobie and Natchez. The transactor gives us a hook into obtaining a |
We can still expose some utility methods from It will not solve the thread local's propagation issue, but at least an end user can extend the existing Java's span (and vice versa). I agree that we should seamlessly integrate with Java thread-local propagation, but this topic is quite complicated. Especially taking into account the Scala-first implementation of the tracing logic. |
Guys, last question. I'm curious about overall instrumentation concept from otel4s perspective. Let's consider example of having Kafka (though fs2-kafka) or Elastic (though elastic4s) clients in codebase. What' the way to go to instrument common cases like those: are there will be set of custom instrumentations for higher level clients (e.g. elastic4s and fs2) or you are planning to leverage existing instrumentation? Or app devs supposed to make tracing middleware by themselves? Thanks. |
Throwing this out there, so take it for what it's worth, but we'll soon have a pure-Scala implementation as well, which means otel4s will work with Scala.js too. It'd be interesting to see how propagation works in that context and how best to enable interop with the JS ecosystem. |
I think we'd want to leverage existing instrumentation when we can.
That third category is where we'd seriously need a smooth handoff between otel4s state and opentelemetry-java state. |
I think we can replace the Java SDK's context storage with an implementation that wraps around our IOLocal Vault. One way is to implement an SPI. SPIs need to have a no-arg constructor, which means we would need to do unutterable things with respect to Another way is a wrapper (we call these middlewares in various other Typelevel projects). That would give us the facility to create one in IO and invoke it before loading the SDK. |
@rossabaker Recently I thought about following case: what if we have two fibers running on top of one thread. I assume there are much more corner cases like this can be found, which makes me think and agree with you, that due two runtimes are involved this would be pretty hard, or even feasible at all to have stable Java's OTEL interop. So, as a conclusion, I can assume that perhaps IO native instrumentation, at least for the most popular libs, is the way to go for app or lib developers. Does it make sense? |
I just put up a PR on Cats Effect that proof-of-concepts how we can safely expose |
Neat. One tricky thing about ContextStorage is that it while its attach and scope might implement a signature like |
Reproducible example:
Would print following output:
Current otel4s API does not provide the ability to make the span current and started span is not current. Because of this, I assume, a combination with existing Java instrumentations does not work - because spans that are supposed to be child spans started by auto-instrumentations have no proper parent.
Happy to submit PR. But I am not sure which way is preferable:
def makeCurrent: F[Unit]
wrapper method.TracerProvider
to make started span current.I assume a combination of second and third options is preferable.
Thanks.
The text was updated successfully, but these errors were encountered: