Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

event: Ensure event priorities are propagated to Datadog backend. #527

Merged
merged 2 commits into from
Nov 19, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions event/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ func (p *Processor) Process(t model.ProcessedTrace) (events []*model.Event, numE
// As well as the rates of sampling done during this processing
event.SetExtractionSampleRate(extractionRate)
event.SetMaxEPSSampleRate(epsRate)
if hasPriority {
// Make sure to set the sampling priority on the event span so that this gets propagated to the backend.
AlexJF marked this conversation as resolved.
Show resolved Hide resolved
event.Span.SetSamplingPriority(priority)
}
}

return
Expand Down
6 changes: 6 additions & 0 deletions event/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ func TestProcessor(t *testing.T) {
assert.EqualValues(test.expectedSampledPct, event.GetMaxEPSSampleRate())
assert.EqualValues(testClientSampleRate, event.GetClientTraceSampleRate())
assert.EqualValues(testPreSampleRate, event.GetPreSampleRate())

eventSpanPriority, ok := event.Span.GetSamplingPriority()
AlexJF marked this conversation as resolved.
Show resolved Hide resolved
if !ok {
eventSpanPriority = model.PriorityNone
}
assert.EqualValues(test.priority, eventSpanPriority)
}
})
}
Expand Down