opentelemetry-java-instrumentation icon indicating copy to clipboard operation
opentelemetry-java-instrumentation copied to clipboard

New agent instrumentation for Apache Sling

Open rombert opened this issue 2 years ago • 7 comments

The new Apache Sling instrumentation ensures that top-level routes reflect the Sling Servlet (or script) handling the script and also that nested spans created by including components point to the right handler.

I've done extensive testing locally but since this is my first contribution there might be some rough edges. I'll add some screenshots to clarify what this looks like in practice.

Rendering with nested components

image

Rendering with top-level servlet

image

rombert avatar Sep 14 '23 14:09 rombert

@rombert could you also add tests for your instrumentation

laurit avatar Sep 15 '23 05:09 laurit

@laurit , sure I'll look into that. I will probably go for container-based tests as it's not trival to set up a Sling instance with the full Engine and it will also make testing against various versions easier. I was looking at https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/cassandra/cassandra-4.4/library/src/test/java/io/opentelemetry/instrumentation/cassandra/v4_4/CassandraTest.java ( and https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/cassandra/cassandra-4.4/testing/src/main/java/io/opentelemetry/testing/cassandra/v4_4/AbstractCassandra44Test.java / https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/cassandra/cassandra-4-common/testing/src/main/java/io/opentelemetry/cassandra/v4/common/AbstractCassandraTest.java ). Are those good examples of doing such tests?

What is not clear to me is how the agent is injected in the container running the system under test, do you have an idea about that?

rombert avatar Sep 15 '23 11:09 rombert

@rombert with cassandra there is no need to inject the agent into the image as we are testing cassandra client not the server. Tests that inject agent into an image are in https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/smoke-tests Tests that accompany the instrumentation automatically run with the agent, currently all of them use the tested framework inside the test. Consider if it is possible to start an embedded version of the sling inside the test, if it needs other services then perhaps these can be run in container with testcontainers. If this is not suitable for you then it will be a bit tricky as it would deviate from what all other tests do.

laurit avatar Sep 15 '23 13:09 laurit

Thanks for the reviews @laurit and @breedx-splk . This is still on my to-do list but I did not manage to get back to it. Hopefully soon :-)

rombert avatar Feb 06 '24 17:02 rombert