mirror of
https://github.com/coredns/coredns.git
synced 2025-11-04 19:23:29 -05:00
dep ensure -update (#1001)
* dep ensure -update Run "dep ensure -update` to update all dependencies. No code changes; just the dependencies. * dep prune * add new venderod
This commit is contained in:
2
vendor/github.com/openzipkin/zipkin-go-opentracing/.travis.yml
generated
vendored
2
vendor/github.com/openzipkin/zipkin-go-opentracing/.travis.yml
generated
vendored
@@ -1,8 +1,8 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.6
|
||||
- 1.7
|
||||
- 1.8
|
||||
- tip
|
||||
|
||||
install:
|
||||
|
||||
2
vendor/github.com/openzipkin/zipkin-go-opentracing/README.md
generated
vendored
2
vendor/github.com/openzipkin/zipkin-go-opentracing/README.md
generated
vendored
@@ -4,7 +4,7 @@
|
||||
[](https://circleci.com/gh/openzipkin/zipkin-go-opentracing)
|
||||
[](https://godoc.org/github.com/openzipkin/zipkin-go-opentracing)
|
||||
[](https://goreportcard.com/report/github.com/openzipkin/zipkin-go-opentracing)
|
||||
|
||||
[](https://sourcegraph.com/github.com/openzipkin/zipkin-go-opentracing?badge)
|
||||
|
||||
[OpenTracing](http://opentracing.io) Tracer implementation for [Zipkin](http://zipkin.io) in Go.
|
||||
|
||||
|
||||
6
vendor/github.com/openzipkin/zipkin-go-opentracing/_thrift/zipkinCore.thrift
generated
vendored
6
vendor/github.com/openzipkin/zipkin-go-opentracing/_thrift/zipkinCore.thrift
generated
vendored
@@ -134,7 +134,7 @@ const string HTTP_METHOD = "http.method"
|
||||
* "/resource/{resource_id}". In systems where only equals queries are available, searching for
|
||||
* http/path=/resource won't match if the actual request was /resource/abcd-ff.
|
||||
*
|
||||
* Historical note: This was commonly expressed as "http.uri" in zipkin, eventhough it was most
|
||||
* Historical note: This was commonly expressed as "http.uri" in zipkin, even though it was most
|
||||
* often just a path.
|
||||
*/
|
||||
const string HTTP_PATH = "http.path"
|
||||
@@ -286,7 +286,7 @@ struct Annotation {
|
||||
* Microseconds from epoch.
|
||||
*
|
||||
* This value should use the most precise value possible. For example,
|
||||
* gettimeofday or syncing nanoTime against a tick of currentTimeMillis.
|
||||
* gettimeofday or multiplying currentTimeMillis by 1000.
|
||||
*/
|
||||
1: i64 timestamp
|
||||
/**
|
||||
@@ -420,7 +420,7 @@ struct Span {
|
||||
* precise value possible. For example, gettimeofday or syncing nanoTime
|
||||
* against a tick of currentTimeMillis.
|
||||
*
|
||||
* For compatibilty with instrumentation that precede this field, collectors
|
||||
* For compatibility with instrumentation that precede this field, collectors
|
||||
* or span stores can derive this via Annotation.timestamp.
|
||||
* For example, SERVER_RECV.timestamp or CLIENT_SEND.timestamp.
|
||||
*
|
||||
|
||||
20
vendor/github.com/openzipkin/zipkin-go-opentracing/collector-http.go
generated
vendored
20
vendor/github.com/openzipkin/zipkin-go-opentracing/collector-http.go
generated
vendored
@@ -35,8 +35,14 @@ type HTTPCollector struct {
|
||||
shutdown chan error
|
||||
sendMutex *sync.Mutex
|
||||
batchMutex *sync.Mutex
|
||||
reqCallback RequestCallback
|
||||
}
|
||||
|
||||
// RequestCallback receives the initialized request from the Collector before
|
||||
// sending it over the wire. This allows one to plug in additional headers or
|
||||
// do other customization.
|
||||
type RequestCallback func(*http.Request)
|
||||
|
||||
// HTTPOption sets a parameter for the HttpCollector
|
||||
type HTTPOption func(c *HTTPCollector)
|
||||
|
||||
@@ -71,6 +77,17 @@ func HTTPBatchInterval(d time.Duration) HTTPOption {
|
||||
return func(c *HTTPCollector) { c.batchInterval = d }
|
||||
}
|
||||
|
||||
// HTTPClient sets a custom http client to use.
|
||||
func HTTPClient(client *http.Client) HTTPOption {
|
||||
return func(c *HTTPCollector) { c.client = client }
|
||||
}
|
||||
|
||||
// HTTPRequestCallback registers a callback function to adjust the collector
|
||||
// *http.Request before it sends the request to Zipkin.
|
||||
func HTTPRequestCallback(rc RequestCallback) HTTPOption {
|
||||
return func(c *HTTPCollector) { c.reqCallback = rc }
|
||||
}
|
||||
|
||||
// NewHTTPCollector returns a new HTTP-backend Collector. url should be a http
|
||||
// url for handle post request. timeout is passed to http client. queueSize control
|
||||
// the maximum size of buffer of async queue. The logger is used to log errors,
|
||||
@@ -194,6 +211,9 @@ func (c *HTTPCollector) send() error {
|
||||
return err
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/x-thrift")
|
||||
if c.reqCallback != nil {
|
||||
c.reqCallback(req)
|
||||
}
|
||||
if _, err = c.client.Do(req); err != nil {
|
||||
c.logger.Log("err", err.Error())
|
||||
return err
|
||||
|
||||
76
vendor/github.com/openzipkin/zipkin-go-opentracing/collector-http_test.go
generated
vendored
76
vendor/github.com/openzipkin/zipkin-go-opentracing/collector-http_test.go
generated
vendored
@@ -1,16 +1,16 @@
|
||||
package zipkintracer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
|
||||
"fmt"
|
||||
|
||||
"github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/zipkincore"
|
||||
)
|
||||
|
||||
@@ -194,7 +194,7 @@ func TestHttpCollector_MaxBatchSize(t *testing.T) {
|
||||
batchSize = maxBacklog * 2 // make backsize bigger than backlog enable testing backlog disposal
|
||||
)
|
||||
|
||||
c, err := NewHTTPCollector(fmt.Sprintf("http://localhost:%d/api/v1/span", port),
|
||||
c, err := NewHTTPCollector(fmt.Sprintf("http://localhost:%d/api/v1/spans", port),
|
||||
HTTPMaxBacklog(maxBacklog),
|
||||
HTTPBatchSize(batchSize),
|
||||
)
|
||||
@@ -215,10 +215,53 @@ func TestHttpCollector_MaxBatchSize(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
func TestHTTPCollector_RequestCallback(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var (
|
||||
err error
|
||||
port = 10005
|
||||
server = newHTTPServer(t, port)
|
||||
hdrKey = "test-key"
|
||||
hdrValue = "test-value"
|
||||
)
|
||||
|
||||
c, err := NewHTTPCollector(
|
||||
fmt.Sprintf("http://localhost:%d/api/v1/spans", port),
|
||||
HTTPRequestCallback(func(r *http.Request) {
|
||||
r.Header.Add(hdrKey, hdrValue)
|
||||
}),
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err = c.Collect(&zipkincore.Span{}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err = c.Close(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if want, have := 1, len(server.spans()); want != have {
|
||||
t.Fatal("never received a span")
|
||||
}
|
||||
|
||||
headers := server.headers()
|
||||
if len(headers) == 0 {
|
||||
t.Fatalf("Collect request was not handled")
|
||||
}
|
||||
testHeader := headers.Get(hdrKey)
|
||||
if !strings.EqualFold(testHeader, hdrValue) {
|
||||
t.Errorf("Custom header not received. want %s, have %s", testHeader, hdrValue)
|
||||
}
|
||||
server.clearHeaders()
|
||||
}
|
||||
|
||||
type httpServer struct {
|
||||
t *testing.T
|
||||
zipkinSpans []*zipkincore.Span
|
||||
mutex sync.RWMutex
|
||||
t *testing.T
|
||||
zipkinSpans []*zipkincore.Span
|
||||
zipkinHeader http.Header
|
||||
mutex sync.RWMutex
|
||||
}
|
||||
|
||||
func (s *httpServer) spans() []*zipkincore.Span {
|
||||
@@ -233,6 +276,18 @@ func (s *httpServer) clearSpans() {
|
||||
s.zipkinSpans = s.zipkinSpans[:0]
|
||||
}
|
||||
|
||||
func (s *httpServer) headers() http.Header {
|
||||
s.mutex.RLock()
|
||||
defer s.mutex.RUnlock()
|
||||
return s.zipkinHeader
|
||||
}
|
||||
|
||||
func (s *httpServer) clearHeaders() {
|
||||
s.mutex.Lock()
|
||||
defer s.mutex.Unlock()
|
||||
s.zipkinHeader = make(http.Header, 0)
|
||||
}
|
||||
|
||||
func newHTTPServer(t *testing.T, port int) *httpServer {
|
||||
server := &httpServer{
|
||||
t: t,
|
||||
@@ -250,6 +305,14 @@ func newHTTPServer(t *testing.T, port int) *httpServer {
|
||||
contextType)
|
||||
}
|
||||
|
||||
// clone headers from request
|
||||
headers := make(http.Header, len(r.Header))
|
||||
for k, vv := range r.Header {
|
||||
vv2 := make([]string, len(vv))
|
||||
copy(vv2, vv)
|
||||
headers[k] = vv2
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -282,6 +345,7 @@ func newHTTPServer(t *testing.T, port int) *httpServer {
|
||||
server.mutex.Lock()
|
||||
defer server.mutex.Unlock()
|
||||
server.zipkinSpans = append(server.zipkinSpans, spans...)
|
||||
server.zipkinHeader = headers
|
||||
})
|
||||
|
||||
handler.HandleFunc("/api/v1/sleep", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
13
vendor/github.com/openzipkin/zipkin-go-opentracing/propagation_test.go
generated
vendored
13
vendor/github.com/openzipkin/zipkin-go-opentracing/propagation_test.go
generated
vendored
@@ -59,7 +59,12 @@ func TestSpanPropagator(t *testing.T) {
|
||||
t.Fatalf("Unable to create Tracer: %+v", err)
|
||||
}
|
||||
|
||||
sp := tracer.StartSpan(op)
|
||||
// create root span so propagation test will include parentSpanID
|
||||
ps := tracer.StartSpan("root")
|
||||
defer ps.Finish()
|
||||
|
||||
// client side span with parent span 'ps'
|
||||
sp := tracer.StartSpan(op, opentracing.ChildOf(ps.Context()))
|
||||
sp.SetBaggageItem("foo", "bar")
|
||||
tmc := opentracing.HTTPHeadersCarrier(http.Header{})
|
||||
tests := []struct {
|
||||
@@ -109,6 +114,12 @@ func TestSpanPropagator(t *testing.T) {
|
||||
if a, e := sp.Context.TraceID, exp.Context.TraceID; a != e {
|
||||
t.Fatalf("%d: TraceID changed from %d to %d", i, e, a)
|
||||
}
|
||||
if exp.Context.ParentSpanID == nil {
|
||||
t.Fatalf("%d: Expected a ParentSpanID, got nil", i)
|
||||
}
|
||||
if p, c := sp.Context.ParentSpanID, exp.Context.ParentSpanID; p != c {
|
||||
t.Fatalf("%d: ParentSpanID changed from %d to %d", i, p, c)
|
||||
}
|
||||
if !reflect.DeepEqual(exp, sp) {
|
||||
t.Fatalf("%d: wanted %+v, got %+v", i, spew.Sdump(exp), spew.Sdump(sp))
|
||||
}
|
||||
|
||||
1
vendor/github.com/openzipkin/zipkin-go-opentracing/span_test.go
generated
vendored
1
vendor/github.com/openzipkin/zipkin-go-opentracing/span_test.go
generated
vendored
@@ -16,6 +16,7 @@ func TestSpan_Baggage(t *testing.T) {
|
||||
tracer, err := NewTracer(
|
||||
recorder,
|
||||
WithSampler(func(_ uint64) bool { return true }),
|
||||
WithLogger(&nopLogger{}),
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Unable to create Tracer: %+v", err)
|
||||
|
||||
9
vendor/github.com/openzipkin/zipkin-go-opentracing/tracer.go
generated
vendored
9
vendor/github.com/openzipkin/zipkin-go-opentracing/tracer.go
generated
vendored
@@ -170,8 +170,11 @@ func TraceID128Bit(val bool) TracerOption {
|
||||
}
|
||||
|
||||
// ClientServerSameSpan allows to place client-side and server-side annotations
|
||||
// for a RPC call in the same span (Zipkin V1 behavior). By default this Tracer
|
||||
// uses single host spans (so client-side and server-side in separate spans).
|
||||
// for a RPC call in the same span (Zipkin V1 behavior) or different spans
|
||||
// (more in line with other tracing solutions). By default this Tracer
|
||||
// uses shared host spans (so client-side and server-side in the same span).
|
||||
// If using separate spans you might run into trouble with Zipkin V1 as clock
|
||||
// skew issues can't be remedied at Zipkin server side.
|
||||
func ClientServerSameSpan(val bool) TracerOption {
|
||||
return func(opts *TracerOptions) error {
|
||||
opts.clientServerSameSpan = val
|
||||
@@ -224,7 +227,7 @@ func NewTracer(recorder SpanRecorder, options ...TracerOption) (opentracing.Trac
|
||||
logger: &nopLogger{},
|
||||
debugAssertSingleGoroutine: false,
|
||||
debugAssertUseAfterFinish: false,
|
||||
clientServerSameSpan: false,
|
||||
clientServerSameSpan: true,
|
||||
debugMode: false,
|
||||
traceID128Bit: false,
|
||||
maxLogsPerSpan: 10000,
|
||||
|
||||
2
vendor/github.com/openzipkin/zipkin-go-opentracing/types/traceid.go
generated
vendored
2
vendor/github.com/openzipkin/zipkin-go-opentracing/types/traceid.go
generated
vendored
@@ -30,7 +30,7 @@ func (t TraceID) ToHex() string {
|
||||
return strconv.FormatUint(t.Low, 16)
|
||||
}
|
||||
return fmt.Sprintf(
|
||||
"%s%016s", strconv.FormatUint(t.High, 16), strconv.FormatUint(t.Low, 16),
|
||||
"%016s%016s", strconv.FormatUint(t.High, 16), strconv.FormatUint(t.Low, 16),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
13
vendor/github.com/openzipkin/zipkin-go-opentracing/types/traceid_test.go
generated
vendored
Normal file
13
vendor/github.com/openzipkin/zipkin-go-opentracing/types/traceid_test.go
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
package types
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestTraceID(t *testing.T) {
|
||||
|
||||
traceID := TraceID{High: 1, Low: 2}
|
||||
|
||||
if len(traceID.ToHex()) != 32 {
|
||||
t.Errorf("Expected zero-padded TraceID to have 32 characters")
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user