-
Notifications
You must be signed in to change notification settings - Fork 859
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
Add Ktor 3.0.0 support #12453
Add Ktor 3.0.0 support #12453
Conversation
2aa3669
to
85513ba
Compare
The instrumentation for ktor 2 and 3 looks really similar. The only difference I was able to spot is in https://github.com/ktorio/opentelemetry-java-instrumentation/blob/8e0154b25564612af1870ec75e0bbf9f366f7ea5/instrumentation/ktor/ktor-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/ktor/v3_0/ServerInstrumentation.java#L28 My question is are there more changes needed to make instrumentation work on ktor 3? If not then I think we don't need to add a separate module for ktor 3, you could just replace |
Hey @laurit, thanks for the review! The only thing I'm afraid of is that we might need to add some extra for 3.1 and other minors (still not a major issue :) ). |
94f1fd6
to
b904265
Compare
i'm really sorry to be bothering here on the PR, but are there any news regarding this? it's a blocker for us to go to production |
Hey @FunkyMuse, let me check the build |
Fixed, let's wait for the new build |
Passed! |
...rc/main/java/io/opentelemetry/javaagent/instrumentation/ktor/v2_0/ServerInstrumentation.java
Outdated
Show resolved
Hide resolved
// this instrumentation creates a span per each physical request | ||
// related issue https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/5722 | ||
disableTestRedirects() |
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 created #12530 to enable the redirect tests for ktor 2. You'll have to make the same change if that PR is merged before yours.
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.
Thanks for noting
docs/supported-libraries.md
Outdated
@@ -92,7 +92,7 @@ These are the supported libraries and frameworks: | |||
| [Jodd Http](https://http.jodd.org/) | 4.2+ | N/A | [HTTP Client Spans], [HTTP Client Metrics] | | |||
| [JSP](https://javaee.github.io/javaee-spec/javadocs/javax/servlet/jsp/package-summary.html) | 2.3+ | N/A | Controller Spans [3] | | |||
| [Kotlin Coroutines](https://kotlinlang.org/docs/coroutines-overview.html) | 1.0+ | N/A | Context propagation | | |||
| [Ktor](https://github.com/ktorio/ktor) | 1.0+ | [opentelemetry-ktor-1.0](../instrumentation/ktor/ktor-1.0/library),<br>[opentelemetry-ktor-2.0](../instrumentation/ktor/ktor-2.0/library) | [HTTP Client Spans], [HTTP Client Metrics], [HTTP Server Spans], [HTTP Server Metrics] | | |||
| [Ktor](https://github.com/ktorio/ktor) | 1.0+ | [opentelemetry-ktor-1.0](../instrumentation/ktor/ktor-1.0/library),<br>[opentelemetry-ktor-2.0](../instrumentation/ktor/ktor-2.0/library) | [HTTP Client Spans], [HTTP Client Metrics], [HTTP Server Spans], [HTTP Server Metrics] | |
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.
Please reformat the table.
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.
done
id("org.jetbrains.kotlin.jvm") | ||
} | ||
|
||
val ktorVersion = "3.0.0" |
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.
You have test classes under src/main so the tests really won't be executed. What you need to do is have the common testing classes in this module and move the tests elsewhere. I'd use the gradle test suite feature and create a suite for ktor3 under both ktor2 library and javaagent modules. Let me know if it is unclear how to do this.
@e5l I tried getting the tests running by changing the test from agent tests to library tests just to see whether they work. Agent tests need to be run with the agent which requires using a different convention in the gradle build file which we can sort out later. I could not get them running and need your help with this. Here is the diff with my changes
the http client test works fine, but for the server tests I need help with implementing the |
Sure, let me check |
It looks like the problem is with generic variance and we will have to make a separate module to avoid it |
I've managed to fix the difference. The only thing that needs a workaround is - the binary breaking change around the call started event. Checking if it can be fixed without splitting the modules |
@laurit, looks like the build is good. Could you check? |
Outdated when #12562 will be merged. |
Ktor 3.0 has been released last week.
This PR adds a new module to support the next major release.
Fix KTOR-7515