Skip to content

Commit

Permalink
Merge branch 'main' into dario.castane/AIT-7944/update-supported-vers…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
darccio committed Sep 4, 2023
2 parents 3ad8401 + 3a53e45 commit 634dff5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 0 additions & 5 deletions ddtrace/tracer/abandonedspans.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ type abandonedSpansDebugger struct {
// addedSpans and removedSpans are internal counters, mainly for testing
// purposes
addedSpans, removedSpans uint32

// logged reports if the debugger has logged abandoned spans at least once
// (when non-zero).
logged uint32
}

// newAbandonedSpansDebugger creates a new abandonedSpansDebugger debugger
Expand Down Expand Up @@ -278,7 +274,6 @@ func (d *abandonedSpansDebugger) log(interval *time.Duration) {
sb.WriteString("...")
}
log.Warn(sb.String())
atomic.SwapUint32(&d.logged, 1)
}

// formatAbandonedSpans takes a bucket and returns a human-readable string representing
Expand Down
7 changes: 4 additions & 3 deletions ddtrace/tracer/abandonedspans_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,16 @@ func assertProcessedSpans(assert *assert.Assertions, t *tracer, startedSpans, fi
return atomic.LoadUint32(&d.addedSpans) >= uint32(startedSpans) &&
atomic.LoadUint32(&d.removedSpans) >= uint32(finishedSpans)
}
assert.Eventually(cond, 500*time.Millisecond, 50*time.Millisecond)
assert.Eventually(cond, 1*time.Second, 75*time.Millisecond)
// We expect logs to be generated when startedSpans and finishedSpans are different.
// At least there should be 3 lines: 1. debugger activation, 2. detected spans warn, and 3. the details.
if startedSpans == finishedSpans {
return
}
cond = func() bool {
return atomic.LoadUint32(&d.logged) == 1
return len(t.config.logger.(*log.RecordLogger).Logs()) > 2
}
assert.Eventually(cond, 300*time.Millisecond, 50*time.Millisecond)
assert.Eventually(cond, 1*time.Second, 75*time.Millisecond)
}

func formatSpanString(s *span) string {
Expand Down

0 comments on commit 634dff5

Please sign in to comment.