Hi,

I am interested in finding out what script/servlet was used to serve a
given request. I am doing this for observability reasons, to be able to
report traces via opentelemetry [1] . OTEL works using bytecode
instrumentation, so I'm not worried about how to intercept calls, but
more about how to find out the info with very low performance impact.

I checked the SlingHttpServletRequest and SlingHttpServletResponse APIs
and I see no place where that information is stored.

I traced the request handling starting from the SlingMainServlet [2] ->
SlingRequestProcessorImpl [3] -> RequestData [4] but when the servlet
resolution happens I can't be sure that this is the top-level resource
being resolved.

Does anyone have any ideas about how I can identify the script that is
being used to serve the top-level request? I'd want to avoid:

a) changing code in Sling
b) doing excessive work ( e.g. re-running servlet resolution )

Thanks!

Robert


[1]:
https://github.com/open-telemetry/opentelemetry-java-instrumentation
[2]:
https://github.com/apache/sling-org-apache-sling-engine/blob/98dc1b918958ad32a18b1bd70020d7de78af3d12/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java#L130-L131
[3]:
https://github.com/apache/sling-org-apache-sling-engine/blob/98dc1b918958ad32a18b1bd70020d7de78af3d12/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java#L231
[4]:
https://github.com/apache/sling-org-apache-sling-engine/blob/98dc1b918958ad32a18b1bd70020d7de78af3d12/src/main/java/org/apache/sling/engine/impl/request/RequestData.java#L244

Reply via email to