From 03d1775663f38661eaec88093964442cfffe47d2 Mon Sep 17 00:00:00 2001 From: Kelsey Date: Wed, 9 Dec 2020 16:31:46 -0700 Subject: [PATCH] Set status code as string (#197) --- tracing/req_tracer.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tracing/req_tracer.go b/tracing/req_tracer.go index 2c32b20..5c2a647 100644 --- a/tracing/req_tracer.go +++ b/tracing/req_tracer.go @@ -2,6 +2,7 @@ package tracing import ( "net/http" + "strconv" "time" opentracing "github.com/opentracing/opentracing-go" @@ -76,7 +77,9 @@ func (rt *RequestTracer) Finish() { fields["dur"] = dur.String() fields["dur_ns"] = dur.Nanoseconds() - rt.span.SetTag(ext.HTTPCode, rt.trackingWriter.status) + // Setting the status as an int doesn't propogate for use in datadog dashboards, + // so we convert to a string. + rt.span.SetTag(ext.HTTPCode, strconv.Itoa(rt.trackingWriter.status)) rt.span.Finish() rt.WithFields(fields).Info("Completed Request") }