Fix Datadog tracer (#2868)

- Fixes #2862
This commit is contained in:
Anshul Sharma
2019-06-09 23:44:19 +03:00
committed by Yong Tang
parent ffcd2f61cf
commit 74303a985c
4 changed files with 19 additions and 20 deletions

View File

@@ -1,4 +1,4 @@
package chaos
// Owners are all GitHub handlers of all maintainers.
var Owners = []string{"bradbeam", "chrisohaver", "dilyevsky", "ekleiner", "fastest963", "fturib", "greenpau", "grobie", "inigohu", "isolus", "johnbelamaric", "miekg", "nchrisdk", "nitisht", "pmoroney", "rajansandeep", "rdrozhdzh", "rtreffer", "stp-ip", "superq", "varyoo", "yongtang"}
var Owners = []string{"bradbeam", "chrisohaver", "dilyevsky", "ekleiner", "fastest963", "greenpau", "grobie", "inigohu", "isolus", "johnbelamaric", "miekg", "nchrisdk", "nitisht", "pmoroney", "rajansandeep", "rdrozhdzh", "rtreffer", "stp-ip", "superq", "varyoo", "yongtang"}

View File

@@ -4,7 +4,6 @@ package trace
import (
"context"
"fmt"
"strings"
"sync"
"sync/atomic"
@@ -12,6 +11,9 @@ import (
"github.com/coredns/coredns/plugin/metrics"
"github.com/coredns/coredns/plugin/pkg/dnstest"
"github.com/coredns/coredns/plugin/pkg/rcode"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/opentracer"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
// Plugin the trace package.
_ "github.com/coredns/coredns/plugin/pkg/trace"
"github.com/coredns/coredns/request"
@@ -19,7 +21,6 @@ import (
"github.com/miekg/dns"
ot "github.com/opentracing/opentracing-go"
zipkin "github.com/openzipkin/zipkin-go-opentracing"
ddtrace "gopkg.in/DataDog/dd-trace-go.v0/opentracing"
)
const (
@@ -53,7 +54,7 @@ func (t *trace) OnStartup() error {
case "zipkin":
err = t.setupZipkin()
case "datadog":
err = t.setupDatadog()
t.setupDatadog()
default:
err = fmt.Errorf("unknown endpoint type: %s", t.EndpointType)
}
@@ -74,20 +75,9 @@ func (t *trace) setupZipkin() error {
return err
}
func (t *trace) setupDatadog() error {
config := ddtrace.NewConfiguration()
config.ServiceName = t.serviceName
host := strings.Split(t.Endpoint, ":")
config.AgentHostname = host[0]
if len(host) == 2 {
config.AgentPort = host[1]
}
tracer, _, err := ddtrace.NewTracer(config)
func (t *trace) setupDatadog() {
tracer := opentracer.New(tracer.WithAgentAddr(t.Endpoint), tracer.WithServiceName(t.serviceName), tracer.WithDebugMode(true))
t.tracer = tracer
return err
}
// Name implements the Handler interface.