Skip to content
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

New agent instrumentation for Apache Sling #9469

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

rombert
Copy link

@rombert rombert commented Sep 14, 2023

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 rombert requested a review from a team September 14, 2023 14:42
@laurit
Copy link
Contributor

laurit commented Sep 15, 2023

@rombert could you also add tests for your instrumentation

@rombert
Copy link
Author

rombert commented Sep 15, 2023

@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?

@laurit
Copy link
Contributor

laurit commented Sep 15, 2023

@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.

Copy link
Contributor

@breedx-splk breedx-splk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation looks good to me. I agree with @laurit tho and would like to see tests.

name = servlet.getServletConfig().getServletName();
}
if (name == null || name.isEmpty()) {
name = servlet.getServletInfo();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could see this as potentially surprising if it shows up as the "name", but I think it's fine. Hopefully more informative than just the class name when the name is missing from the config.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could've sworn that I found this pattern in the repository, but I can't find it anymore.

@rombert
Copy link
Author

rombert commented Feb 6, 2024

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 :-)

@jaydeluca
Copy link
Member

@rombert are you still working on this?

@rombert
Copy link
Author

rombert commented Feb 4, 2025

@jaydeluca - it's on my list, yes, but it gets pushed back by other priorities. I don't have a timeline for resuming work on it.

@rombert rombert requested a review from a team as a code owner February 5, 2025 14:44
@rombert
Copy link
Author

rombert commented Feb 5, 2025

I just rebased to the latest main branch. Still plan to look into adding tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants