beskow commented on PR #22677:
URL: https://github.com/apache/camel/pull/22677#issuecomment-4283488921

   Being able to add a baggage entry using a camel header or property would be 
really great!
   
   In your example above, it looks like you have traceProcessors=true. I hope 
that is not a requirement, since generating technical spans would not generally 
be acceptable.
   
   I don't mind using the Otel APIs (they are after abstractions in themselves, 
not implementation details), but they are clearly not sufficient in this case. 
As you say, my original proposal depends on Camel implementation details for 
the otel/camel bridge, which is indeed unfortunate. I certainly agree it would 
be much better if we can achieve the same result with just Camel-idiomatic 
constructs (like headers or properties).
   
   My original acceptance test, adapted to the syntax you propose:
   
   `
       @Test
       void testSetBaggage() throws InterruptedException {
           MockEndpoint mock = getMockEndpoint("mock:baggage");
           mock.expectedMessageCount(1);
           template.sendBody("direct:setBaggage", "Hello");
           mock.assertIsSatisfied();
           mock.getExchanges().forEach(exchange -> {
               String baggage = exchange.getIn().getHeader("baggage", 
String.class);
               assertTrue(baggage.contains("tenant.id=acme"));
           });
       }
   
       @Override
       protected RoutesBuilder createRouteBuilder() {
           return new RouteBuilder() {
               @Override
               public void configure() {
                   from("direct:setBaggage")
                           .process(new Processor() {
                               @Override
                               public void process(Exchange exchange) {
                                   
exchange.getIn().setHeader("BAGGAGE_tenant.id", "acme");
                               }
                           })
                           .to("mock:baggage");
               }
           };
       }
   `
   
   Let me know if I can assist you further in this! Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to