diff --git a/docs/trace/extending-the-sdk/MyExporter.cs b/docs/trace/extending-the-sdk/MyExporter.cs index b9d50af7c20..7a3677b8f4c 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/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 diff --git a/src/OpenTelemetry/Trace/ActivityExporter.cs b/src/OpenTelemetry/Trace/ActivityExporter.cs index 276d9f6d56b..4bff2651953 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; } ///