-
Notifications
You must be signed in to change notification settings - Fork 873
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
Convert servlet instrumentation to instrumenter api #4078
Merged
Merged
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
b4f4204
Convert servlet to instrumenter api
laurit 5998391
make classes final
laurit c4fa8c6
Remove some tracer files
laurit 0cba234
remove xxx
laurit e5bc205
fix liberty and wildfly exception smoke test
laurit fdf23ea
fix async smoke test on liberty
laurit 60d7099
Apply suggestions from code review
laurit 67f0b6b
generic TextMapGetter for servlets
laurit 1f037f3
not going to use http.route for servlets
laurit 31ed2c8
simplify
laurit 03f3978
add servlet timeout in attribute extractor
laurit 22b4315
move classes from library to javaagent
laurit 238fd19
remove unneeded dependency
laurit bf496ec
make method private
laurit a6fb762
move helper class initialization to singleton, remove helpers that do…
laurit f5a1f64
Update instrumentation/servlet/servlet-common/javaagent/src/main/java…
laurit 376df87
add import
laurit ef21f97
rename methods that start and end spans
laurit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
.../java/io/opentelemetry/javaagent/instrumentation/jetty/v11_0/Jetty11HttpServerTracer.java
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
...c/main/java/io/opentelemetry/javaagent/instrumentation/jetty/v11_0/Jetty11Singletons.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.javaagent.instrumentation.jetty.v11_0; | ||
|
||
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; | ||
import io.opentelemetry.javaagent.instrumentation.jetty.common.JettyHelper; | ||
import io.opentelemetry.javaagent.instrumentation.servlet.ServletInstrumenterBuilder; | ||
import io.opentelemetry.javaagent.instrumentation.servlet.ServletRequestContext; | ||
import io.opentelemetry.javaagent.instrumentation.servlet.ServletResponseContext; | ||
import io.opentelemetry.javaagent.instrumentation.servlet.v5_0.Servlet5Accessor; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
|
||
public final class Jetty11Singletons { | ||
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.jetty-11.0"; | ||
|
||
private static final Instrumenter< | ||
ServletRequestContext<HttpServletRequest>, ServletResponseContext<HttpServletResponse>> | ||
INSTRUMENTER = | ||
ServletInstrumenterBuilder.newInstrumenter( | ||
INSTRUMENTATION_NAME, Servlet5Accessor.INSTANCE); | ||
private static final JettyHelper<HttpServletRequest, HttpServletResponse> HELPER = | ||
new JettyHelper<>(INSTRUMENTER, Servlet5Accessor.INSTANCE); | ||
|
||
public static JettyHelper<HttpServletRequest, HttpServletResponse> helper() { | ||
return HELPER; | ||
} | ||
|
||
private Jetty11Singletons() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
...in/java/io/opentelemetry/javaagent/instrumentation/jetty/v8_0/Jetty8HttpServerTracer.java
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
...src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/v8_0/Jetty8Singletons.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.javaagent.instrumentation.jetty.v8_0; | ||
|
||
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; | ||
import io.opentelemetry.instrumentation.servlet.v3_0.Servlet3Accessor; | ||
import io.opentelemetry.javaagent.instrumentation.jetty.common.JettyHelper; | ||
import io.opentelemetry.javaagent.instrumentation.servlet.ServletInstrumenterBuilder; | ||
import io.opentelemetry.javaagent.instrumentation.servlet.ServletRequestContext; | ||
import io.opentelemetry.javaagent.instrumentation.servlet.ServletResponseContext; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
public final class Jetty8Singletons { | ||
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.jetty-8.0"; | ||
|
||
private static final Instrumenter< | ||
ServletRequestContext<HttpServletRequest>, ServletResponseContext<HttpServletResponse>> | ||
INSTRUMENTER = | ||
ServletInstrumenterBuilder.newInstrumenter( | ||
INSTRUMENTATION_NAME, Servlet3Accessor.INSTANCE); | ||
private static final JettyHelper<HttpServletRequest, HttpServletResponse> HELPER = | ||
new JettyHelper<>(INSTRUMENTER, Servlet3Accessor.INSTANCE); | ||
|
||
public static JettyHelper<HttpServletRequest, HttpServletResponse> helper() { | ||
return HELPER; | ||
} | ||
|
||
private Jetty8Singletons() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 0 additions & 50 deletions
50
...ava/io/opentelemetry/javaagent/instrumentation/jetty/common/JettyHandlerAdviceHelper.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
That's something definitely not for this PR, but I wonder if we can simplify this and use the
shouldStart()
check to verify if there's an ongoing SERVER span. Context should be propagated anyway, we shouldn't have to do that manually.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.
This should be jetty specific. We instrument all implementations of
org.eclipse.jetty.server.Handler
and need to make sure that we start span only in the outermost one. I believe that we should useshouldStart
to be consistent with other instrumentations, but I suspect that we can't just replace the existing code with it becauseshouldStart
counts suppressed spans and using it for jetty would blow that number up.