1
0
Fork 0

Updates for jaeger tracing client.

This commit is contained in:
Tristan Colgate-McFarlane 2018-08-01 12:52:03 +01:00 committed by Traefiker Bot
parent 4809476c19
commit 6f6ebb8025
92 changed files with 6824 additions and 819 deletions

View file

@ -1,27 +1,26 @@
// Copyright (c) 2016 Uber Technologies, Inc.
// Copyright (c) 2017 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// http://www.apache.org/licenses/LICENSE-2.0
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package jaeger
import (
"time"
"github.com/opentracing/opentracing-go"
"github.com/uber/jaeger-client-go/internal/baggage"
"github.com/uber/jaeger-client-go/internal/throttler"
)
// TracerOption is a function that sets some option on the tracer
@ -47,6 +46,19 @@ func (tracerOptions) Logger(logger Logger) TracerOption {
}
}
func (tracerOptions) CustomHeaderKeys(headerKeys *HeadersConfig) TracerOption {
return func(tracer *Tracer) {
if headerKeys == nil {
return
}
textPropagator := newTextMapPropagator(headerKeys.applyDefaults(), tracer.metrics)
tracer.addCodec(opentracing.TextMap, textPropagator, textPropagator)
httpHeaderPropagator := newHTTPHeaderPropagator(headerKeys.applyDefaults(), tracer.metrics)
tracer.addCodec(opentracing.HTTPHeaders, httpHeaderPropagator, httpHeaderPropagator)
}
}
// TimeNow creates a TracerOption that gives the tracer a function
// used to generate timestamps for spans.
func (tracerOptions) TimeNow(timeNow func() time.Time) TracerOption {
@ -104,6 +116,18 @@ func (tracerOptions) ContribObserver(observer ContribObserver) TracerOption {
}
}
func (tracerOptions) Gen128Bit(gen128Bit bool) TracerOption {
return func(tracer *Tracer) {
tracer.options.gen128Bit = gen128Bit
}
}
func (tracerOptions) HighTraceIDGenerator(highTraceIDGenerator func() uint64) TracerOption {
return func(tracer *Tracer) {
tracer.options.highTraceIDGenerator = highTraceIDGenerator
}
}
func (tracerOptions) ZipkinSharedRPCSpan(zipkinSharedRPCSpan bool) TracerOption {
return func(tracer *Tracer) {
tracer.options.zipkinSharedRPCSpan = zipkinSharedRPCSpan
@ -115,3 +139,15 @@ func (tracerOptions) Tag(key string, value interface{}) TracerOption {
tracer.tags = append(tracer.tags, Tag{key: key, value: value})
}
}
func (tracerOptions) BaggageRestrictionManager(mgr baggage.RestrictionManager) TracerOption {
return func(tracer *Tracer) {
tracer.baggageRestrictionManager = mgr
}
}
func (tracerOptions) DebugThrottler(throttler throttler.Throttler) TracerOption {
return func(tracer *Tracer) {
tracer.debugThrottler = throttler
}
}