Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/trace/info: separate payload_too_large from decoding_error #4007

Merged
merged 1 commit into from
Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 5 additions & 1 deletion pkg/trace/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,11 @@ func (r *HTTPReceiver) handleTraces(v Version, w http.ResponseWriter, req *http.
traces, err := r.decodeTraces(v, req)
if err != nil {
httpDecodingError(err, []string{tagTraceHandler, fmt.Sprintf("v:%s", v)}, w)
atomic.AddInt64(&ts.TracesDropped.DecodingError, traceCount)
if err == ErrLimitedReaderLimitReached {
atomic.AddInt64(&ts.TracesDropped.PayloadTooLarge, traceCount)
} else {
atomic.AddInt64(&ts.TracesDropped.DecodingError, traceCount)
}
log.Errorf("Cannot decode %s traces payload: %v", v, err)
return
}
Expand Down
14 changes: 9 additions & 5 deletions pkg/trace/info/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ func mapToString(m map[string]int64) string {
type TracesDropped struct {
// DecodingError is when the agent fails to decode a trace payload
DecodingError int64
// PayloadTooLarge specifies the number of traces dropped due to the payload
// being too large to be accepted.
PayloadTooLarge int64
// EmptyTrace is when the trace contains no spans
EmptyTrace int64
// TraceIDZero is when any spans in a trace have TraceId=0
Expand All @@ -204,11 +207,12 @@ type TracesDropped struct {
// tagValues converts TracesDropped into a map representation with keys matching standardized names for all reasons
func (s *TracesDropped) tagValues() map[string]int64 {
return map[string]int64{
"decoding_error": atomic.LoadInt64(&s.DecodingError),
"empty_trace": atomic.LoadInt64(&s.EmptyTrace),
"trace_id_zero": atomic.LoadInt64(&s.TraceIDZero),
"span_id_zero": atomic.LoadInt64(&s.SpanIDZero),
"foreign_span": atomic.LoadInt64(&s.ForeignSpan),
"payload_too_large": atomic.LoadInt64(&s.PayloadTooLarge),
"decoding_error": atomic.LoadInt64(&s.DecodingError),
"empty_trace": atomic.LoadInt64(&s.EmptyTrace),
"trace_id_zero": atomic.LoadInt64(&s.TraceIDZero),
"span_id_zero": atomic.LoadInt64(&s.SpanIDZero),
"foreign_span": atomic.LoadInt64(&s.ForeignSpan),
}
}

Expand Down
11 changes: 6 additions & 5 deletions pkg/trace/info/stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ func TestTracesDropped(t *testing.T) {

t.Run("tagValues", func(t *testing.T) {
assert.Equal(t, map[string]int64{
"empty_trace": 0,
"decoding_error": 1,
"foreign_span": 1,
"trace_id_zero": 1,
"span_id_zero": 1,
"empty_trace": 0,
"payload_too_large": 0,
"decoding_error": 1,
"foreign_span": 1,
"trace_id_zero": 1,
"span_id_zero": 1,
}, s.tagValues())
})

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Each section from every releasenote are combined when the
# CHANGELOG.rst is rendered. So the text needs to be worded so that
# it does not depend on any information only available in another
# section. This may mean repeating some details, but each section
# must be readable independently of the other.
#
# Each section note must be formatted as reStructuredText.
---
enhancements:
- |
APM: The `datadog.trace_agent.normalizer.traces_dropped` metric now has a new
reason `payload_too_large` which was confusingly merged with `decoding_error`.