Update tracing dependencies
This commit is contained in:
parent
4919b638f9
commit
ed12366d52
98 changed files with 3371 additions and 2808 deletions
39
vendor/github.com/uber/jaeger-client-go/propagation.go
generated
vendored
39
vendor/github.com/uber/jaeger-client-go/propagation.go
generated
vendored
|
@ -51,15 +51,17 @@ type Extractor interface {
|
|||
Extract(carrier interface{}) (SpanContext, error)
|
||||
}
|
||||
|
||||
type textMapPropagator struct {
|
||||
// TextMapPropagator is a combined Injector and Extractor for TextMap format
|
||||
type TextMapPropagator struct {
|
||||
headerKeys *HeadersConfig
|
||||
metrics Metrics
|
||||
encodeValue func(string) string
|
||||
decodeValue func(string) string
|
||||
}
|
||||
|
||||
func newTextMapPropagator(headerKeys *HeadersConfig, metrics Metrics) *textMapPropagator {
|
||||
return &textMapPropagator{
|
||||
// NewTextMapPropagator creates a combined Injector and Extractor for TextMap format
|
||||
func NewTextMapPropagator(headerKeys *HeadersConfig, metrics Metrics) *TextMapPropagator {
|
||||
return &TextMapPropagator{
|
||||
headerKeys: headerKeys,
|
||||
metrics: metrics,
|
||||
encodeValue: func(val string) string {
|
||||
|
@ -71,8 +73,9 @@ func newTextMapPropagator(headerKeys *HeadersConfig, metrics Metrics) *textMapPr
|
|||
}
|
||||
}
|
||||
|
||||
func newHTTPHeaderPropagator(headerKeys *HeadersConfig, metrics Metrics) *textMapPropagator {
|
||||
return &textMapPropagator{
|
||||
// NewHTTPHeaderPropagator creates a combined Injector and Extractor for HTTPHeaders format
|
||||
func NewHTTPHeaderPropagator(headerKeys *HeadersConfig, metrics Metrics) *TextMapPropagator {
|
||||
return &TextMapPropagator{
|
||||
headerKeys: headerKeys,
|
||||
metrics: metrics,
|
||||
encodeValue: func(val string) string {
|
||||
|
@ -88,19 +91,22 @@ func newHTTPHeaderPropagator(headerKeys *HeadersConfig, metrics Metrics) *textMa
|
|||
}
|
||||
}
|
||||
|
||||
type binaryPropagator struct {
|
||||
// BinaryPropagator is a combined Injector and Extractor for Binary format
|
||||
type BinaryPropagator struct {
|
||||
tracer *Tracer
|
||||
buffers sync.Pool
|
||||
}
|
||||
|
||||
func newBinaryPropagator(tracer *Tracer) *binaryPropagator {
|
||||
return &binaryPropagator{
|
||||
// NewBinaryPropagator creates a combined Injector and Extractor for Binary format
|
||||
func NewBinaryPropagator(tracer *Tracer) *BinaryPropagator {
|
||||
return &BinaryPropagator{
|
||||
tracer: tracer,
|
||||
buffers: sync.Pool{New: func() interface{} { return &bytes.Buffer{} }},
|
||||
}
|
||||
}
|
||||
|
||||
func (p *textMapPropagator) Inject(
|
||||
// Inject implements Injector of TextMapPropagator
|
||||
func (p *TextMapPropagator) Inject(
|
||||
sc SpanContext,
|
||||
abstractCarrier interface{},
|
||||
) error {
|
||||
|
@ -121,7 +127,8 @@ func (p *textMapPropagator) Inject(
|
|||
return nil
|
||||
}
|
||||
|
||||
func (p *textMapPropagator) Extract(abstractCarrier interface{}) (SpanContext, error) {
|
||||
// Extract implements Extractor of TextMapPropagator
|
||||
func (p *TextMapPropagator) Extract(abstractCarrier interface{}) (SpanContext, error) {
|
||||
textMapReader, ok := abstractCarrier.(opentracing.TextMapReader)
|
||||
if !ok {
|
||||
return emptyContext, opentracing.ErrInvalidCarrier
|
||||
|
@ -166,7 +173,8 @@ func (p *textMapPropagator) Extract(abstractCarrier interface{}) (SpanContext, e
|
|||
return ctx, nil
|
||||
}
|
||||
|
||||
func (p *binaryPropagator) Inject(
|
||||
// Inject implements Injector of BinaryPropagator
|
||||
func (p *BinaryPropagator) Inject(
|
||||
sc SpanContext,
|
||||
abstractCarrier interface{},
|
||||
) error {
|
||||
|
@ -207,7 +215,8 @@ func (p *binaryPropagator) Inject(
|
|||
return nil
|
||||
}
|
||||
|
||||
func (p *binaryPropagator) Extract(abstractCarrier interface{}) (SpanContext, error) {
|
||||
// Extract implements Extractor of BinaryPropagator
|
||||
func (p *BinaryPropagator) Extract(abstractCarrier interface{}) (SpanContext, error) {
|
||||
carrier, ok := abstractCarrier.(io.Reader)
|
||||
if !ok {
|
||||
return emptyContext, opentracing.ErrInvalidCarrier
|
||||
|
@ -269,7 +278,7 @@ func (p *binaryPropagator) Extract(abstractCarrier interface{}) (SpanContext, er
|
|||
// is converted to map[string]string { "key1" : "value1",
|
||||
// "key2" : "value2",
|
||||
// "key3" : "value3" }
|
||||
func (p *textMapPropagator) parseCommaSeparatedMap(value string) map[string]string {
|
||||
func (p *TextMapPropagator) parseCommaSeparatedMap(value string) map[string]string {
|
||||
baggage := make(map[string]string)
|
||||
value, err := url.QueryUnescape(value)
|
||||
if err != nil {
|
||||
|
@ -289,12 +298,12 @@ func (p *textMapPropagator) parseCommaSeparatedMap(value string) map[string]stri
|
|||
|
||||
// Converts a baggage item key into an http header format,
|
||||
// by prepending TraceBaggageHeaderPrefix and encoding the key string
|
||||
func (p *textMapPropagator) addBaggageKeyPrefix(key string) string {
|
||||
func (p *TextMapPropagator) addBaggageKeyPrefix(key string) string {
|
||||
// TODO encodeBaggageKeyAsHeader add caching and escaping
|
||||
return fmt.Sprintf("%v%v", p.headerKeys.TraceBaggageHeaderPrefix, key)
|
||||
}
|
||||
|
||||
func (p *textMapPropagator) removeBaggageKeyPrefix(key string) string {
|
||||
func (p *TextMapPropagator) removeBaggageKeyPrefix(key string) string {
|
||||
// TODO decodeBaggageHeaderKey add caching and escaping
|
||||
return key[len(p.headerKeys.TraceBaggageHeaderPrefix):]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue