getsentry / getsentry/sentry-java

Apache Camel multicast does not have Hub cloned

Đang mở
#2,330 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Feature Java
Ngôn ngữ chính
Kotlin
Star
1.4k
Fork
478
Merge trung bình
2 ngày 23 giờ
Pull request đã merge (30 ngày)
67

Mô tả

### Integration

sentry

### Java Version

8

### Version

6.6.0

### Steps to Reproduce

Create Apache Camel sample where multicast is used like:

```Java
package io.sentry.samples.spring.boot;

import java.util.UUID;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.model.rest.RestBindingMode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
class RestApi extends RouteBuilder {

@Autowired PersonService personService;

@Override
public void configure() {
CamelContext context = new DefaultCamelContext();

restConfiguration()
.contextPath("/camel")
.port(8080)
.enableCORS(true)
.apiContextPath("/api-doc")
.apiProperty("api.title", "Test REST API")
.apiProperty("api.version", "v1")
.apiContextRouteId("doc-api")
.component("servlet")
.bindingMode(RestBindingMode.json);

rest("/api/")
.id("api-route")
.consumes("application/json")
.post("/bean")
.bindingMode(RestBindingMode.json_xml)
.type(MyBean.class)
.to("direct:remoteService");

rest("/api/")
.id("api-route")
.consumes("application/json")
.post("/bean2")
.bindingMode(RestBindingMode.json_xml)
.type(MyBean.class)
.to("direct:insert");

from("direct:remoteService")
.routeId("direct-route")
.tracing()
.multicast()
.parallelProcessing()
.to("direct:insert", "direct:insert2")
.log(">>> ${body.id}")
.log(">>> ${body.name}")
.transform()
.simple("Hello ${in.body.name}")
.setHeader(Exchange.HTTP_RESPONSE_CODE, constant(200));

from("direct:insert")
.process(
new Processor() {
public void process(Exchange xchg) throws Exception {
// Take the Employee object from the exchange and create the insert query
MyBean employee = xchg.getIn().getBody(MyBean.class);
String query =
"INSERT INTO person(id,firstName, lastName)values('"
+ employee.getId()
+ "','"
+ employee.getName()
+ "','"
+ UUID.randomUUID().toString()
+ "')";
// Set the insert query in body and call camel jdbc
xchg.getIn().setBody(query);
}
})
.to("jdbc:dataSource");

from("direct:insert2")
.process(
new Processor() {
public void process(Exchange xchg) throws Exception {
// Take the Employee object from the exchange and create the insert query
MyBean employee = xchg.getIn().getBody(MyBean.class);
String query =
"INSERT INTO person(id,firstName, lastName)values('9999"
+ employee.getId()
+ "','"
+ employee.getName()
+ "2','"
+ UUID.randomUUID().toString()
+ "')";
// Set the insert query in body and call camel jdbc
xchg.getIn().setBody(query);
}
})
.to("jdbc:dataSource");
}
}
```

Then e.g. check `SentryJdbcEventListener` using a debugger. It's run on a separate thread and has a separate Hub instance and therefore can't find the parent Span using `hub.getSpan()`.

### Expected Result

Hub is somehow cloned or passed to multicasted camel things (whatever the correct term here is) and Spans can be added to the parent span of the multicast.

### Actual Result

Hub is not cloned therefore parent Span can't be found.

### Ideas

We'd need some way of cloning the Hub onto the thread executing each of the multicasted parts. Maybe there's some sort of context in Apache Camel we can use.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.