opentelemetry-java-instrume.../instrumentation/tomcat
Ago Allikmaa a9788a22de
Provide ability to add HTTP server response headers, with Tomcat implementation (#7990)
This allows custom distributions of the agent to register
`HttpServerResponseCustomizer` implementations. When a supported HTTP
server instrumentation starts processing a response, the `onStart`
method of all registered implementations will be invoked with the
`Context` of the SERVER span, an instrumentation-specific response
object and `HttpServerResponseMutator` instance that allows appending
headers to that response.

The intent of this is to allow custom distributions to set a header
containing span context information, such as the trace and span IDs. As
such, the initial implementation only allows appending response headers
and nothing else.

The `HttpServerResponseCustomizer` and related classes are currently in
a subpackage of the `io.opentelemetry.javaagent.bootstrap` package in
`javaagent-extension-api`. This makes them get loaded in the bootstrap
classloader, thus directly accessible from instrumentations. I am not
aware if there is an elegant way to put it in the agent classloader
instead, yet have the same instance accessible from both
`AgentInstaller` and instrumentations.

This also includes Tomcat-specific implementation in order to be able to
demonstrate that it works, and add automated testing of this to
HttpServerTest including one implementation.
2023-03-13 17:46:39 +01:00
..
tomcat-7.0/javaagent Provide ability to add HTTP server response headers, with Tomcat implementation (#7990) 2023-03-13 17:46:39 +01:00
tomcat-10.0/javaagent Provide ability to add HTTP server response headers, with Tomcat implementation (#7990) 2023-03-13 17:46:39 +01:00
tomcat-common/javaagent Remove deprecated instrumentation-api-semconv code (#7838) 2023-02-16 13:16:52 -08:00
tomcat-jdbc Update error prone (#6646) 2022-09-23 11:24:40 -07:00
README.md Introduce markdown lint check (#7175) 2022-11-16 20:48:42 -08:00

README.md

Instrumentation for Tomcat request handlers

Tomcat support is divided into the following sub-modules:

  • tomcat-common:javaagent contains common type instrumentation, advice helper classes and abstract tracer used by the javaagent modules of all supported Tomcat versions
  • tomcat-7.0:javaagent applies Tomcat request handler instrumentation for versions [7, 10)
  • tomcat-10.0:javaagent applies Tomcat request handler instrumentation for versions [10,)

Instrumentations in tomcat-7.0 and tomcat-10.0 are mutually exclusive, this is guaranteed by tomcat-10.0 instrumentation checking that its Request class uses jakarta.servlet classes, and the tomcat-7.0 module doing the opposite check.