-
Notifications
You must be signed in to change notification settings - Fork 887
Add exporter ForceFlush #2525
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
Add exporter ForceFlush #2525
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,6 @@ | ||
| OpenTelemetry.BaseExporter<T>.ForceFlush(int timeoutMilliseconds = -1) -> bool | ||
| OpenTelemetry.Trace.BatchExportActivityProcessorOptions | ||
| OpenTelemetry.Trace.BatchExportActivityProcessorOptions.BatchExportActivityProcessorOptions() -> void | ||
| OpenTelemetry.Trace.BatchExportActivityProcessorOptions.BatchExportActivityProcessorOptions() -> void | ||
| override OpenTelemetry.BaseExportProcessor<T>.OnForceFlush(int timeoutMilliseconds) -> bool | ||
| override OpenTelemetry.BatchExportProcessor<T>.Dispose(bool disposing) -> void | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that the |
||
| virtual OpenTelemetry.BaseExporter<T>.OnForceFlush(int timeoutMilliseconds) -> bool | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,6 +57,38 @@ public abstract class BaseExporter<T> : IDisposable | |
| /// <returns>Result of the export operation.</returns> | ||
| public abstract ExportResult Export(in Batch<T> batch); | ||
|
|
||
| /// <summary> | ||
| /// Flushes the exporter, blocks the current thread until flush | ||
| /// completed, shutdown signaled or timed out. | ||
| /// </summary> | ||
| /// <param name="timeoutMilliseconds"> | ||
| /// The number (non-negative) of milliseconds to wait, or | ||
| /// <c>Timeout.Infinite</c> to wait indefinitely. | ||
| /// </param> | ||
| /// <returns> | ||
| /// Returns <c>true</c> when flush succeeded; otherwise, <c>false</c>. | ||
| /// </returns> | ||
| /// <exception cref="ArgumentOutOfRangeException"> | ||
| /// Thrown when the <c>timeoutMilliseconds</c> is smaller than -1. | ||
| /// </exception> | ||
| /// <remarks> | ||
| /// This function guarantees thread-safety. | ||
| /// </remarks> | ||
| public bool ForceFlush(int timeoutMilliseconds = Timeout.Infinite) | ||
|
reyang marked this conversation as resolved.
|
||
| { | ||
| Guard.InvalidTimeout(timeoutMilliseconds, nameof(timeoutMilliseconds)); | ||
|
|
||
| try | ||
| { | ||
| return this.OnForceFlush(timeoutMilliseconds); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| OpenTelemetrySdkEventSource.Log.SpanProcessorException(nameof(this.ForceFlush), ex); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be something generic rather than about spans - also this is an exporter not a processor. A lot of the events in
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. this is something we need to tackle surely.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
+1, I also want to solve this problem. The current internal diagnostic logs are misleading and most of them are not actionable. |
||
| return false; | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Attempts to shutdown the exporter, blocks the current thread until | ||
| /// shutdown completed or timed out. | ||
|
|
@@ -102,6 +134,27 @@ public void Dispose() | |
| GC.SuppressFinalize(this); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Called by <c>ForceFlush</c>. This function should block the current | ||
| /// thread until flush completed, shutdown signaled or timed out. | ||
| /// </summary> | ||
| /// <param name="timeoutMilliseconds"> | ||
| /// The number (non-negative) of milliseconds to wait, or | ||
| /// <c>Timeout.Infinite</c> to wait indefinitely. | ||
| /// </param> | ||
| /// <returns> | ||
| /// Returns <c>true</c> when flush succeeded; otherwise, <c>false</c>. | ||
| /// </returns> | ||
| /// <remarks> | ||
| /// This function is called synchronously on the thread which called | ||
| /// <c>ForceFlush</c>. This function should be thread-safe, and should | ||
| /// not throw exceptions. | ||
| /// </remarks> | ||
| protected virtual bool OnForceFlush(int timeoutMilliseconds) | ||
|
reyang marked this conversation as resolved.
|
||
| { | ||
| return true; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Called by <c>Shutdown</c>. This function should block the current | ||
| /// thread until shutdown completed or timed out. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.