Skip to content

Don't double instrument when using instrumented Ktor client with OkHttp engine #949

@lcian

Description

@lcian

Problem Statement

We're about to release a Ktor client integration for sentry-java.
If a customer uses Ktor client with our integration, OkHttp as the engine for Ktor client, and SAGP with auto-instrumentation for OkHttp, they will end up with doubly instrumented HTTP calls.
While we're going to document very clearly that they should instrument either one or the other, users might still run into this.
There might be a way to detect if calls are being doubly instrumented and deactivate one of the two instrumentations.

Solution Brainstorm

I'm not sure if this is possible in the first place. The bytecode manipulation code would basically have to detect whether OkHttp is running inside Ktor or on its own.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions