Skip to content

Commit

Permalink
Update Exporter.Shutdown to meet with the latest spec (#1285)
Browse files Browse the repository at this point in the history
* exporter.Shutdown returns bool

* update changelog

Co-authored-by: Cijo Thomas <[email protected]>
Co-authored-by: Mikel Blanchard <[email protected]>
  • Loading branch information
3 people authored Sep 19, 2020
1 parent ec14f92 commit b38adb4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion docs/trace/extending-the-sdk/MyExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ public override ExportResult Export(in Batch<Activity> 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)
Expand Down
6 changes: 4 additions & 2 deletions src/OpenTelemetry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 6 additions & 3 deletions src/OpenTelemetry/Trace/ActivityExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -108,13 +107,17 @@ public void Dispose()
/// The number of milliseconds to wait, or <c>Timeout.Infinite</c> to
/// wait indefinitely.
/// </param>
/// <returns>
/// Returns <c>true</c> when shutdown succeeded; otherwise, <c>false</c>.
/// </returns>
/// <remarks>
/// This function is called synchronously on the thread which made the
/// first call to <c>Shutdown</c>. This function should not throw
/// exceptions.
/// </remarks>
protected virtual void OnShutdown(int timeoutMilliseconds)
protected virtual bool OnShutdown(int timeoutMilliseconds)
{
return true;
}

/// <summary>
Expand Down

0 comments on commit b38adb4

Please sign in to comment.