Skip to content

Commit b38adb4

Browse files
reyangcijothomasCodeBlanch
authored
Update Exporter.Shutdown to meet with the latest spec (#1285)
* exporter.Shutdown returns bool * update changelog Co-authored-by: Cijo Thomas <cithomas@microsoft.com> Co-authored-by: Mikel Blanchard <mblanchard@macrosssoftware.com>
1 parent ec14f92 commit b38adb4

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

docs/trace/extending-the-sdk/MyExporter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ public override ExportResult Export(in Batch<Activity> batch)
5050
return ExportResult.Success;
5151
}
5252

53-
protected override void OnShutdown(int timeoutMilliseconds)
53+
protected override bool OnShutdown(int timeoutMilliseconds)
5454
{
5555
Console.WriteLine($"{this.name}.OnShutdown(timeoutMilliseconds={timeoutMilliseconds})");
56+
return true;
5657
}
5758

5859
protected override void Dispose(bool disposing)

src/OpenTelemetry/CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
## Unreleased
44

5-
* Changed `ActivityProcessor.OnShutdown` and `ActivityProcessor.Shutdown` to
6-
return boolean value
5+
* Changed `ActivityExporter.OnShutdown`, `ActivityExporter.Shutdown`,
6+
`ActivityProcessor.OnShutdown` and `ActivityProcessor.Shutdown` to return
7+
boolean value
78
([#1282](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1282))
9+
([#1285](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1285))
810

911
## 0.6.0-beta.1
1012

src/OpenTelemetry/Trace/ActivityExporter.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ public bool Shutdown(int timeoutMilliseconds = Timeout.Infinite)
8383

8484
try
8585
{
86-
this.OnShutdown(timeoutMilliseconds);
87-
return true; // TODO: update exporter.OnShutdown to return boolean
86+
return this.OnShutdown(timeoutMilliseconds);
8887
}
8988
catch (Exception ex)
9089
{
@@ -108,13 +107,17 @@ public void Dispose()
108107
/// The number of milliseconds to wait, or <c>Timeout.Infinite</c> to
109108
/// wait indefinitely.
110109
/// </param>
110+
/// <returns>
111+
/// Returns <c>true</c> when shutdown succeeded; otherwise, <c>false</c>.
112+
/// </returns>
111113
/// <remarks>
112114
/// This function is called synchronously on the thread which made the
113115
/// first call to <c>Shutdown</c>. This function should not throw
114116
/// exceptions.
115117
/// </remarks>
116-
protected virtual void OnShutdown(int timeoutMilliseconds)
118+
protected virtual bool OnShutdown(int timeoutMilliseconds)
117119
{
120+
return true;
118121
}
119122

120123
/// <summary>

0 commit comments

Comments
 (0)