-
I'm trying to add certain baggage entries to the server spans in my service that's auto instrumented by the agent. I have baggage propagation working and wrote my own SpanProcessor, but I am having a hard time adding my custom SpanProcessor. I stumbled across #2022 and the test repo is a really good reference of what I'd like to do (it has a DemoSpanProcessor). It's difficult to follow along the discussion in #2022 as there's been quite a bit of refactoring since then. Can someone please point me in the right direction? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 14 replies
-
hey @fuleow! check out https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/examples/distro also, we are planning to support this without having to build your own custom distro, follow #2442 for future updates |
Beta Was this translation helpful? Give feedback.
-
Hi there - I had the BaggageSpanProcessor (from the contrib project) working. Then I tried to add an additional custom span processor with its own SPI. I'm using the embed approach, so I have a java-agent jar that has /extensions: I believe my extension is configured correctly. It implements
afaict, my extension is not doing anything, but I have absolutely no idea how to debug that. One thing I will note is that my custom span processor has a Slf4J logger as I'm trying to get some logging in there to refine it, but I have also provided a slf4j implementation on the java-agent classpath
So, two questions:
|
Beta Was this translation helpful? Give feedback.
-
OK, I have satisfied myself that the latest image with javaagent jar containing my extension is being pulled. I still do not see my logging. I modified my extension to use java.util logging only. What is the best way to provide the sample project? |
Beta Was this translation helpful? Give feedback.
-
@laurit thank you, that's great. It does seem to be working for me now as well, so I'm not sure what bit I took out that made the difference, but I'll take it. One last question. Is there any way to make the java agent output structured logging? |
Beta Was this translation helpful? Give feedback.
hey @fuleow! check out https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/examples/distro
also, we are planning to support this without having to build your own custom distro, follow #2442 for future updates