Skip to content

Commit

Permalink
Close tracer on JVM shutdown
Browse files Browse the repository at this point in the history
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
  • Loading branch information
jpkrohling committed Sep 7, 2018
1 parent 8e9492f commit 41a9d10
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ protected JaegerTracer(JaegerTracer.Builder builder) {
}
this.ipv4 = ipv4;
this.tags = Collections.unmodifiableMap(tags);

// register this tracer with a shutdown hook, to flush the spans before the VM shuts down
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
JaegerTracer.this.close();
}
});
}

public String getVersion() {
Expand Down

0 comments on commit 41a9d10

Please sign in to comment.