-
Notifications
You must be signed in to change notification settings - Fork 873
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert servlet instrumentation to instrumenter api (#4078)
* Convert servlet to instrumenter api * make classes final * Remove some tracer files * remove xxx * fix liberty and wildfly exception smoke test * fix async smoke test on liberty * Apply suggestions from code review Co-authored-by: Mateusz Rzeszutek <[email protected]> * generic TextMapGetter for servlets * not going to use http.route for servlets * simplify * add servlet timeout in attribute extractor * move classes from library to javaagent * remove unneeded dependency * make method private * move helper class initialization to singleton, remove helpers that don't have any methods, add shouldStart checks * Update instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletRequestContext.java Co-authored-by: Mateusz Rzeszutek <[email protected]> * add import * rename methods that start and end spans Co-authored-by: Mateusz Rzeszutek <[email protected]>
- Loading branch information
Showing
75 changed files
with
1,932 additions
and
798 deletions.
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.