1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-01-05 22:54:18 +02:00

Move IsSampled check

This commit is contained in:
Vladimir Mihailenco 2020-05-14 14:26:28 +03:00
parent 774889cbfa
commit 8885bc404d

View File

@ -185,11 +185,9 @@ loop:
case <-timer.C:
exportSpans()
case sd := <-bsp.queue:
if sd.SpanContext.IsSampled() {
batch = append(batch, sd)
if len(batch) == bsp.o.MaxExportBatchSize {
exportSpans()
}
batch = append(batch, sd)
if len(batch) == bsp.o.MaxExportBatchSize {
exportSpans()
}
}
}
@ -213,11 +211,9 @@ loop:
return
}
if sd.SpanContext.IsSampled() {
batch = append(batch, sd)
if len(batch) == bsp.o.MaxExportBatchSize {
exportSpans()
}
batch = append(batch, sd)
if len(batch) == bsp.o.MaxExportBatchSize {
exportSpans()
}
case <-timer.C:
log.Println("bsp.enqueueWait timeout")
@ -228,6 +224,10 @@ loop:
}
func (bsp *BatchSpanProcessor) enqueue(sd *export.SpanData) {
if !sd.SpanContext.IsSampled() {
return
}
bsp.enqueueWait.Add(1)
select {