Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Exporter.Shutdown to meet with the latest spec #1285

Merged
merged 5 commits into from
Sep 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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