Comments (15)
See Netflix/Hystrix#92 (comment)
from spring-cloud-sleuth.
I've read the issues, and also taken a look at your extension of HistrixCommand. What is the purpouse of this extension?
What should be use on combimatiom with @HistrixCommamd to allow tracing happen? Should a custom concurrent strategy be implememted?
from spring-cloud-sleuth.
@morfeo8marc the purpose of the extension is to use is when you construct a HystrixCommand
by hand. This issue is to support passing trace data via @HystrixCommand
.
from spring-cloud-sleuth.
Just ran into this issue. 👍
from spring-cloud-sleuth.
When this is implemented, will it handle the case where Hystrix isolation policy is THREAD? I tried using extending TraceCommand instead of annotating with @HystrixCommand and while it does create a span, the trace context is not passed to Hystrix's child thread so the parent/child relationship between spans is lost.
from spring-cloud-sleuth.
The workaround of using a custom ConcurrencyStrategy works for this case:
hystrix.plugin.HystrixConcurrencyStrategy.implementation=SpanPreservingConcurrencyStrategy
This would be the implementation:
public class SpanPreservingConcurrencyStrategy extends HystrixConcurrencyStrategy {
@Override
public <T> Callable<T> wrapCallable(Callable<T> callable) {
return new SpanPreservingCallable<T>(callable);
}
public static class SpanPreservingCallable<T> implements Callable<T> {
private Span currentSpan;
private Callable<T> callable;
public SpanPreservingCallable(Callable<T> callable) {
this.callable = callable;
this.currentSpan = TraceContextHolder.getCurrentSpan();
}
@Override
public T call() throws Exception {
// set span of the calling thread
TraceContextHolder.setCurrentSpan(currentSpan);
try {
return callable.call();
} finally {
// reset span
TraceContextHolder.setCurrentSpan(null);
}
}
}
}
I've tried to make this more extensible so it could be included in spring-cloud-netflix, but I've encountered several problems as this class is instantiated by Hystrix and not by Spring...
from spring-cloud-sleuth.
from spring-cloud-sleuth.
from spring-cloud-sleuth.
I agree, one question though: How would this work if the HystrixCommand does a network call? In that case you'd end up with 2 spans which might be overkill?
from spring-cloud-sleuth.
from spring-cloud-sleuth.
from spring-cloud-sleuth.
Here's a collapsing example, the UI is trained to expand only nodes involving a service is involved in, "lorem" in this case. I clicked on collapse all, and then clicked on "lorem" which expanded paths to it.
Then, I clicked "vitae" which had multiple paths.
from spring-cloud-sleuth.
The solution from @swehner seems like a good idea. The only problem I see is when someone already has a custom strategy.
from spring-cloud-sleuth.
@spencergibb , @dsyer , @adriancole In this commit I've done an initial approach with a test that I guess proves that it's working - 6ecfbca . WDYT about this?
from spring-cloud-sleuth.
Done here - #78
from spring-cloud-sleuth.
Related Issues (20)
- I want to propagate TraceId to all places where parallelStream() and CustomForkJoinPool is used. HOT 3
- CVE-2023-33201 - bcprov-jdk15on HOT 5
- Missing traceId when using spring-cloud-starter-stream-rabbit consumer listeners. HOT 5
- Tracing support for Reactive Kafka (Using KafkaSender and KafkaReceiver) HOT 2
- Spring boot 2.7.10/Sleuth/Micrometer/Prometheus/Brave/Zipkin HOT 1
- java.lang.IllegalStateException: Missing: traceId with AWS propagation type HOT 5
- Jetty BadMessageException request headers too large HOT 3
- LazyTraceThreadPoolTaskExecutor.getQueueSize() does not call a delegate and always returns 0 HOT 3
- ReactorSleuth.tracedMono does not work with parallel processing HOT 1
- TraceReactorAutoConfiguration.HooksRefresher improper queue decoration
- Need documentation for collecting data using baggage. HOT 1
- Sleuth giving different traceIds for each RxJava's Single execution HOT 3
- TraceIds feature for a Request tarvelling across, doesn't seem working. TraceIds are different across a travelling request HOT 3
- After @Async is included in rpc, traceId loss and confusion occur under a large number of requests. HOT 4
- Autoconfiguration does not work in spring-boot 3.x HOT 1
- docs: Getting Started Image Not found
- DataSource Proxy + Spring Could Sleuth not working HOT 4
- spring.zipkin.discoveryClientEnabled ignored when the traced app is webflux HOT 1
- sleuth-3.1.9+datasource-proxy-1.10+flowable-6.8.0 Unable to start the springboot project properly HOT 1
- Why doesn't Sleuth enable Scope when create Span for Kafka Streams by default? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-cloud-sleuth.