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
rxJava 2 instrumentation #2053
rxJava 2 instrumentation #2053
Conversation
Speak of the devil, I was just looking at issues around not seeing traces propagate in Java Specialagent after using an RxJava2 based MQTT client. Your implementation is quite different from https://github.com/opentracing-contrib/java-specialagent/tree/master/rule/rxjava-2. Is that because Specialagent is missing a lot of cases? |
...on/rxjava-2/src/main/java/datadog/trace/instrumentation/rxjava2/FlowableInstrumentation.java
Outdated
Show resolved
Hide resolved
...on/rxjava-2/src/main/java/datadog/trace/instrumentation/rxjava2/FlowableInstrumentation.java
Outdated
Show resolved
Hide resolved
...on/rxjava-2/src/main/java/datadog/trace/instrumentation/rxjava2/FlowableInstrumentation.java
Show resolved
Hide resolved
@william-tran I haven't looked at that instrumentation, but afaict it only handles observables and not all of the other rxJava constructions. Also the goal of this particular instrumentation is not so much to do with adding named spans for each step in the stream, but propagating the relevant context around. |
d9cfaa6
to
099a571
Compare
099a571
to
b926501
Compare
b926501
to
1866354
Compare
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.
I get a slightly uneasy feeling from Spans
being moved around and reactivated, and potentially finished early by other code. Looking forward to the follow-up with State
.
@bantonsson For the record, that's my position too. |
FWIW I agree the eventual solution will involve something that looks very much like |
This instrumentation takes roughly the same approach as the latest reactor instrumentation:
The general idea is to propagate context so that spans resulting from reactive work created under an active span use that span as their parent, even if the reactive work is triggered later on in the application.
In the future it would be nice to store some kind of continuation structure in the context store rather than the parent span. I did look into using
State
/ConcurrentState
but ran into activation issues when an observable sends multiple events or has multiple observers - so I'd prefer to get this initial approach merged first (with tests) and then iterate on it.