diff options
| author | Chris K Wensel <chris@wensel.net> | 2018-05-11 17:22:35 -0700 |
|---|---|---|
| committer | sebright <sebright@google.com> | 2018-05-11 17:22:35 -0700 |
| commit | 83fd63784edaed486e43be5570549143375fdefc (patch) | |
| tree | 7e80a2ac9528ae77ec2c10327f71a82218db5393 /api/src | |
| parent | 36c018e66414fd19632afd2c0f2c8e664274e2c3 (diff) | |
| download | platform_external_opencensus-java-83fd63784edaed486e43be5570549143375fdefc.tar.gz platform_external_opencensus-java-83fd63784edaed486e43be5570549143375fdefc.tar.bz2 platform_external_opencensus-java-83fd63784edaed486e43be5570549143375fdefc.zip | |
Adds Tracing.getExportComponent().flushAndShutdown() for use within application shutdown hooks. (#1141)
Adds the ability to flush pending spans via a call to Tracing.getExportComponent().shutdown()
This allows a developer to force a flush from within a shutdown hook or other means.
Unfortunately the underlying Disruptor instance only provides a #shutdown() call, not a flush, or a public method
for testing for backlog. Thus shutdown has propagated up to the above api call.
Diffstat (limited to 'api/src')
| -rw-r--r-- | api/src/main/java/io/opencensus/trace/export/ExportComponent.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/api/src/main/java/io/opencensus/trace/export/ExportComponent.java b/api/src/main/java/io/opencensus/trace/export/ExportComponent.java index 63447a76..bf06089c 100644 --- a/api/src/main/java/io/opencensus/trace/export/ExportComponent.java +++ b/api/src/main/java/io/opencensus/trace/export/ExportComponent.java @@ -66,6 +66,13 @@ public abstract class ExportComponent { */ public abstract SampledSpanStore getSampledSpanStore(); + /** + * Will shutdown this ExportComponent after flushing any pending spans. + * + * @since 0.13 + */ + public void shutdown() {} + private static final class NoopExportComponent extends ExportComponent { private final SampledSpanStore noopSampledSpanStore = SampledSpanStore.newNoopSampledSpanStore(); |
