Git Product home page Git Product logo

Comments (7)

Aaronontheweb avatar Aaronontheweb commented on June 23, 2024

We use the OpenTracing API for this heavily in https://phobos.petabridge.com - it works. Might be a configuration issue - are you still having this issue?

from petabridge.tracing.zipkin.

bastijnv avatar bastijnv commented on June 23, 2024

Having the same issue. Seems the using(){} with finish on dispose is not functioning as expected. Running the same code but using span.Start() and span.Finish() works.

from petabridge.tracing.zipkin.

Aaronontheweb avatar Aaronontheweb commented on June 23, 2024

Dispose on the Span object itself calls Finish

public void Dispose()
{
Finish();
}

Maybe the issue is what's happening inside the Scope object - I don't believe we have a reproduction for that, so we can take a look.

from petabridge.tracing.zipkin.

bastijnv avatar bastijnv commented on June 23, 2024

Yes. My bad. Using statement has nothing to do with it. Indeed when using scopes via StartActive() it will no longer send traces. Another strange thing is that when I switch sample code to


var sb = _tracer.BuildSpan("no-op").WithTag("empty", true);
var span = sb.Start();
await Task.Delay(1000);
span.Finish();

on a simple GET method it will keep sending spans indefinitely cycling the same threads while it is not executing/reaching that code block multiple times. Though that seems to be a different issue (if not just my misunderstanding of what happens) and should not pollute this thread.

from petabridge.tracing.zipkin.

IgorFedchenko avatar IgorFedchenko commented on June 23, 2024

@Aaronontheweb @bastijnv
The issue here is that ISpanBuilder.StartActive is using IScopeManager internally so keep track of active span (some details [here[(https://github.com/opentracing/opentracing-csharp#scopes-and-within-process-propagation)). You have to set ScopeManager property of ZipkinTracerOptions to have StartActive working.

Currently there is no built-in implementation of IScopeManager in Petabridge.Tracing.Zipkin, except NoopScopeManager class which always returnes NoopSpanBuilder, so basically ISpanBuilder.StartActive resolves to NoopSpan.Instance, which does nothing. That's why nothing is sent to Zipkin.

As a quick solution you might consider using AsyncLocalScopeManager implementation of IScopeManager that is built in OpenTracing package, like this:

 var tracer = new ZipkinTracer(new ZipkinTracerOptions(url, "ZipkinTest", debug: true)
{
    ScopeManager = new AsyncLocalScopeManager()
});

@Aaronontheweb This is not clear from README, but what do you think about using AsyncLocalScopeManager as a default scope manager instead of NoopScopeManager? This may help people have this StartActive method working out of the box.
If you agree, I will submit small PR for that, with reproducing spec

from petabridge.tracing.zipkin.

Aaronontheweb avatar Aaronontheweb commented on June 23, 2024

from petabridge.tracing.zipkin.

Aaronontheweb avatar Aaronontheweb commented on June 23, 2024

So the reason why I never ran into this bug - Phobos sets up a scope manager by default in its configuration. This is definitely an issue on our end.

from petabridge.tracing.zipkin.

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.