1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-06-27 00:21:15 +02:00

Add ForceFlush() method to SpanProcessor interface (#1166)

* Add ForceFlush() method to SpanProcessor interface

* Add a stub implementation to SimpleSpanProcessor
* Add a working implementation to BatchSpanProcessor

* add CHANGELOG.md entry

* Eliminate sleep from BatchSpanProcessor.ForceFlush() test

* Generating test spans serially should reduce test flakiness
This commit is contained in:
Anthony Mirabella
2020-09-20 13:35:44 -04:00
committed by GitHub
parent a12224a454
commit 995be31f42
6 changed files with 85 additions and 7 deletions

View File

@ -35,6 +35,12 @@ type SpanProcessor interface {
// data. No calls to OnStart and OnEnd method is invoked after Shutdown call is
// made. It should not be blocked indefinitely.
Shutdown()
// ForceFlush exports all ended spans to the configured Exporter that have not yet
// been exported. It should only be called when absolutely necessary, such as when
// using a FaaS provider that may suspend the process after an invocation, but before
// the Processor can export the completed spans.
ForceFlush()
}
type spanProcessorMap map[SpanProcessor]*sync.Once