We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 755ce9c commit e7d0695Copy full SHA for e7d0695
packages/opentelemetry-tracing/src/export/BatchSpanProcessor.ts
@@ -45,7 +45,7 @@ export class BatchSpanProcessor implements SpanProcessor {
45
: DEFAULT_BUFFER_TIMEOUT_MS;
46
47
this._timer = setInterval(() => {
48
- if (Date.now() - this._lastSpanFlush >= this._bufferTimeout) {
+ if (this._shouldFlush()) {
49
this._flush();
50
}
51
}, this._bufferTimeout);
@@ -73,6 +73,13 @@ export class BatchSpanProcessor implements SpanProcessor {
73
74
75
76
+ private _shouldFlush(): boolean {
77
+ return (
78
+ this._finishedSpans.length >= 0 &&
79
+ Date.now() - this._lastSpanFlush >= this._bufferTimeout
80
+ );
81
+ }
82
+
83
/** Send the span data list to exporter */
84
private _flush() {
85
this._exporter.export(this._finishedSpans, () => {});
0 commit comments