mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 10:43:17 -04:00
@@ -59,22 +59,22 @@ func traceParse(c *caddy.Controller) (*Trace, error) {
|
||||
if err != nil {
|
||||
return tr, err
|
||||
}
|
||||
for c.NextBlock() {
|
||||
switch c.Val() {
|
||||
case "every":
|
||||
args := c.RemainingArgs()
|
||||
if len(args) != 1 {
|
||||
return nil, c.ArgErr()
|
||||
}
|
||||
tr.every, err = strconv.ParseUint(args[0], 10, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for c.NextBlock() {
|
||||
switch c.Val() {
|
||||
case "every":
|
||||
args := c.RemainingArgs()
|
||||
if len(args) != 1 {
|
||||
return nil, c.ArgErr()
|
||||
}
|
||||
tr.every, err = strconv.ParseUint(args[0], 10, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case "service":
|
||||
args := c.RemainingArgs()
|
||||
if len(args) != 1 {
|
||||
return nil, c.ArgErr()
|
||||
}
|
||||
if len(args) != 1 {
|
||||
return nil, c.ArgErr()
|
||||
}
|
||||
tr.serviceName = args[0]
|
||||
case "client_server":
|
||||
args := c.RemainingArgs()
|
||||
@@ -102,12 +102,12 @@ func normalizeEndpoint(epType, ep string) (string, error) {
|
||||
}
|
||||
return ep, nil
|
||||
default:
|
||||
return "", fmt.Errorf("Tracing endpoint type '%s' is not supported.", epType)
|
||||
return "", fmt.Errorf("tracing endpoint type '%s' is not supported", epType)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
defEP = "localhost:9411"
|
||||
defEpType = "zipkin"
|
||||
defEP = "localhost:9411"
|
||||
defEpType = "zipkin"
|
||||
defServiceName = "coredns"
|
||||
)
|
||||
|
||||
@@ -8,12 +8,12 @@ import (
|
||||
|
||||
func TestTraceParse(t *testing.T) {
|
||||
tests := []struct {
|
||||
input string
|
||||
shouldErr bool
|
||||
endpoint string
|
||||
every uint64
|
||||
serviceName string
|
||||
clientServer bool
|
||||
input string
|
||||
shouldErr bool
|
||||
endpoint string
|
||||
every uint64
|
||||
serviceName string
|
||||
clientServer bool
|
||||
}{
|
||||
// oks
|
||||
{`trace`, false, "http://localhost:9411/api/v1/spans", 1, `coredns`, false},
|
||||
|
||||
@@ -21,10 +21,10 @@ type Trace struct {
|
||||
Endpoint string
|
||||
EndpointType string
|
||||
Tracer ot.Tracer
|
||||
serviceName string
|
||||
clientServer bool
|
||||
every uint64
|
||||
count uint64
|
||||
serviceName string
|
||||
clientServer bool
|
||||
every uint64
|
||||
count uint64
|
||||
Once sync.Once
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user