Support #5072
closedpass distributed tracing data through xslt transformer
0%
Description
Hello,
We have a service written in java which do xslt transformations with saxonica. On xslt stylesheets we call other services with fn:doc() or fn:document() functions suppling them HTTP URL. Now we are implementing distributed tracing of our services and faced with need to pass additional tracing headers in HTTP requests which lay under the fn:doc/fn:document calls. How can we achieve it? I guess that I need to supply something to XsltTransformer object but I can't understand what exactly it should be, unfortunately. Help please.
Alexey.
Updated by Michael Kay over 2 years ago
Set a URIResolver on the XSLT Transformer; this will be passed details of URI's supplied to the doc() or document() functions. In your URIResolver, perform the HTTP access using low-level Java HTTP library calls (setting the headers as required), and returning a stream. Wrap this InputStream in a StreamSource, along with the requested (or resolved) URI, and return this from your URIResolver.
Updated by Alexey Oparin over 2 years ago
Thank you, Michael. I did this way and it worked. Ironically, after that we tried opentelemetry java instrumentation and it worked without custom URIResolver.
Please register to edit this issue