From 4d0982ad1fc3092f580db978822fe087602eb285 Mon Sep 17 00:00:00 2001 From: Reiley Yang Date: Thu, 17 Sep 2020 09:46:48 -0700 Subject: [PATCH 1/2] exporter.Shutdown returns bool --- docs/trace/extending-the-sdk/MyExporter.cs | 3 ++- src/OpenTelemetry/Trace/ActivityExporter.cs | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/trace/extending-the-sdk/MyExporter.cs b/docs/trace/extending-the-sdk/MyExporter.cs index 6fea751481c..d38db529227 100644 --- a/docs/trace/extending-the-sdk/MyExporter.cs +++ b/docs/trace/extending-the-sdk/MyExporter.cs @@ -50,9 +50,10 @@ public override ExportResult Export(in Batch batch) return ExportResult.Success; } - protected override void OnShutdown(int timeoutMilliseconds) + protected override bool OnShutdown(int timeoutMilliseconds) { Console.WriteLine($"{this.name}.OnShutdown(timeoutMilliseconds={timeoutMilliseconds})"); + return true; } protected override void Dispose(bool disposing) diff --git a/src/OpenTelemetry/Trace/ActivityExporter.cs b/src/OpenTelemetry/Trace/ActivityExporter.cs index 8efca8f5a3f..6a513100d4d 100644 --- a/src/OpenTelemetry/Trace/ActivityExporter.cs +++ b/src/OpenTelemetry/Trace/ActivityExporter.cs @@ -83,8 +83,7 @@ public bool Shutdown(int timeoutMilliseconds = Timeout.Infinite) try { - this.OnShutdown(timeoutMilliseconds); - return true; // TODO: update exporter.OnShutdown to return boolean + return this.OnShutdown(timeoutMilliseconds); } catch (Exception ex) { @@ -108,13 +107,17 @@ public void Dispose() /// The number of milliseconds to wait, or Timeout.Infinite to /// wait indefinitely. /// + /// + /// Returns true when shutdown succeeded; otherwise, false. + /// /// /// This function is called synchronously on the thread which made the /// first call to Shutdown. This function should not throw /// exceptions. /// - protected virtual void OnShutdown(int timeoutMilliseconds) + protected virtual bool OnShutdown(int timeoutMilliseconds) { + return true; } /// From 5c19f48a08195dc9de39afe929acb076f2f892d3 Mon Sep 17 00:00:00 2001 From: Reiley Yang Date: Thu, 17 Sep 2020 09:50:41 -0700 Subject: [PATCH 2/2] update changelog --- src/OpenTelemetry/CHANGELOG.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/OpenTelemetry/CHANGELOG.md b/src/OpenTelemetry/CHANGELOG.md index 69e750531dd..633466e66a6 100644 --- a/src/OpenTelemetry/CHANGELOG.md +++ b/src/OpenTelemetry/CHANGELOG.md @@ -2,9 +2,11 @@ ## Unreleased -* Changed `ActivityProcessor.OnShutdown` and `ActivityProcessor.Shutdown` to - return boolean value +* Changed `ActivityExporter.OnShutdown`, `ActivityExporter.Shutdown`, + `ActivityProcessor.OnShutdown` and `ActivityProcessor.Shutdown` to return + boolean value ([#1282](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1282)) + ([#1285](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1285)) ## 0.6.0-beta.1