Git Product home page Git Product logo

Comments (15)

spencergibb avatar spencergibb commented on May 24, 2024

See Netflix/Hystrix#92 (comment)

from spring-cloud-sleuth.

toffentoffen avatar toffentoffen commented on May 24, 2024

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.

spencergibb avatar spencergibb commented on May 24, 2024

@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.

dnathanson avatar dnathanson commented on May 24, 2024

Just ran into this issue. 👍

from spring-cloud-sleuth.

dnathanson avatar dnathanson commented on May 24, 2024

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.

swehner avatar swehner commented on May 24, 2024

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.

spencergibb avatar spencergibb commented on May 24, 2024

from spring-cloud-sleuth.

codefromthecrypt avatar codefromthecrypt commented on May 24, 2024

from spring-cloud-sleuth.

swehner avatar swehner commented on May 24, 2024

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.

codefromthecrypt avatar codefromthecrypt commented on May 24, 2024

from spring-cloud-sleuth.

codefromthecrypt avatar codefromthecrypt commented on May 24, 2024

from spring-cloud-sleuth.

codefromthecrypt avatar codefromthecrypt commented on May 24, 2024

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.

screen shot 2015-11-13 at 7 56 04 am

Then, I clicked "vitae" which had multiple paths.

screen shot 2015-11-13 at 7 58 28 am

from spring-cloud-sleuth.

marcingrzejszczak avatar marcingrzejszczak commented on May 24, 2024

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.

marcingrzejszczak avatar marcingrzejszczak commented on May 24, 2024

@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.

marcingrzejszczak avatar marcingrzejszczak commented on May 24, 2024

Done here - #78

from spring-cloud-sleuth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.