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

ktor auto-instrumentation doesn't work without client libraries loaded #11448

Closed
kjschnei001 opened this issue May 23, 2024 · 0 comments · Fixed by #11454
Closed

ktor auto-instrumentation doesn't work without client libraries loaded #11448

kjschnei001 opened this issue May 23, 2024 · 0 comments · Fixed by #11454
Labels
bug Something isn't working needs triage New issue that requires triage

Comments

@kjschnei001
Copy link

Describe the bug

It is possible to use ktor as an http server without using it for client calls, such as applications which do not need to make client calls. Currently, the server instrumentation seems to be tied to the client instrumentation, such that if the client instrumentation fails, so will the server instrumentation:

ktor-sample-app-1  | [otel.javaagent 2024-05-23 20:05:41:319 +0000] [main] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - Instrumentation skipped, mismatched references were found: ktor [class io.opentelemetry.javaagent.instrumentation.ktor.v2_0.KtorInstrumentationModule] on jdk.internal.loader.ClassLoaders$AppClassLoader@2b2fa4f7
ktor-sample-app-1  | [otel.javaagent 2024-05-23 20:05:41:338 +0000] [main] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - -- io.opentelemetry.javaagent.shaded.instrumentation.ktor.v2_0.client.KtorClientTracing$Companion:64 Missing class io.ktor.client.request.HttpSendPipeline$Phases
ktor-sample-app-1  | [otel.javaagent 2024-05-23 20:05:41:339 +0000] [main] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - -- io.opentelemetry.javaagent.shaded.instrumentation.ktor.v2_0.client.KtorClientTracing:42 Missing class io.ktor.client.statement.HttpResponse
ktor-sample-app-1  | [otel.javaagent 2024-05-23 20:05:41:339 +0000] [main] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - -- io.opentelemetry.javaagent.shaded.instrumentation.ktor.v2_0.client.KtorClientTracing:42 Missing class io.ktor.client.request.HttpRequest
ktor-sample-app-1  | [otel.javaagent 2024-05-23 20:05:41:339 +0000] [main] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - -- io.opentelemetry.javaagent.instrumentation.ktor.v2_0.HttpClientInstrumentation$ConstructorAdvice:49 Missing class io.ktor.client.plugins.HttpClientPlugin
ktor-sample-app-1  | [otel.javaagent 2024-05-23 20:05:41:339 +0000] [main] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - -- io.opentelemetry.javaagent.shaded.instrumentation.ktor.v2_0.client.KtorClientTracing$Companion:88 Missing class io.ktor.client.statement.HttpReceivePipeline
ktor-sample-app-1  | [otel.javaagent 2024-05-23 20:05:41:339 +0000] [main] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - -- io.opentelemetry.javaagent.shaded.instrumentation.ktor.v2_0.client.KtorClientTracing$Companion:58 Missing class io.ktor.client.HttpClient
ktor-sample-app-1  | [otel.javaagent 2024-05-23 20:05:41:340 +0000] [main] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - -- io.opentelemetry.javaagent.instrumentation.ktor.v2_0.HttpClientInstrumentation$ConstructorAdvice:49 Missing class io.ktor.client.HttpClientConfig
ktor-sample-app-1  | [otel.javaagent 2024-05-23 20:05:41:340 +0000] [main] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - -- io.opentelemetry.javaagent.shaded.instrumentation.ktor.v2_0.client.KtorClientTracing:42 Missing class io.ktor.client.request.HttpRequestKt
ktor-sample-app-1  | [otel.javaagent 2024-05-23 20:05:41:340 +0000] [main] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - -- io.opentelemetry.javaagent.shaded.instrumentation.ktor.v2_0.client.KtorClientTracing:28 Missing class io.ktor.client.request.HttpRequestBuilder
ktor-sample-app-1  | [otel.javaagent 2024-05-23 20:05:41:340 +0000] [main] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - -- io.opentelemetry.javaagent.shaded.instrumentation.ktor.v2_0.client.KtorClientTracing$Companion:64 Missing class io.ktor.client.request.HttpSendPipeline
ktor-sample-app-1  | [otel.javaagent 2024-05-23 20:05:41:340 +0000] [main] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - -- io.opentelemetry.javaagent.shaded.instrumentation.ktor.v2_0.client.KtorClientTracing$Companion:88 Missing class io.ktor.client.statement.HttpReceivePipeline$Phases

Steps to reproduce

Running docker-compose up --build -d for this application should reproduce the results: https://github.com/kjschnei001/ktor-sample

Expected behavior

ktor server-side auto-instrumentation should work even if the client libraries aren't loaded.

Actual behavior

ktor server-side auto-instrumentation only works if the client libraries are loaded.

Javaagent or library instrumentation version

v2.4.0

Environment

JDK: Running on Java 17.0.11. JVM OpenJDK 64-Bit Server VM - Eclipse Adoptium - 17.0.11+9
OS: Linux d1765f007e01 6.5.0-35-generic #35-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 27 00:18:38 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux

Additional context

No response

@kjschnei001 kjschnei001 added bug Something isn't working needs triage New issue that requires triage labels May 23, 2024
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 triage New issue that requires triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant