now that we have Ktor 3.0.0 stable, are there any ...
# ktor
h
now that we have Ktor 3.0.0 stable, are there any updates on supporting open telemetry soon, we can't roll out to production currently without this https://youtrack.jetbrains.com/issue/KTOR-7515/Add-support-for-OpenTelemetry-plugin-for-3.x.x-versions
👀 5
c
Hi I’m trying to upgrade to Ktor 3.0.1 and with it to use the new
opentelemetry-ktor-3.0
. I’m using
Copy code
io.opentelemetry.instrumentation:opentelemetry-ktor-3.0:2.10.0-alpha
with the agent
Copy code
io.opentelemetry.javaagent:opentelemetry-javaagent:2.10.0
and I’m getting a weird exception using
io.ktor:ktor-server-auth
for the OAuth flow when trying to exchange the access code for the access token
Copy code
Authentication failed for /SOME-URL-I-CANT-SHARE with error Failed to request OAuth2 access token due to java.lang.ClassCastException: class io.opentelemetry.javaagent.instrumentation.opentelemetryapi.context.AgentContextWrapper cannot be cast to class io.opentelemetry.javaagent.shaded.io.opentelemetry.context.Context (io.opentelemetry.javaagent.instrumentation.opentelemetryapi.context.AgentContextWrapper is in unnamed module of loader 'app'; io.opentelemetry.javaagent.shaded.io.opentelemetry.context.Context is in unnamed module of loader 'bootstrap')
do you have any idea what could be causing the issue?
e
@Maria Skripchenko
c
BTW removing
Copy code
install(KtorClientTracing) {
        setOpenTelemetry(openTelemetry)
    }
makes that exception go away, so it should be something to do with the client tracing
also the issue it is not directly related to
io.ktor:ktor-server-auth
if I disable the plugin any calls from my http client end up failing having the same
ClassCastException
m
@Carlos Garcia Can you please create an issue in YouTrack https://youtrack.jetbrains.com/newIssue?project=KTOR
👍 1
c
https://youtrack.jetbrains.com/issue/KTOR-7798/opentelemetry-ktor-3.0-issue-with-httpClient, I’ve added a link to a github repo with a sample app to be able to reproduce the issue
thank you color 1
BTW I just tested it with the newer version of
opentelemetry-ktor-3.0
(2.14.0) and the issue seems to be fixed
e
thank you for the update!
👍 1
c
sorry I take it back, the issue still exists, I forgot the issue was when doing
Copy code
install(KtorClientTelemetry) {
        setOpenTelemetry(openTelemetry)
    }
in the new service I tested it, it didn’t use it
e
reverted
thanks for the update again!
c
perhaps the plugin needs to check if an agent is running to pull the right context