Skip to content

Commit

Permalink
Merge pull request #35 from nimeshksingh/master
Browse files Browse the repository at this point in the history
Add a tracer option to make event logging operations no-ops.
  • Loading branch information
bensigelman committed Jul 28, 2016
2 parents a9458a9 + 4f620c7 commit 581b531
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion span.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (s *spanImpl) Log(ld opentracing.LogData) {
defer s.onLog(ld)
s.Lock()
defer s.Unlock()
if s.trim() {
if s.trim() || s.tracer.options.DropAllLogs {
return
}

Expand Down
8 changes: 5 additions & 3 deletions tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,18 @@ type Options struct {
// samples every 64th trace on average.
ShouldSample func(traceID uint64) bool
// TrimUnsampledSpans turns potentially expensive operations on unsampled
// Spans into no-ops. More precisely, tags, baggage items, and log events
// are silently discarded. If NewSpanEventListener is set, the callbacks
// will still fire in that case.
// Spans into no-ops. More precisely, tags and log events are silently
// discarded. If NewSpanEventListener is set, the callbacks will still fire.
TrimUnsampledSpans bool
// Recorder receives Spans which have been finished.
Recorder SpanRecorder
// NewSpanEventListener can be used to enhance the tracer by effectively
// attaching external code to trace events. See NetTraceIntegrator for a
// practical example, and event.go for the list of possible events.
NewSpanEventListener func() func(SpanEvent)
// DropAllLogs turns log events on all Spans into no-ops.
// If NewSpanEventListener is set, the callbacks will still fire.
DropAllLogs bool
// DebugAssertSingleGoroutine internally records the ID of the goroutine
// creating each Span and verifies that no operation is carried out on
// it on a different goroutine.
Expand Down

0 comments on commit 581b531

Please sign in to comment.