Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Commit

Permalink
Expose an explicit Tracer.Flush() method
Browse files Browse the repository at this point in the history
Extend the OpenTracing API with an explicit Flush() method to force
spans to be flushed eagerly without closing the tracer.

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
  • Loading branch information
ringerc committed Feb 7, 2018
1 parent c36adcf commit 1102a98
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/jaegertracing/Tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ class Tracer : public opentracing::Tracer,

void close() noexcept { Close(); }

void Flush()
{
_reporter->flush();
}

const std::string& serviceName() const { return _serviceName; }

const std::vector<Tag>& tags() const { return _tags; }
Expand Down
4 changes: 2 additions & 2 deletions src/jaegertracing/reporters/RemoteReporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ class RemoteReporter : public Reporter {

void close() override;

void flush() override;

private:
void sweepQueue();

void sendSpan(const Span& span);

void flush();

bool bufferFlushIntervalExpired() const
{
return (Clock::now() - _lastFlush) >= _bufferFlushInterval;
Expand Down
2 changes: 2 additions & 0 deletions src/jaegertracing/reporters/Reporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class Reporter {
virtual void report(const Span& span) = 0;

virtual void close() = 0;

virtual void flush() {};
};

} // namespace reporters
Expand Down

0 comments on commit 1102a98

Please sign in to comment.