aboutsummaryrefslogtreecommitdiff
path: root/plugin/trace/trace.go
diff options
context:
space:
mode:
authorGravatar Ondřej Benkovský <Obenky@gmail.com> 2021-06-29 09:10:22 +0200
committerGravatar GitHub <noreply@github.com> 2021-06-29 09:10:22 +0200
commit9e90d6231e27bf81441edc94f4b6280998bd18ad (patch)
tree5dd38e9d1f02c92a9451ed768ef03986855fc12d /plugin/trace/trace.go
parenta5ab94eabb2b37db05ea1aadfdfafcd13accf7f4 (diff)
downloadcoredns-9e90d6231e27bf81441edc94f4b6280998bd18ad.tar.gz
coredns-9e90d6231e27bf81441edc94f4b6280998bd18ad.tar.zst
coredns-9e90d6231e27bf81441edc94f4b6280998bd18ad.zip
trace plugin can mark traces with error tag (#4720)
Signed-off-by: Ondrej Benkovsky <ondrej.benkovsky@wandera.com>
Diffstat (limited to 'plugin/trace/trace.go')
-rw-r--r--plugin/trace/trace.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/plugin/trace/trace.go b/plugin/trace/trace.go
index c1b0fb4cf..4d3deb207 100644
--- a/plugin/trace/trace.go
+++ b/plugin/trace/trace.go
@@ -16,6 +16,8 @@ import (
"github.com/miekg/dns"
ot "github.com/opentracing/opentracing-go"
+ otext "github.com/opentracing/opentracing-go/ext"
+ otlog "github.com/opentracing/opentracing-go/log"
zipkinot "github.com/openzipkin-contrib/zipkin-go-opentracing"
"github.com/openzipkin/zipkin-go"
zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http"
@@ -148,6 +150,10 @@ func (t *trace) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
span.SetTag(t.tagSet.Proto, req.Proto())
span.SetTag(t.tagSet.Remote, req.IP())
span.SetTag(t.tagSet.Rcode, rcode.ToString(rw.Rcode))
+ if err != nil {
+ otext.Error.Set(span, true)
+ span.LogFields(otlog.Event("error"), otlog.Error(err))
+ }
return status, err
}