-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Record exception for async servlet invocations (open-telemetry#4677)
* Record exception for asyn servlet invocations * add back accidentally commented out line * rearrange test so that it passes on both jetty and tomcat
- Loading branch information
Showing
18 changed files
with
217 additions
and
118 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...opentelemetry/javaagent/instrumentation/servlet/v3_0/Servlet3AsyncContextStartAdvice.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,27 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.javaagent.instrumentation.servlet.v3_0; | ||
|
||
import static io.opentelemetry.javaagent.instrumentation.servlet.v3_0.Servlet3Singletons.helper; | ||
|
||
import javax.servlet.AsyncContext; | ||
import javax.servlet.ServletRequest; | ||
import javax.servlet.http.HttpServletRequest; | ||
import net.bytebuddy.asm.Advice; | ||
|
||
@SuppressWarnings("unused") | ||
public class Servlet3AsyncContextStartAdvice { | ||
|
||
@Advice.OnMethodEnter(suppress = Throwable.class) | ||
public static void start( | ||
@Advice.This AsyncContext asyncContext, | ||
@Advice.Argument(value = 0, readOnly = false) Runnable runnable) { | ||
ServletRequest request = asyncContext.getRequest(); | ||
if (request instanceof HttpServletRequest) { | ||
runnable = helper().wrapAsyncRunnable((HttpServletRequest) request, runnable); | ||
} | ||
} | ||
} |
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
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
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
27 changes: 27 additions & 0 deletions
27
...o/opentelemetry/javaagent/instrumentation/servlet/v5_0/async/AsyncContextStartAdvice.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,27 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.javaagent.instrumentation.servlet.v5_0.async; | ||
|
||
import static io.opentelemetry.javaagent.instrumentation.servlet.v5_0.Servlet5Singletons.helper; | ||
|
||
import jakarta.servlet.AsyncContext; | ||
import jakarta.servlet.ServletRequest; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import net.bytebuddy.asm.Advice; | ||
|
||
@SuppressWarnings("unused") | ||
public class AsyncContextStartAdvice { | ||
|
||
@Advice.OnMethodEnter(suppress = Throwable.class) | ||
public static void start( | ||
@Advice.This AsyncContext asyncContext, | ||
@Advice.Argument(value = 0, readOnly = false) Runnable runnable) { | ||
ServletRequest request = asyncContext.getRequest(); | ||
if (request instanceof HttpServletRequest) { | ||
runnable = helper().wrapAsyncRunnable((HttpServletRequest) request, runnable); | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.