aboutsummaryrefslogtreecommitdiffstats
path: root/api/src
diff options
context:
space:
mode:
authorChris K Wensel <chris@wensel.net>2018-05-11 17:22:35 -0700
committersebright <sebright@google.com>2018-05-11 17:22:35 -0700
commit83fd63784edaed486e43be5570549143375fdefc (patch)
tree7e80a2ac9528ae77ec2c10327f71a82218db5393 /api/src
parent36c018e66414fd19632afd2c0f2c8e664274e2c3 (diff)
downloadplatform_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.java7
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();