Giter Site home page Giter Site logo

Comments (9)

ringerc avatar ringerc commented on May 24, 2024

Related #53

from jaeger-client-cpp.

ringerc avatar ringerc commented on May 24, 2024

RemoteReport::close() makes no effort to flush by the looks:

void RemoteReporter::close()
{
    {
        std::unique_lock<std::mutex> lock(_mutex);
        if (!_running) {
            return;
        }
        _running = false;
        lock.unlock();
        _cv.notify_one();
    }
    _thread.join();
}

from jaeger-client-cpp.

ringerc avatar ringerc commented on May 24, 2024

It probably makes sense to log dropped buffers on close instead, with a hint that an explicit flush before close is advised (using #53 for flush). But that'd really want the opentracing API to adopt the Flush method.

from jaeger-client-cpp.

rnburn avatar rnburn commented on May 24, 2024

The Close method is meant to be optional; so if you don't want to wait on the tracer to flush all it's spans you can just not call it.

I think the right solution is for jaeger to move the current code in close to its destructor and change close to flush the spans, but require it to be called explicitly.

from jaeger-client-cpp.

ringerc avatar ringerc commented on May 24, 2024

@rnburn Makes sense. I'll amend my push that adds an optional Tracer.flush() to Jaeger's tracer so that it also calls it on explicit Close(), but from the dtor.

@isaachier I've written a small test program to reproduce this bug. It reliably loses spans. ringerc@2a36dd5 (on master) or ringerc@ff654d9 (on my fix/feature integration branch, but not using flush).

jaegertracing::Tracer::flush() does not seem to be working/sufficient. If you uncomment

        //static_cast<jaegertracing::Tracer*>(tracer.get())->flush();

in src/jaegertracing/shortlived.cpp, it still often loses spans. Wireshark will show that the span was never sent.

from jaeger-client-cpp.

ringerc avatar ringerc commented on May 24, 2024

Additional test runs show that without flush() it loses spans pretty much 100% of the time.

If I uncomment flush() on my integration test branch it often takes several seconds to exit so I'm not waking a thread properly or something.

Anyway, current behaviour clearly broken.

from jaeger-client-cpp.

ringerc avatar ringerc commented on May 24, 2024

I pushed an improved test case (ringerc@e5a6234). It clearly shows that we lose spans unless:

  • We explicitly flush() with ./src/jaegertracing/shortlived "" 1 and the flush actually works (per below)
  • We sleep > 10 seconds with ./src/jaegertracing/shortlived "" 0 11

The flush must actually take effect. Sometimes it seems to get missed;

Test with opname "shortlived--flush-sleep0s, flush 1
flushing...  flushed (flush took 0ms)
not sleeping before exit 

in which case the span is also lost. So there's something wrong with my flush method. Locking issues?

Lowering the configured bufferFlushInterval reduces the necessary sleep, it's obviously an issue with not waking the flush thread properly.

@isaachier I could use advice at this point, my C++ and threading is ... limited.

I also have no idea how to integrate this into the regression tests. Crossdock somehow?

from jaeger-client-cpp.

isaachier avatar isaachier commented on May 24, 2024

In general there might be a problem with blocking IO and threading. I'm about to call it a night, but will try to look at this tomorrow. Worst case, will be able to look over the weekend.

from jaeger-client-cpp.

isaachier avatar isaachier commented on May 24, 2024

I think I have a simpler approach for this specific issue. About the flush method being exposed overall, that can be a new PR. See #59 for first fix.

from jaeger-client-cpp.

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.