diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-09-30 11:53:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-30 11:53:01 -0700 |
commit | 04b3a73635d8150138fab853ce8f2e6e60f6581d (patch) | |
tree | dbd35cb6a356029228ee880d3c18f7ad13c7e428 /vendor/github.com/uber | |
parent | 79c18f134dbc985e6dce7bc88eea57a75b035c89 (diff) | |
parent | 2f397ecdeb1f5f064e30c3ab9bf85f5c10c41afa (diff) | |
download | podman-04b3a73635d8150138fab853ce8f2e6e60f6581d.tar.gz podman-04b3a73635d8150138fab853ce8f2e6e60f6581d.tar.bz2 podman-04b3a73635d8150138fab853ce8f2e6e60f6581d.zip |
Merge pull request #4145 from containers/dependabot/go_modules/github.com/uber/jaeger-client-go-2.19.0+incompatible
Bump github.com/uber/jaeger-client-go from 2.16.0+incompatible to 2.19.0+incompatible
Diffstat (limited to 'vendor/github.com/uber')
20 files changed, 494 insertions, 183 deletions
diff --git a/vendor/github.com/uber/jaeger-client-go/.travis.yml b/vendor/github.com/uber/jaeger-client-go/.travis.yml index acdc2a010..0d7bdd9ab 100644 --- a/vendor/github.com/uber/jaeger-client-go/.travis.yml +++ b/vendor/github.com/uber/jaeger-client-go/.travis.yml @@ -10,14 +10,17 @@ matrix: - go: 1.12.x env: - TESTS=true + - USE_DEP=true - COVERAGE=true - go: 1.12.x env: + - USE_DEP=true - CROSSDOCK=true - go: 1.12.x env: - TESTS=true - - USE_DEP=true + - USE_DEP=false + - USE_GLIDE=true - go: 1.11.x env: - TESTS=true @@ -30,7 +33,6 @@ services: env: global: - DOCKER_COMPOSE_VERSION=1.8.0 - - GO15VENDOREXPERIMENT=1 - COMMIT=${TRAVIS_COMMIT::8} # DOCKER_PASS - secure: "CnjVyxNvMC/dhr/eR7C+FiWucZ4/O5LfAuz9YU0qlnV6XLR7XXRtzZlfFKIImJT6xHp+OptTqAIXqUbvwK2OXDP1ZsLiWRm+2elb9/isGusWXjs3g817lX8njSUcIFILbfi+vAE7UD2BKjHxpmvWmCZidisU1rcaZ9OQNPqMnNIDxVx0FOTwYx+2hfkdjnN5dikzafBDQ6ZZV/mGbcaTG45GGFU6DHyVLzf9qCPXyXnz2+VDhcoPQsYkzE56XHCmHxvEfXxgfqYefJNUlFPhniAQySVsCNVDJ8QcCV6uHaXoIzxJKx9FdUnWKI1/AtpQsTZPgEm4Ujnt+kGJsXopXy2Xx4MZxmcTCBwAMjZxPMF7KoojbtDeOZgEMtf1tGPN6DTNc3NpVmr0BKZ44lhqk+vnd8HAiC1tHDEoSb1Esl7dMUUf1qZAh3MtT+NYi3mTwyx/ilXUS7KPyy7x0ezB3kGuMoLhvR2hrprqRr5NOV2hrd1au+IXmb+4IanFOsBlceBfs8P0JFMO/aw15r+HimSZpQsJx//IT0LReCZYXLe0/WVsF/8+HDwHKlO99gGpk4iXlNKKvdPWabihMp3I3peMrvL+jnlwh47RqHs/0Q71xsKjVWTn+Svq3FpVP0Pgyxhg+oG4WEByBiLnBQcZwSBhWexkJrNI73GzaZiIldk=" @@ -38,7 +40,7 @@ env: - secure: "bpBSmypHzI4PnteM4cwLiMC2163Sj/4mEl+1dj+6NWl2tr1hREeVXKhsWBpah25n6BDyr2A4yhBZcWLaNKrsCKT3U37csAQTOFVeQ9x5xhPq+ohANd/OsspFsxNZaKwx161LizH/uTDotMxxevZacsyYWGNv/cRFkwcQ8upLkReRR6puJ+jNQC0BFpKWBJY/zpm5J7xFb7FO20LvQVyRgsgzqWmg9oRNVw9uwOfSY3btacftYctDLUbAr8YRNHd2C6dZnMAi8KdDTLXKTqjKmp6WidOmi92Ml7tOjB+bV6TOaVAhrcI5Rdje4rRWG4MucAjPMP0ZBW36KTfcGqFUcDhX7UqISe2WxoI+8ZD6fJ+nNtD3bk4YAUJB4BSs2sQdiYyjpHyGJR6RW50+3uRz2YbXpzVr9wqv2lZSl/xy3wC5Hag55uqzVlSiDw2pK8lctT3dnQveE7PqAI577PjF2NrHlgrBbykOwwUCNbRTmykzqoDnkxclmiZ+rflEeWsSYglePK/d6Gj9+N7wJZM5heprdJJMFTrzMWZ21Ll9ZGY9updCBKmJA8pBYiLHbu0lWOp+9QUGC+621Zq0d1PHhN6L4eXk/f3RNoZTr//cX6WdNmmO7tBbaGpmp/UYiYTY1WO9vP7tCDsT75k285HCfnIrlGRdbCZZbfuYNGPKIQ0=" install: - - make install-ci + - make install-ci USE_DEP=$USE_DEP - if [ "$CROSSDOCK" == true ]; then bash ./travis/install-crossdock-deps.sh ; fi script: diff --git a/vendor/github.com/uber/jaeger-client-go/CHANGELOG.md b/vendor/github.com/uber/jaeger-client-go/CHANGELOG.md index 05216d5a8..31b22e40c 100644 --- a/vendor/github.com/uber/jaeger-client-go/CHANGELOG.md +++ b/vendor/github.com/uber/jaeger-client-go/CHANGELOG.md @@ -1,6 +1,37 @@ Changes by Version ================== +2.19.0 (2019-09-23) +------------------- + +- Upgrade jaeger-lib to 2.2 and unpin Prom client (#434) -- Yuri Shkuro + + +2.18.1 (2019-09-16) +------------------- + +- Remove go.mod / go.sum that interfere with `go get` (#432) + + +2.18.0 (2019-09-09) +------------------- + +- Add option "noDebugFlagOnForcedSampling" for tracer initialization [resolves #422] (#423) <Jun Guo> + + +2.17.0 (2019-08-30) +------------------- + +- Add a flag for firehose mode (#419) <Prithvi Raj> +- Default sampling server URL to agent (#414) <Bryan Boreham> +- Update default sampling rate when sampling strategy is refreshed (#413) <Bryan Boreham> +- Support "Self" Span Reference (#411) <dm03514> +- Don't complain about blank service name if tracing is Disabled (#410) Yuri <Shkuro> +- Use IP address from tag if exist (#402) <NikoKVCS> +- Expose span data to custom reporters [fixes #394] (#399) <Curtis Allen> +- Fix the span allocation in the pool (#381) <Dmitry Ponomarev> + + 2.16.0 (2019-03-24) ------------------- diff --git a/vendor/github.com/uber/jaeger-client-go/CONTRIBUTING.md b/vendor/github.com/uber/jaeger-client-go/CONTRIBUTING.md index 7cf014a51..41e2154cf 100644 --- a/vendor/github.com/uber/jaeger-client-go/CONTRIBUTING.md +++ b/vendor/github.com/uber/jaeger-client-go/CONTRIBUTING.md @@ -19,7 +19,7 @@ file for details. ## Getting Started -This library uses [glide](https://github.com/Masterminds/glide) to manage dependencies. +This library uses [dep](https://golang.github.io/dep/) to manage dependencies. To get started, make sure you clone the Git repository into the correct location `github.com/uber/jaeger-client-go` relative to `$GOPATH`: @@ -29,13 +29,13 @@ mkdir -p $GOPATH/src/github.com/uber cd $GOPATH/src/github.com/uber git clone git@github.com:jaegertracing/jaeger-client-go.git jaeger-client-go cd jaeger-client-go +git submodule update --init --recursive ``` Then install dependencies and run the tests: ``` -git submodule update --init --recursive -glide install +make install make test ``` @@ -45,13 +45,13 @@ This projects follows the following pattern for grouping imports in Go files: * imports from standard library * imports from other projects * imports from `jaeger-client-go` project - + For example: ```go import ( "fmt" - + "github.com/uber/jaeger-lib/metrics" "go.uber.org/zap" diff --git a/vendor/github.com/uber/jaeger-client-go/Gopkg.lock b/vendor/github.com/uber/jaeger-client-go/Gopkg.lock index 55d9ac030..1ed86f4a7 100644 --- a/vendor/github.com/uber/jaeger-client-go/Gopkg.lock +++ b/vendor/github.com/uber/jaeger-client-go/Gopkg.lock @@ -2,12 +2,12 @@ [[projects]] - branch = "master" digest = "1:d6afaeed1502aa28e80a4ed0981d570ad91b2579193404256ce672ed0a609e0d" name = "github.com/beorn7/perks" packages = ["quantile"] pruneopts = "UT" - revision = "3a771d992973f24aa725d07868b467d1ddfceafb" + revision = "37c8de3658fcb183f997c4e13e8337516ab753e6" + version = "v1.0.1" [[projects]] branch = "master" @@ -38,12 +38,12 @@ version = "v1.1.1" [[projects]] - digest = "1:318f1c959a8a740366fce4b1e1eb2fd914036b4af58fbd0a003349b305f118ad" + digest = "1:573ca21d3669500ff845bdebee890eb7fc7f0f50c59f2132f2a0c6b03d85086a" name = "github.com/golang/protobuf" packages = ["proto"] pruneopts = "UT" - revision = "b5d812f8a3706043e23a9cd5babf2e5423744d30" - version = "v1.3.1" + revision = "6c65a5562fc06764971b7c5d05c76c75e84bdbf7" + version = "v1.3.2" [[projects]] digest = "1:ff5ebae34cfbf047d505ee150de27e60570e8c394b3b8fdbb720ff6ac71985fc" @@ -83,12 +83,15 @@ version = "v1.0.0" [[projects]] - digest = "1:b6221ec0f8903b556e127c449e7106b63e6867170c2d10a7c058623d086f2081" + digest = "1:7097829edd12fd7211fca0d29496b44f94ef9e6d72f88fb64f3d7b06315818ad" name = "github.com/prometheus/client_golang" - packages = ["prometheus"] + packages = [ + "prometheus", + "prometheus/internal", + ] pruneopts = "UT" - revision = "c5b7fccd204277076155f10851dad72b76a49317" - version = "v0.8.0" + revision = "170205fb58decfd011f1550d4cfb737230d7ae4f" + version = "v1.1.0" [[projects]] branch = "master" @@ -96,10 +99,10 @@ name = "github.com/prometheus/client_model" packages = ["go"] pruneopts = "UT" - revision = "fd36f4220a901265f90734c3183c5f0c91daa0b8" + revision = "14fe0d1b01d4d5fc031dd4bec1823bd3ebbe8016" [[projects]] - digest = "1:35cf6bdf68db765988baa9c4f10cc5d7dda1126a54bd62e252dbcd0b1fc8da90" + digest = "1:f119e3205d3a1f0f19dbd7038eb37528e2c6f0933269dc344e305951fb87d632" name = "github.com/prometheus/common" packages = [ "expfmt", @@ -107,25 +110,23 @@ "model", ] pruneopts = "UT" - revision = "cfeb6f9992ffa54aaa4f2170ade4067ee478b250" - version = "v0.2.0" + revision = "287d3e634a1e550c9e463dd7e5a75a422c614505" + version = "v0.7.0" [[projects]] - branch = "master" - digest = "1:c31163bd62461e0c5f7ddc7363e39ef8d9e929693e77b5c11c709b05f9cb9219" + digest = "1:a210815b437763623ecca8eb91e6a0bf4f2d6773c5a6c9aec0e28f19e5fd6deb" name = "github.com/prometheus/procfs" packages = [ ".", + "internal/fs", "internal/util", - "iostats", - "nfs", - "xfs", ] pruneopts = "UT" - revision = "55ae3d9d557340b5bc24cd8aa5f6fa2c2ab31352" + revision = "499c85531f756d1129edd26485a5f73871eeb308" + version = "v0.0.5" [[projects]] - digest = "1:8ff03ccc603abb0d7cce94d34b613f5f6251a9e1931eba1a3f9888a9029b055c" + digest = "1:0496f0e99014b7fd0a560c539f51d0882731137b85494142f47e550e4657176a" name = "github.com/stretchr/testify" packages = [ "assert", @@ -133,19 +134,19 @@ "suite", ] pruneopts = "UT" - revision = "ffdc059bfe9ce6a4e144ba849dbedead332c6053" - version = "v1.3.0" + revision = "221dbe5ed46703ee255b1da0dec05086f5035f62" + version = "v1.4.0" [[projects]] - digest = "1:3c1a69cdae3501bf75e76d0d86dc6f2b0a7421bc205c0cb7b96b19eed464a34d" + digest = "1:a5158647b553c61877aa9ae74f4015000294e47981e6b8b07525edcbb0747c81" name = "github.com/uber-go/atomic" packages = ["."] pruneopts = "UT" - revision = "1ea20fb1cbb1cc08cbd0d913a96dead89aa18289" - version = "v1.3.2" + revision = "df976f2515e274675050de7b3f42545de80594fd" + version = "v1.4.0" [[projects]] - digest = "1:f5c5ad1e08141e18aee1b9c37729d93d06805840421ccfc9d407787ffe969ce6" + digest = "1:0ec60ffd594af00ba1660bc746aa0e443d27dd4003dee55f9d08a0b4ff5431a3" name = "github.com/uber/jaeger-lib" packages = [ "metrics", @@ -153,16 +154,16 @@ "metrics/prometheus", ] pruneopts = "UT" - revision = "0e30338a695636fe5bcf7301e8030ce8dd2a8530" - version = "v2.0.0" + revision = "a87ae9d84fb038a8d79266298970720be7c80fcd" + version = "v2.2.0" [[projects]] - digest = "1:3c1a69cdae3501bf75e76d0d86dc6f2b0a7421bc205c0cb7b96b19eed464a34d" + digest = "1:a5158647b553c61877aa9ae74f4015000294e47981e6b8b07525edcbb0747c81" name = "go.uber.org/atomic" packages = ["."] pruneopts = "UT" - revision = "1ea20fb1cbb1cc08cbd0d913a96dead89aa18289" - version = "v1.3.2" + revision = "df976f2515e274675050de7b3f42545de80594fd" + version = "v1.4.0" [[projects]] digest = "1:60bf2a5e347af463c42ed31a493d817f8a72f102543060ed992754e689805d1a" @@ -173,7 +174,7 @@ version = "v1.1.0" [[projects]] - digest = "1:c52caf7bd44f92e54627a31b85baf06a68333a196b3d8d241480a774733dcf8b" + digest = "1:676160e6a4722b08e0e26b11521d575c2cb2b6f0c679e1ee6178c5d8dee51e5e" name = "go.uber.org/zap" packages = [ ".", @@ -184,8 +185,8 @@ "zapcore", ] pruneopts = "UT" - revision = "ff33455a0e382e8a81d14dd7c922020b6b5e7982" - version = "v1.9.1" + revision = "27376062155ad36be76b0f12cf1572a221d3a48c" + version = "v1.10.0" [[projects]] branch = "master" @@ -196,7 +197,23 @@ "context/ctxhttp", ] pruneopts = "UT" - revision = "addf6b3196f61cd44ce5a76657913698c73479d0" + revision = "aa69164e4478b84860dc6769c710c699c67058a3" + +[[projects]] + branch = "master" + digest = "1:712252802d318c8107d8f2136b99aa10feb17eca715245ed915199fbfc260155" + name = "golang.org/x/sys" + packages = ["windows"] + pruneopts = "UT" + revision = "0a153f010e6963173baba2306531d173aa843137" + +[[projects]] + digest = "1:4d2e5a73dc1500038e504a8d78b986630e3626dc027bc030ba5c75da257cdb96" + name = "gopkg.in/yaml.v2" + packages = ["."] + pruneopts = "UT" + revision = "51d6538a90f86fe93ac480b35f37b2be17fef232" + version = "v2.2.2" [solve-meta] analyzer-name = "dep" diff --git a/vendor/github.com/uber/jaeger-client-go/Gopkg.toml b/vendor/github.com/uber/jaeger-client-go/Gopkg.toml index 067f15a92..3e6ac35ae 100644 --- a/vendor/github.com/uber/jaeger-client-go/Gopkg.toml +++ b/vendor/github.com/uber/jaeger-client-go/Gopkg.toml @@ -8,7 +8,7 @@ [[constraint]] name = "github.com/prometheus/client_golang" - version = "0.8.0" + version = "^1" [[constraint]] name = "github.com/stretchr/testify" @@ -20,7 +20,7 @@ [[constraint]] name = "github.com/uber/jaeger-lib" - version = "^2.0" + version = "^2.2" [[constraint]] name = "go.uber.org/zap" diff --git a/vendor/github.com/uber/jaeger-client-go/Makefile b/vendor/github.com/uber/jaeger-client-go/Makefile index 1b10c0964..74e11787a 100644 --- a/vendor/github.com/uber/jaeger-client-go/Makefile +++ b/vendor/github.com/uber/jaeger-client-go/Makefile @@ -1,14 +1,14 @@ PROJECT_ROOT=github.com/uber/jaeger-client-go -PACKAGES := $(shell glide novendor | grep -v -e ./thrift-gen/... -e ./thrift/...) +PACKAGES := $(shell go list ./... | awk -F/ 'NR>1 {print "./"$$4"/..."}' | grep -v -e ./thrift-gen/... -e ./thrift/... | sort -u) # all .go files that don't exist in hidden directories ALL_SRC := $(shell find . -name "*.go" | grep -v -e vendor -e thrift-gen -e ./thrift/ \ -e ".*/\..*" \ -e ".*/_.*" \ -e ".*/mocks.*") --include crossdock/rules.mk +USE_DEP := true -export GO15VENDOREXPERIMENT=1 +-include crossdock/rules.mk RACE=-race GOTEST=go test -v $(RACE) @@ -58,19 +58,24 @@ lint: .PHONY: install install: - glide --version || go get github.com/Masterminds/glide + @echo install: USE_DEP=$(USE_DEP) USE_GLIDE=$(USE_GLIDE) ifeq ($(USE_DEP),true) + dep version || make install-dep dep ensure -else +endif +ifeq ($(USE_GLIDE),true) + glide --version || go get github.com/Masterminds/glide glide install endif .PHONY: cover cover: - ./scripts/cover.sh $(shell go list $(PACKAGES)) - go tool cover -html=cover.out -o cover.html + $(GOTEST) -cover -coverprofile cover.out $(PACKAGES) +.PHONY: cover-html +cover-html: cover + go tool cover -html=cover.out -o cover.html # This is not part of the regular test target because we don't want to slow it # down. @@ -101,21 +106,20 @@ idl-submodule: thrift-image: $(THRIFT) -version -.PHONY: install-dep-ci -install-dep-ci: +.PHONY: install-dep +install-dep: - curl -L -s https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 -o $$GOPATH/bin/dep - chmod +x $$GOPATH/bin/dep .PHONY: install-ci -install-ci: install-dep-ci install +install-ci: install go get github.com/wadey/gocovmerge go get github.com/mattn/goveralls go get golang.org/x/tools/cmd/cover go get golang.org/x/lint/golint .PHONY: test-ci -test-ci: - @./scripts/cover.sh $(shell go list $(PACKAGES)) +test-ci: cover ifeq ($(CI_SKIP_LINT),true) echo 'skipping lint' else diff --git a/vendor/github.com/uber/jaeger-client-go/README.md b/vendor/github.com/uber/jaeger-client-go/README.md index 6d9546e5b..604d4b571 100644 --- a/vendor/github.com/uber/jaeger-client-go/README.md +++ b/vendor/github.com/uber/jaeger-client-go/README.md @@ -3,7 +3,7 @@ # Jaeger Bindings for Go OpenTracing API Instrumentation library that implements an -[OpenTracing](http://opentracing.io) Tracer for Jaeger (https://jaegertracing.io). +[OpenTracing Go](https://github.com/opentracing/opentracing-go) Tracer for Jaeger (https://jaegertracing.io). **IMPORTANT**: The library's import path is based on its original location under `github.com/uber`. Do not try to import it as `github.com/jaegertracing`, it will not compile. We might revisit this in the next major release. * :white_check_mark: `import "github.com/uber/jaeger-client-go"` @@ -15,19 +15,20 @@ Please see [CONTRIBUTING.md](CONTRIBUTING.md). ## Installation -We recommended using a dependency manager like [glide](https://github.com/Masterminds/glide) +We recommended using a dependency manager like [dep](https://golang.github.io/dep/) and [semantic versioning](http://semver.org/) when including this library into an application. For example, Jaeger backend imports this library like this: -```yaml -- package: github.com/uber/jaeger-client-go - version: ^2.7.0 +```toml +[[constraint]] + name = "github.com/uber/jaeger-client-go" + version = "2.17" ``` If you instead want to use the latest version in `master`, you can pull it via `go get`. Note that during `go get` you may see build errors due to incompatible dependencies, which is why we recommend using semantic versions for dependencies. The error may be fixed by running -`make install` (it will install `glide` if you don't have it): +`make install` (it will install `dep` if you don't have it): ```shell go get -u github.com/uber/jaeger-client-go/ @@ -222,7 +223,7 @@ import ( ) span := opentracing.SpanFromContext(ctx) -ext.SamplingPriority.Set(span, 1) +ext.SamplingPriority.Set(span, 1) ``` #### Via HTTP Headers @@ -253,6 +254,24 @@ by a lot of Zipkin tracers. This means that you can use Jaeger in conjunction wi However it is not the default propagation format, see [here](zipkin/README.md#NewZipkinB3HTTPHeaderPropagator) how to set it up. +## SelfRef + +Jaeger Tracer supports an additional [reference](https://github.com/opentracing/specification/blob/1.1/specification.md#references-between-spans) +type call `Self`. This allows a caller to provide an already established `SpanContext`. +This allows loading and continuing spans/traces from offline (ie log-based) storage. The `Self` reference +bypasses trace and span id generation. + + +Usage requires passing in a `SpanContext` and the jaeger `Self` reference type: +``` +span := tracer.StartSpan( + "continued_span", + SelfRef(yourSpanContext), +) +... +defer span.finish() +``` + ## License [Apache 2.0 License](LICENSE). diff --git a/vendor/github.com/uber/jaeger-client-go/config/config.go b/vendor/github.com/uber/jaeger-client-go/config/config.go index 320125087..6bce1b3b0 100644 --- a/vendor/github.com/uber/jaeger-client-go/config/config.go +++ b/vendor/github.com/uber/jaeger-client-go/config/config.go @@ -181,13 +181,14 @@ func (c Configuration) New( // NewTracer returns a new tracer based on the current configuration, using the given options, // and a closer func that can be used to flush buffers before shutdown. func (c Configuration) NewTracer(options ...Option) (opentracing.Tracer, io.Closer, error) { + if c.Disabled { + return &opentracing.NoopTracer{}, &nullCloser{}, nil + } + if c.ServiceName == "" { return nil, nil, errors.New("no service name provided") } - if c.Disabled { - return &opentracing.NoopTracer{}, &nullCloser{}, nil - } opts := applyOptions(options...) tracerMetrics := jaeger.NewMetrics(opts.metrics, nil) if c.RPCMetrics { @@ -234,6 +235,7 @@ func (c Configuration) NewTracer(options ...Option) (opentracing.Tracer, io.Clos jaeger.TracerOptions.PoolSpans(opts.poolSpans), jaeger.TracerOptions.ZipkinSharedRPCSpan(opts.zipkinSharedRPCSpan), jaeger.TracerOptions.MaxTagValueLength(opts.maxTagValueLength), + jaeger.TracerOptions.NoDebugFlagOnForcedSampling(opts.noDebugFlagOnForcedSampling), } for _, tag := range opts.tags { diff --git a/vendor/github.com/uber/jaeger-client-go/config/config_env.go b/vendor/github.com/uber/jaeger-client-go/config/config_env.go index ff70ae12c..14d69b11d 100644 --- a/vendor/github.com/uber/jaeger-client-go/config/config_env.go +++ b/vendor/github.com/uber/jaeger-client-go/config/config_env.go @@ -110,6 +110,9 @@ func samplerConfigFromEnv() (*SamplerConfig, error) { if e := os.Getenv(envSamplerManagerHostPort); e != "" { sc.SamplingServerURL = e + } else if e := os.Getenv(envAgentHost); e != "" { + // Fallback if we know the agent host - try the sampling endpoint there + sc.SamplingServerURL = fmt.Sprintf("http://%s:%d/sampling", e, jaeger.DefaultSamplingServerPort) } if e := os.Getenv(envSamplerMaxOperations); e != "" { diff --git a/vendor/github.com/uber/jaeger-client-go/config/options.go b/vendor/github.com/uber/jaeger-client-go/config/options.go index 322691bea..e0e50e834 100644 --- a/vendor/github.com/uber/jaeger-client-go/config/options.go +++ b/vendor/github.com/uber/jaeger-client-go/config/options.go @@ -26,19 +26,20 @@ type Option func(c *Options) // Options control behavior of the client. type Options struct { - metrics metrics.Factory - logger jaeger.Logger - reporter jaeger.Reporter - sampler jaeger.Sampler - contribObservers []jaeger.ContribObserver - observers []jaeger.Observer - gen128Bit bool - poolSpans bool - zipkinSharedRPCSpan bool - maxTagValueLength int - tags []opentracing.Tag - injectors map[interface{}]jaeger.Injector - extractors map[interface{}]jaeger.Extractor + metrics metrics.Factory + logger jaeger.Logger + reporter jaeger.Reporter + sampler jaeger.Sampler + contribObservers []jaeger.ContribObserver + observers []jaeger.Observer + gen128Bit bool + poolSpans bool + zipkinSharedRPCSpan bool + maxTagValueLength int + noDebugFlagOnForcedSampling bool + tags []opentracing.Tag + injectors map[interface{}]jaeger.Injector + extractors map[interface{}]jaeger.Extractor } // Metrics creates an Option that initializes Metrics in the tracer, @@ -117,6 +118,14 @@ func MaxTagValueLength(maxTagValueLength int) Option { } } +// NoDebugFlagOnForcedSampling can be used to decide whether debug flag will be set or not +// when calling span.setSamplingPriority to force sample a span. +func NoDebugFlagOnForcedSampling(noDebugFlagOnForcedSampling bool) Option { + return func(c *Options) { + c.noDebugFlagOnForcedSampling = noDebugFlagOnForcedSampling + } +} + // Tag creates an option that adds a tracer-level tag. func Tag(key string, value interface{}) Option { return func(c *Options) { diff --git a/vendor/github.com/uber/jaeger-client-go/constants.go b/vendor/github.com/uber/jaeger-client-go/constants.go index aa2d43fc8..e95b2ba09 100644 --- a/vendor/github.com/uber/jaeger-client-go/constants.go +++ b/vendor/github.com/uber/jaeger-client-go/constants.go @@ -14,9 +14,15 @@ package jaeger +import ( + "fmt" + + "github.com/opentracing/opentracing-go" +) + const ( // JaegerClientVersion is the version of the client library reported as Span tag. - JaegerClientVersion = "Go-2.16.0" + JaegerClientVersion = "Go-2.19.0" // JaegerClientVersionTagKey is the name of the tag used to report client version. JaegerClientVersionTagKey = "jaeger.version" @@ -83,6 +89,18 @@ const ( // DefaultUDPSpanServerPort is the default port to send the spans to, via UDP DefaultUDPSpanServerPort = 6831 + // DefaultSamplingServerPort is the default port to fetch sampling config from, via http + DefaultSamplingServerPort = 5778 + // DefaultMaxTagValueLength is the default max length of byte array or string allowed in the tag value. DefaultMaxTagValueLength = 256 + + // SelfRefType is a jaeger specific reference type that supports creating a span + // with an already defined context. + selfRefType opentracing.SpanReferenceType = 99 +) + +var ( + // DefaultSamplingServerURL is the default url to fetch sampling config from, via http + DefaultSamplingServerURL = fmt.Sprintf("http://localhost:%d/sampling", DefaultSamplingServerPort) ) diff --git a/vendor/github.com/uber/jaeger-client-go/context.go b/vendor/github.com/uber/jaeger-client-go/context.go index 90045f4fc..43553655a 100644 --- a/vendor/github.com/uber/jaeger-client-go/context.go +++ b/vendor/github.com/uber/jaeger-client-go/context.go @@ -22,8 +22,9 @@ import ( ) const ( - flagSampled = byte(1) - flagDebug = byte(2) + flagSampled = byte(1) + flagDebug = byte(2) + flagFirehose = byte(8) ) var ( @@ -88,6 +89,11 @@ func (c SpanContext) IsDebug() bool { return (c.flags & flagDebug) == flagDebug } +// IsFirehose indicates whether the firehose flag was set +func (c SpanContext) IsFirehose() bool { + return (c.flags & flagFirehose) == flagFirehose +} + // IsValid indicates whether this context actually represents a valid trace. func (c SpanContext) IsValid() bool { return c.traceID.IsValid() && c.spanID != 0 diff --git a/vendor/github.com/uber/jaeger-client-go/glide.lock b/vendor/github.com/uber/jaeger-client-go/glide.lock index af659ca0e..c16d6d43f 100644 --- a/vendor/github.com/uber/jaeger-client-go/glide.lock +++ b/vendor/github.com/uber/jaeger-client-go/glide.lock @@ -1,8 +1,8 @@ -hash: 92cc8f956428fc65bee07d809a752f34376aece141c934eff02aefa08d450b72 -updated: 2019-03-23T18:26:09.960887-04:00 +hash: a4a449cfc060c2d7be850a69b171e4382a3bd00d1a0a72cfc944facc3fe263bf +updated: 2019-09-23T17:10:15.213856-04:00 imports: - name: github.com/beorn7/perks - version: 3a771d992973f24aa725d07868b467d1ddfceafb + version: 37c8de3658fcb183f997c4e13e8337516ab753e6 subpackages: - quantile - name: github.com/codahale/hdrhistogram @@ -17,11 +17,11 @@ imports: subpackages: - spew - name: github.com/golang/protobuf - version: bbd03ef6da3a115852eaf24c8a1c46aeb39aa175 + version: 1680a479a2cfb3fa22b972af7e36d0a0fde47bf8 subpackages: - proto - name: github.com/matttproud/golang_protobuf_extensions - version: c12348ce28de40eed0136aa2b644d0ee0650e56c + version: c182affec369e30f25d3eb8cd8a478dee585ae7d subpackages: - pbutil - name: github.com/opentracing/opentracing-go @@ -33,47 +33,49 @@ imports: - name: github.com/pkg/errors version: ba968bfe8b2f7e042a574c888954fccecfa385b4 - name: github.com/pmezard/go-difflib - version: 792786c7400a136282c1664665ae0a8db921c6c2 + version: 5d4384ee4fb2527b0a1256a821ebfc92f91efefc subpackages: - difflib - name: github.com/prometheus/client_golang - version: c5b7fccd204277076155f10851dad72b76a49317 + version: 170205fb58decfd011f1550d4cfb737230d7ae4f subpackages: - prometheus + - prometheus/internal - name: github.com/prometheus/client_model - version: 99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c + version: 14fe0d1b01d4d5fc031dd4bec1823bd3ebbe8016 subpackages: - go - name: github.com/prometheus/common - version: 38c53a9f4bfcd932d1b00bfc65e256a7fba6b37a + version: 287d3e634a1e550c9e463dd7e5a75a422c614505 subpackages: - expfmt - internal/bitbucket.org/ww/goautoneg - model - name: github.com/prometheus/procfs - version: 780932d4fbbe0e69b84c34c20f5c8d0981e109ea + version: de25ac347ef9305868b04dc42425c973b863b18c subpackages: + - internal/fs - internal/util - - nfs - - xfs - name: github.com/stretchr/testify - version: f35b8ab0b5a2cef36673838d662e249dd9c94686 + version: 85f2b59c4459e5bf57488796be8c3667cb8246d6 subpackages: - assert - require - suite +- name: github.com/uber-go/atomic + version: df976f2515e274675050de7b3f42545de80594fd - name: github.com/uber/jaeger-lib - version: 0e30338a695636fe5bcf7301e8030ce8dd2a8530 + version: a87ae9d84fb038a8d79266298970720be7c80fcd subpackages: - metrics - metrics/metricstest - metrics/prometheus - name: go.uber.org/atomic - version: 1ea20fb1cbb1cc08cbd0d913a96dead89aa18289 + version: df976f2515e274675050de7b3f42545de80594fd - name: go.uber.org/multierr version: 3c4937480c32f4c13a875a1829af76c98ca3d40a - name: go.uber.org/zap - version: ff33455a0e382e8a81d14dd7c922020b6b5e7982 + version: 27376062155ad36be76b0f12cf1572a221d3a48c subpackages: - buffer - internal/bufferpool @@ -81,10 +83,14 @@ imports: - internal/exit - zapcore - name: golang.org/x/net - version: 49bb7cea24b1df9410e1712aa6433dae904ff66a + version: aa69164e4478b84860dc6769c710c699c67058a3 subpackages: - context - context/ctxhttp -testImports: -- name: github.com/uber-go/atomic - version: 8474b86a5a6f79c443ce4b2992817ff32cf208b8 +- name: golang.org/x/sys + version: 0a153f010e6963173baba2306531d173aa843137 + subpackages: + - windows +- name: gopkg.in/yaml.v2 + version: 51d6538a90f86fe93ac480b35f37b2be17fef232 +testImports: [] diff --git a/vendor/github.com/uber/jaeger-client-go/glide.yaml b/vendor/github.com/uber/jaeger-client-go/glide.yaml index b3e5b80bc..3c7b5c379 100644 --- a/vendor/github.com/uber/jaeger-client-go/glide.yaml +++ b/vendor/github.com/uber/jaeger-client-go/glide.yaml @@ -12,11 +12,16 @@ import: - metrics - package: github.com/pkg/errors version: ~0.8.0 +- package: go.uber.org/zap + source: https://github.com/uber-go/zap.git + version: ^1 +- package: github.com/uber-go/atomic + version: ^1 +- package: github.com/prometheus/client_golang + version: ^1 testImport: - package: github.com/stretchr/testify subpackages: - assert - require - suite -- package: github.com/prometheus/client_golang - version: v0.8.0 diff --git a/vendor/github.com/uber/jaeger-client-go/reporter.go b/vendor/github.com/uber/jaeger-client-go/reporter.go index fe6288c4b..27163ebe4 100644 --- a/vendor/github.com/uber/jaeger-client-go/reporter.go +++ b/vendor/github.com/uber/jaeger-client-go/reporter.go @@ -93,13 +93,14 @@ func NewInMemoryReporter() *InMemoryReporter { // Report implements Report() method of Reporter by storing the span in the buffer. func (r *InMemoryReporter) Report(span *Span) { r.lock.Lock() - r.spans = append(r.spans, span) + // Need to retain the span otherwise it will be released + r.spans = append(r.spans, span.Retain()) r.lock.Unlock() } -// Close implements Close() method of Reporter by doing nothing. +// Close implements Close() method of Reporter func (r *InMemoryReporter) Close() { - // no-op + r.Reset() } // SpansSubmitted returns the number of spans accumulated in the buffer. @@ -122,7 +123,12 @@ func (r *InMemoryReporter) GetSpans() []opentracing.Span { func (r *InMemoryReporter) Reset() { r.lock.Lock() defer r.lock.Unlock() - r.spans = nil + + // Before reset the collection need to release Span memory + for _, span := range r.spans { + span.(*Span).Release() + } + r.spans = r.spans[:0] } // ------------------------------ @@ -218,7 +224,8 @@ func NewRemoteReporter(sender Transport, opts ...ReporterOption) Reporter { // because some of them may still be successfully added to the queue. func (r *remoteReporter) Report(span *Span) { select { - case r.queue <- reporterQueueItem{itemType: reporterQueueItemSpan, span: span}: + // Need to retain the span otherwise it will be released + case r.queue <- reporterQueueItem{itemType: reporterQueueItemSpan, span: span.Retain()}: atomic.AddInt64(&r.queueLength, 1) default: r.metrics.ReporterDropped.Inc(1) @@ -278,6 +285,7 @@ func (r *remoteReporter) processQueue() { // to reduce the number of gauge stats, we only emit queue length on flush r.metrics.ReporterQueueLength.Update(atomic.LoadInt64(&r.queueLength)) } + span.Release() case reporterQueueItemClose: timer.Stop() flush() diff --git a/vendor/github.com/uber/jaeger-client-go/sampler.go b/vendor/github.com/uber/jaeger-client-go/sampler.go index 3e1630953..ea6984e02 100644 --- a/vendor/github.com/uber/jaeger-client-go/sampler.go +++ b/vendor/github.com/uber/jaeger-client-go/sampler.go @@ -28,7 +28,6 @@ import ( ) const ( - defaultSamplingServerURL = "http://localhost:5778/sampling" defaultSamplingRefreshInterval = time.Minute defaultMaxOperations = 2000 ) @@ -348,24 +347,27 @@ func (s *adaptiveSampler) Equal(other Sampler) bool { func (s *adaptiveSampler) update(strategies *sampling.PerOperationSamplingStrategies) { s.Lock() defer s.Unlock() + newSamplers := map[string]*GuaranteedThroughputProbabilisticSampler{} for _, strategy := range strategies.PerOperationStrategies { operation := strategy.Operation samplingRate := strategy.ProbabilisticSampling.SamplingRate lowerBound := strategies.DefaultLowerBoundTracesPerSecond if sampler, ok := s.samplers[operation]; ok { sampler.update(lowerBound, samplingRate) + newSamplers[operation] = sampler } else { sampler := newGuaranteedThroughputProbabilisticSampler( lowerBound, samplingRate, ) - s.samplers[operation] = sampler + newSamplers[operation] = sampler } } s.lowerBound = strategies.DefaultLowerBoundTracesPerSecond if s.defaultSampler.SamplingRate() != strategies.DefaultSamplingProbability { s.defaultSampler = newProbabilisticSampler(strategies.DefaultSamplingProbability) } + s.samplers = newSamplers } // ----------------------- @@ -432,7 +434,7 @@ func applySamplerOptions(opts ...SamplerOption) samplerOptions { options.maxOperations = defaultMaxOperations } if options.samplingServerURL == "" { - options.samplingServerURL = defaultSamplingServerURL + options.samplingServerURL = DefaultSamplingServerURL } if options.metrics == nil { options.metrics = NewNullMetrics() diff --git a/vendor/github.com/uber/jaeger-client-go/span.go b/vendor/github.com/uber/jaeger-client-go/span.go index f0b497a90..9df8b6017 100644 --- a/vendor/github.com/uber/jaeger-client-go/span.go +++ b/vendor/github.com/uber/jaeger-client-go/span.go @@ -16,6 +16,7 @@ package jaeger import ( "sync" + "sync/atomic" "time" "github.com/opentracing/opentracing-go" @@ -25,6 +26,10 @@ import ( // Span implements opentracing.Span type Span struct { + // referenceCounter used to increase the lifetime of + // the object before return it into the pool. + referenceCounter int32 + sync.RWMutex tracer *Tracer @@ -91,6 +96,38 @@ func (s *Span) SetTag(key string, value interface{}) opentracing.Span { return s } +// SpanContext returns span context +func (s *Span) SpanContext() SpanContext { + s.Lock() + defer s.Unlock() + return s.context +} + +// StartTime returns span start time +func (s *Span) StartTime() time.Time { + s.Lock() + defer s.Unlock() + return s.startTime +} + +// Duration returns span duration +func (s *Span) Duration() time.Duration { + s.Lock() + defer s.Unlock() + return s.duration +} + +// Tags returns tags for span +func (s *Span) Tags() opentracing.Tags { + s.Lock() + defer s.Unlock() + var result = make(opentracing.Tags) + for _, tag := range s.tags { + result[tag.key] = tag.value + } + return result +} + func (s *Span) setTagNoLocking(key string, value interface{}) { s.tags = append(s.tags, Tag{key: key, value: value}) } @@ -174,6 +211,8 @@ func (s *Span) BaggageItem(key string) string { } // Finish implements opentracing.Span API +// After finishing the Span object it returns back to the allocator unless the reporter retains it again, +// so after that, the Span object should no longer be used because it won't be valid anymore. func (s *Span) Finish() { s.FinishWithOptions(opentracing.FinishOptions{}) } @@ -197,6 +236,7 @@ func (s *Span) FinishWithOptions(options opentracing.FinishOptions) { } s.Unlock() // call reportSpan even for non-sampled traces, to return span to the pool + // and update metrics counter s.tracer.reportSpan(s) } @@ -225,25 +265,66 @@ func (s *Span) OperationName() string { return s.operationName } +// Retain increases object counter to increase the lifetime of the object +func (s *Span) Retain() *Span { + atomic.AddInt32(&s.referenceCounter, 1) + return s +} + +// Release decrements object counter and return to the +// allocator manager when counter will below zero +func (s *Span) Release() { + if atomic.AddInt32(&s.referenceCounter, -1) == -1 { + s.tracer.spanAllocator.Put(s) + } +} + +// reset span state and release unused data +func (s *Span) reset() { + s.firstInProcess = false + s.context = emptyContext + s.operationName = "" + s.tracer = nil + s.startTime = time.Time{} + s.duration = 0 + s.observer = nil + atomic.StoreInt32(&s.referenceCounter, 0) + + // Note: To reuse memory we can save the pointers on the heap + s.tags = s.tags[:0] + s.logs = s.logs[:0] + s.references = s.references[:0] +} + func (s *Span) serviceName() string { return s.tracer.serviceName } // setSamplingPriority returns true if the flag was updated successfully, false otherwise. func setSamplingPriority(s *Span, value interface{}) bool { - s.Lock() - defer s.Unlock() val, ok := value.(uint16) if !ok { return false } + s.Lock() + defer s.Unlock() if val == 0 { s.context.flags = s.context.flags & (^flagSampled) return true } - if s.tracer.isDebugAllowed(s.operationName) { + if s.tracer.options.noDebugFlagOnForcedSampling { + s.context.flags = s.context.flags | flagSampled + return true + } else if s.tracer.isDebugAllowed(s.operationName) { s.context.flags = s.context.flags | flagDebug | flagSampled return true } return false } + +// EnableFirehose enables firehose flag on the span context +func EnableFirehose(s *Span) { + s.Lock() + defer s.Unlock() + s.context.flags |= flagFirehose +} diff --git a/vendor/github.com/uber/jaeger-client-go/span_allocator.go b/vendor/github.com/uber/jaeger-client-go/span_allocator.go new file mode 100644 index 000000000..6fe0cd0ce --- /dev/null +++ b/vendor/github.com/uber/jaeger-client-go/span_allocator.go @@ -0,0 +1,56 @@ +// Copyright (c) 2019 The Jaeger Authors. +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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 "sync" + +// SpanAllocator abstraction of managign span allocations +type SpanAllocator interface { + Get() *Span + Put(*Span) +} + +type syncPollSpanAllocator struct { + spanPool sync.Pool +} + +func newSyncPollSpanAllocator() SpanAllocator { + return &syncPollSpanAllocator{ + spanPool: sync.Pool{New: func() interface{} { + return &Span{} + }}, + } +} + +func (pool *syncPollSpanAllocator) Get() *Span { + return pool.spanPool.Get().(*Span) +} + +func (pool *syncPollSpanAllocator) Put(span *Span) { + span.reset() + pool.spanPool.Put(span) +} + +type simpleSpanAllocator struct{} + +func (pool simpleSpanAllocator) Get() *Span { + return &Span{} +} + +func (pool simpleSpanAllocator) Put(span *Span) { + // @comment https://github.com/jaegertracing/jaeger-client-go/pull/381#issuecomment-475904351 + // since finished spans are not reused, no need to reset them + // span.reset() +} diff --git a/vendor/github.com/uber/jaeger-client-go/tracer.go b/vendor/github.com/uber/jaeger-client-go/tracer.go index d87fb10be..745a0c38a 100644 --- a/vendor/github.com/uber/jaeger-client-go/tracer.go +++ b/vendor/github.com/uber/jaeger-client-go/tracer.go @@ -47,15 +47,15 @@ type Tracer struct { randomNumber func() uint64 options struct { - poolSpans bool - gen128Bit bool // whether to generate 128bit trace IDs - zipkinSharedRPCSpan bool - highTraceIDGenerator func() uint64 // custom high trace ID generator - maxTagValueLength int + gen128Bit bool // whether to generate 128bit trace IDs + zipkinSharedRPCSpan bool + highTraceIDGenerator func() uint64 // custom high trace ID generator + maxTagValueLength int + noDebugFlagOnForcedSampling bool // more options to come } - // pool for Span objects - spanPool sync.Pool + // allocator of Span objects + spanAllocator SpanAllocator injectors map[interface{}]Injector extractors map[interface{}]Extractor @@ -81,15 +81,13 @@ func NewTracer( options ...TracerOption, ) (opentracing.Tracer, io.Closer) { t := &Tracer{ - serviceName: serviceName, - sampler: sampler, - reporter: reporter, - injectors: make(map[interface{}]Injector), - extractors: make(map[interface{}]Extractor), - metrics: *NewNullMetrics(), - spanPool: sync.Pool{New: func() interface{} { - return &Span{} - }}, + serviceName: serviceName, + sampler: sampler, + reporter: reporter, + injectors: make(map[interface{}]Injector), + extractors: make(map[interface{}]Extractor), + metrics: *NewNullMetrics(), + spanAllocator: simpleSpanAllocator{}, } for _, option := range options { @@ -148,7 +146,15 @@ func NewTracer( if hostname, err := os.Hostname(); err == nil { t.tags = append(t.tags, Tag{key: TracerHostnameTagKey, value: hostname}) } - if ip, err := utils.HostIP(); err == nil { + if ipval, ok := t.getTag(TracerIPTagKey); ok { + ipv4, err := utils.ParseIPToUint32(ipval.(string)) + if err != nil { + t.hostIPv4 = 0 + t.logger.Error("Unable to convert the externally provided ip to uint32: " + err.Error()) + } else { + t.hostIPv4 = ipv4 + } + } else if ip, err := utils.HostIP(); err == nil { t.tags = append(t.tags, Tag{key: TracerIPTagKey, value: ip.String()}) t.hostIPv4 = utils.PackIPAsUint32(ip) } else { @@ -217,20 +223,30 @@ func (t *Tracer) startSpanWithOptions( var references []Reference var parent SpanContext var hasParent bool // need this because `parent` is a value, not reference + var ctx SpanContext + var isSelfRef bool for _, ref := range options.References { - ctx, ok := ref.ReferencedContext.(SpanContext) + ctxRef, ok := ref.ReferencedContext.(SpanContext) if !ok { t.logger.Error(fmt.Sprintf( "Reference contains invalid type of SpanReference: %s", reflect.ValueOf(ref.ReferencedContext))) continue } - if !isValidReference(ctx) { + if !isValidReference(ctxRef) { + continue + } + + if ref.Type == selfRefType { + isSelfRef = true + ctx = ctxRef continue } - references = append(references, Reference{Type: ref.Type, Context: ctx}) + + references = append(references, Reference{Type: ref.Type, Context: ctxRef}) + if !hasParent { - parent = ctx + parent = ctxRef hasParent = ref.Type == opentracing.ChildOfRef } } @@ -246,42 +262,43 @@ func (t *Tracer) startSpanWithOptions( } var samplerTags []Tag - var ctx SpanContext newTrace := false - if !hasParent || !parent.IsValid() { - newTrace = true - ctx.traceID.Low = t.randomID() - if t.options.gen128Bit { - ctx.traceID.High = t.options.highTraceIDGenerator() - } - ctx.spanID = SpanID(ctx.traceID.Low) - ctx.parentID = 0 - ctx.flags = byte(0) - if hasParent && parent.isDebugIDContainerOnly() && t.isDebugAllowed(operationName) { - ctx.flags |= (flagSampled | flagDebug) - samplerTags = []Tag{{key: JaegerDebugHeader, value: parent.debugID}} - } else if sampled, tags := t.sampler.IsSampled(ctx.traceID, operationName); sampled { - ctx.flags |= flagSampled - samplerTags = tags - } - } else { - ctx.traceID = parent.traceID - if rpcServer && t.options.zipkinSharedRPCSpan { - // Support Zipkin's one-span-per-RPC model - ctx.spanID = parent.spanID - ctx.parentID = parent.parentID + if !isSelfRef { + if !hasParent || !parent.IsValid() { + newTrace = true + ctx.traceID.Low = t.randomID() + if t.options.gen128Bit { + ctx.traceID.High = t.options.highTraceIDGenerator() + } + ctx.spanID = SpanID(ctx.traceID.Low) + ctx.parentID = 0 + ctx.flags = byte(0) + if hasParent && parent.isDebugIDContainerOnly() && t.isDebugAllowed(operationName) { + ctx.flags |= (flagSampled | flagDebug) + samplerTags = []Tag{{key: JaegerDebugHeader, value: parent.debugID}} + } else if sampled, tags := t.sampler.IsSampled(ctx.traceID, operationName); sampled { + ctx.flags |= flagSampled + samplerTags = tags + } } else { - ctx.spanID = SpanID(t.randomID()) - ctx.parentID = parent.spanID + ctx.traceID = parent.traceID + if rpcServer && t.options.zipkinSharedRPCSpan { + // Support Zipkin's one-span-per-RPC model + ctx.spanID = parent.spanID + ctx.parentID = parent.parentID + } else { + ctx.spanID = SpanID(t.randomID()) + ctx.parentID = parent.spanID + } + ctx.flags = parent.flags } - ctx.flags = parent.flags - } - if hasParent { - // copy baggage items - if l := len(parent.baggage); l > 0 { - ctx.baggage = make(map[string]string, len(parent.baggage)) - for k, v := range parent.baggage { - ctx.baggage[k] = v + if hasParent { + // copy baggage items + if l := len(parent.baggage); l > 0 { + ctx.baggage = make(map[string]string, len(parent.baggage)) + for k, v := range parent.baggage { + ctx.baggage[k] = v + } } } } @@ -350,18 +367,20 @@ func (t *Tracer) Tags() []opentracing.Tag { return tags } +// getTag returns the value of specific tag, if not exists, return nil. +func (t *Tracer) getTag(key string) (interface{}, bool) { + for _, tag := range t.tags { + if tag.key == key { + return tag.value, true + } + } + return nil, false +} + // newSpan returns an instance of a clean Span object. // If options.PoolSpans is true, the spans are retrieved from an object pool. func (t *Tracer) newSpan() *Span { - if !t.options.poolSpans { - return &Span{} - } - sp := t.spanPool.Get().(*Span) - sp.context = emptyContext - sp.tracer = nil - sp.tags = nil - sp.logs = nil - return sp + return t.spanAllocator.Get() } func (t *Tracer) startSpanInternal( @@ -416,12 +435,15 @@ func (t *Tracer) startSpanInternal( func (t *Tracer) reportSpan(sp *Span) { t.metrics.SpansFinished.Inc(1) + + // Note: if the reporter is processing Span asynchronously need to Retain() it + // otherwise, in the racing condition will be rewritten span data before it will be sent + // * To remove object use method span.Release() if sp.context.IsSampled() { t.reporter.Report(sp) } - if t.options.poolSpans { - t.spanPool.Put(sp) - } + + sp.Release() } // randomID generates a random trace/span ID, using tracer.random() generator. @@ -443,3 +465,13 @@ func (t *Tracer) setBaggage(sp *Span, key, value string) { func (t *Tracer) isDebugAllowed(operation string) bool { return t.debugThrottler.IsAllowed(operation) } + +// SelfRef creates an opentracing compliant SpanReference from a jaeger +// SpanContext. This is a factory function in order to encapsulate jaeger specific +// types. +func SelfRef(ctx SpanContext) opentracing.SpanReference { + return opentracing.SpanReference{ + Type: selfRefType, + ReferencedContext: ctx, + } +} diff --git a/vendor/github.com/uber/jaeger-client-go/tracer_options.go b/vendor/github.com/uber/jaeger-client-go/tracer_options.go index b4176cc72..469685bb4 100644 --- a/vendor/github.com/uber/jaeger-client-go/tracer_options.go +++ b/vendor/github.com/uber/jaeger-client-go/tracer_options.go @@ -81,7 +81,11 @@ func (tracerOptions) RandomNumber(randomNumber func() uint64) TracerOption { // that can access parent spans after those spans have been finished. func (tracerOptions) PoolSpans(poolSpans bool) TracerOption { return func(tracer *Tracer) { - tracer.options.poolSpans = poolSpans + if poolSpans { + tracer.spanAllocator = newSyncPollSpanAllocator() + } else { + tracer.spanAllocator = simpleSpanAllocator{} + } } } @@ -122,6 +126,12 @@ func (tracerOptions) Gen128Bit(gen128Bit bool) TracerOption { } } +func (tracerOptions) NoDebugFlagOnForcedSampling(noDebugFlagOnForcedSampling bool) TracerOption { + return func(tracer *Tracer) { + tracer.options.noDebugFlagOnForcedSampling = noDebugFlagOnForcedSampling + } +} + func (tracerOptions) HighTraceIDGenerator(highTraceIDGenerator func() uint64) TracerOption { return func(tracer *Tracer) { tracer.options.highTraceIDGenerator = highTraceIDGenerator |