Skip to content
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

OpenTelemetry RxJava & OkHttp+Retrofit libraries generate isolated spans on Rx rescheduling #8144

Open
ponomarevlm opened this issue Mar 27, 2023 · 2 comments
Labels
bug Something isn't working needs repro

Comments

@ponomarevlm
Copy link

ponomarevlm commented Mar 27, 2023

Jaeger is used for visualisation.

Describe the bug
When I configure OkHttp client as described here and then use it with Retrofit and it's RxJava2CallAdapterFactory.createWithScheduler(Schedulers.io()) which reschedules calls, spans are isolated. With a custom tracing assembly (see below) they are linked.

Steps to reproduce

    fun retrofit() {
        tracer.spanStart("retrofit") {
            api.query()
                .andThen(api.error())
                .doOnTerminate { it.end() }
                .subscribe({/* ignore */ }, {/* swallow */ })
        }
    }

Full demo source can be found here

What did you expect to see?
Chained okhttp+retrofit+rx calls should be linked to parent
image

What did you see instead?
For retrofit spans are not linked together:
image

What version are you using?
opentelemetry-api:1.24.0
opentelemetry-rxjava-2.0:1.24.0-alpha
opentelemetry-okhttp-3.0:1.24.0-alpha

Environment
Compiler: Android Studio Embedded JDK 11.0.15
OS: macOS 12.2 Monterey
Runtime: Android 10 ART
OS: Android 10

Additional context
I have tried to move context capturing to on*Assembly with custom tracing assembly. It works a bit better standalone or with stock, at least it gathers retrofit chains (see retrofit expectations illustration), but it breaks tests when ported into stock.

@ponomarevlm ponomarevlm added the bug Something isn't working label Mar 27, 2023
@ponomarevlm ponomarevlm changed the title OpenTelemetry RxJava & OkHttp+Retrofit libraries generate wrong and isolated spans on Rx rescheduling OpenTelemetry RxJava & OkHttp+Retrofit libraries generate isolated spans on Rx rescheduling Mar 27, 2023
@trask
Copy link
Member

trask commented Aug 10, 2023

@ponomarevlm (some of the) folks in this repo (me) aren't very android savvy, can this be reproduced as a standalone Java app?

@trask
Copy link
Member

trask commented Aug 24, 2023

hi @ponomarevlm, I think we would need a standalone repro that we can easily run in order to debug and understand this issue, is that something you could provide?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs repro
Projects
None yet
Development

No branches or pull requests

2 participants