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
This commit is contained in:
OpenShift Merge Robot
2019-09-30 11:53:01 -07:00
committed by GitHub
23 changed files with 498 additions and 185 deletions

2
go.mod
View File

@ -86,7 +86,7 @@ require (
github.com/spf13/viper v1.4.0 // indirect github.com/spf13/viper v1.4.0 // indirect
github.com/stretchr/testify v1.4.0 github.com/stretchr/testify v1.4.0
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2 github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2
github.com/uber/jaeger-client-go v2.16.0+incompatible github.com/uber/jaeger-client-go v2.19.0+incompatible
github.com/uber/jaeger-lib v0.0.0-20190122222657-d036253de8f5 // indirect github.com/uber/jaeger-lib v0.0.0-20190122222657-d036253de8f5 // indirect
github.com/ugorji/go v1.1.5-pre // indirect github.com/ugorji/go v1.1.5-pre // indirect
github.com/ulikunitz/xz v0.5.6 // indirect github.com/ulikunitz/xz v0.5.6 // indirect

2
go.sum
View File

@ -533,6 +533,8 @@ github.com/uber/jaeger-client-go v0.0.0-20190214182810-64f57863bf63 h1:AUyEEP9m1
github.com/uber/jaeger-client-go v0.0.0-20190214182810-64f57863bf63/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= github.com/uber/jaeger-client-go v0.0.0-20190214182810-64f57863bf63/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
github.com/uber/jaeger-client-go v2.16.0+incompatible h1:Q2Pp6v3QYiocMxomCaJuwQGFt7E53bPYqEgug/AoBtY= github.com/uber/jaeger-client-go v2.16.0+incompatible h1:Q2Pp6v3QYiocMxomCaJuwQGFt7E53bPYqEgug/AoBtY=
github.com/uber/jaeger-client-go v2.16.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= github.com/uber/jaeger-client-go v2.16.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
github.com/uber/jaeger-client-go v2.19.0+incompatible h1:pbwbYfHUoaase0oPQOdZ1GcaUjImYGimUXSQ/+8+Z8Q=
github.com/uber/jaeger-client-go v2.19.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
github.com/uber/jaeger-lib v0.0.0-20190122222657-d036253de8f5 h1:CwmGyzHTzCqCdZJkWR0A7ucZXgrCY7spRcpvm7ci//s= github.com/uber/jaeger-lib v0.0.0-20190122222657-d036253de8f5 h1:CwmGyzHTzCqCdZJkWR0A7ucZXgrCY7spRcpvm7ci//s=
github.com/uber/jaeger-lib v0.0.0-20190122222657-d036253de8f5/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= github.com/uber/jaeger-lib v0.0.0-20190122222657-d036253de8f5/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=

View File

@ -10,14 +10,17 @@ matrix:
- go: 1.12.x - go: 1.12.x
env: env:
- TESTS=true - TESTS=true
- USE_DEP=true
- COVERAGE=true - COVERAGE=true
- go: 1.12.x - go: 1.12.x
env: env:
- USE_DEP=true
- CROSSDOCK=true - CROSSDOCK=true
- go: 1.12.x - go: 1.12.x
env: env:
- TESTS=true - TESTS=true
- USE_DEP=true - USE_DEP=false
- USE_GLIDE=true
- go: 1.11.x - go: 1.11.x
env: env:
- TESTS=true - TESTS=true
@ -30,7 +33,6 @@ services:
env: env:
global: global:
- DOCKER_COMPOSE_VERSION=1.8.0 - DOCKER_COMPOSE_VERSION=1.8.0
- GO15VENDOREXPERIMENT=1
- COMMIT=${TRAVIS_COMMIT::8} - COMMIT=${TRAVIS_COMMIT::8}
# DOCKER_PASS # 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=" - 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=" - 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: install:
- make install-ci - make install-ci USE_DEP=$USE_DEP
- if [ "$CROSSDOCK" == true ]; then bash ./travis/install-crossdock-deps.sh ; fi - if [ "$CROSSDOCK" == true ]; then bash ./travis/install-crossdock-deps.sh ; fi
script: script:

View File

@ -1,6 +1,37 @@
Changes by Version 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) 2.16.0 (2019-03-24)
------------------- -------------------

View File

@ -19,7 +19,7 @@ file for details.
## Getting Started ## 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 To get started, make sure you clone the Git repository into the correct location
`github.com/uber/jaeger-client-go` relative to `$GOPATH`: `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 cd $GOPATH/src/github.com/uber
git clone git@github.com:jaegertracing/jaeger-client-go.git jaeger-client-go git clone git@github.com:jaegertracing/jaeger-client-go.git jaeger-client-go
cd jaeger-client-go cd jaeger-client-go
git submodule update --init --recursive
``` ```
Then install dependencies and run the tests: Then install dependencies and run the tests:
``` ```
git submodule update --init --recursive make install
glide install
make test make test
``` ```
@ -45,13 +45,13 @@ This projects follows the following pattern for grouping imports in Go files:
* imports from standard library * imports from standard library
* imports from other projects * imports from other projects
* imports from `jaeger-client-go` project * imports from `jaeger-client-go` project
For example: For example:
```go ```go
import ( import (
"fmt" "fmt"
"github.com/uber/jaeger-lib/metrics" "github.com/uber/jaeger-lib/metrics"
"go.uber.org/zap" "go.uber.org/zap"

View File

@ -2,12 +2,12 @@
[[projects]] [[projects]]
branch = "master"
digest = "1:d6afaeed1502aa28e80a4ed0981d570ad91b2579193404256ce672ed0a609e0d" digest = "1:d6afaeed1502aa28e80a4ed0981d570ad91b2579193404256ce672ed0a609e0d"
name = "github.com/beorn7/perks" name = "github.com/beorn7/perks"
packages = ["quantile"] packages = ["quantile"]
pruneopts = "UT" pruneopts = "UT"
revision = "3a771d992973f24aa725d07868b467d1ddfceafb" revision = "37c8de3658fcb183f997c4e13e8337516ab753e6"
version = "v1.0.1"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -38,12 +38,12 @@
version = "v1.1.1" version = "v1.1.1"
[[projects]] [[projects]]
digest = "1:318f1c959a8a740366fce4b1e1eb2fd914036b4af58fbd0a003349b305f118ad" digest = "1:573ca21d3669500ff845bdebee890eb7fc7f0f50c59f2132f2a0c6b03d85086a"
name = "github.com/golang/protobuf" name = "github.com/golang/protobuf"
packages = ["proto"] packages = ["proto"]
pruneopts = "UT" pruneopts = "UT"
revision = "b5d812f8a3706043e23a9cd5babf2e5423744d30" revision = "6c65a5562fc06764971b7c5d05c76c75e84bdbf7"
version = "v1.3.1" version = "v1.3.2"
[[projects]] [[projects]]
digest = "1:ff5ebae34cfbf047d505ee150de27e60570e8c394b3b8fdbb720ff6ac71985fc" digest = "1:ff5ebae34cfbf047d505ee150de27e60570e8c394b3b8fdbb720ff6ac71985fc"
@ -83,12 +83,15 @@
version = "v1.0.0" version = "v1.0.0"
[[projects]] [[projects]]
digest = "1:b6221ec0f8903b556e127c449e7106b63e6867170c2d10a7c058623d086f2081" digest = "1:7097829edd12fd7211fca0d29496b44f94ef9e6d72f88fb64f3d7b06315818ad"
name = "github.com/prometheus/client_golang" name = "github.com/prometheus/client_golang"
packages = ["prometheus"] packages = [
"prometheus",
"prometheus/internal",
]
pruneopts = "UT" pruneopts = "UT"
revision = "c5b7fccd204277076155f10851dad72b76a49317" revision = "170205fb58decfd011f1550d4cfb737230d7ae4f"
version = "v0.8.0" version = "v1.1.0"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -96,10 +99,10 @@
name = "github.com/prometheus/client_model" name = "github.com/prometheus/client_model"
packages = ["go"] packages = ["go"]
pruneopts = "UT" pruneopts = "UT"
revision = "fd36f4220a901265f90734c3183c5f0c91daa0b8" revision = "14fe0d1b01d4d5fc031dd4bec1823bd3ebbe8016"
[[projects]] [[projects]]
digest = "1:35cf6bdf68db765988baa9c4f10cc5d7dda1126a54bd62e252dbcd0b1fc8da90" digest = "1:f119e3205d3a1f0f19dbd7038eb37528e2c6f0933269dc344e305951fb87d632"
name = "github.com/prometheus/common" name = "github.com/prometheus/common"
packages = [ packages = [
"expfmt", "expfmt",
@ -107,25 +110,23 @@
"model", "model",
] ]
pruneopts = "UT" pruneopts = "UT"
revision = "cfeb6f9992ffa54aaa4f2170ade4067ee478b250" revision = "287d3e634a1e550c9e463dd7e5a75a422c614505"
version = "v0.2.0" version = "v0.7.0"
[[projects]] [[projects]]
branch = "master" digest = "1:a210815b437763623ecca8eb91e6a0bf4f2d6773c5a6c9aec0e28f19e5fd6deb"
digest = "1:c31163bd62461e0c5f7ddc7363e39ef8d9e929693e77b5c11c709b05f9cb9219"
name = "github.com/prometheus/procfs" name = "github.com/prometheus/procfs"
packages = [ packages = [
".", ".",
"internal/fs",
"internal/util", "internal/util",
"iostats",
"nfs",
"xfs",
] ]
pruneopts = "UT" pruneopts = "UT"
revision = "55ae3d9d557340b5bc24cd8aa5f6fa2c2ab31352" revision = "499c85531f756d1129edd26485a5f73871eeb308"
version = "v0.0.5"
[[projects]] [[projects]]
digest = "1:8ff03ccc603abb0d7cce94d34b613f5f6251a9e1931eba1a3f9888a9029b055c" digest = "1:0496f0e99014b7fd0a560c539f51d0882731137b85494142f47e550e4657176a"
name = "github.com/stretchr/testify" name = "github.com/stretchr/testify"
packages = [ packages = [
"assert", "assert",
@ -133,19 +134,19 @@
"suite", "suite",
] ]
pruneopts = "UT" pruneopts = "UT"
revision = "ffdc059bfe9ce6a4e144ba849dbedead332c6053" revision = "221dbe5ed46703ee255b1da0dec05086f5035f62"
version = "v1.3.0" version = "v1.4.0"
[[projects]] [[projects]]
digest = "1:3c1a69cdae3501bf75e76d0d86dc6f2b0a7421bc205c0cb7b96b19eed464a34d" digest = "1:a5158647b553c61877aa9ae74f4015000294e47981e6b8b07525edcbb0747c81"
name = "github.com/uber-go/atomic" name = "github.com/uber-go/atomic"
packages = ["."] packages = ["."]
pruneopts = "UT" pruneopts = "UT"
revision = "1ea20fb1cbb1cc08cbd0d913a96dead89aa18289" revision = "df976f2515e274675050de7b3f42545de80594fd"
version = "v1.3.2" version = "v1.4.0"
[[projects]] [[projects]]
digest = "1:f5c5ad1e08141e18aee1b9c37729d93d06805840421ccfc9d407787ffe969ce6" digest = "1:0ec60ffd594af00ba1660bc746aa0e443d27dd4003dee55f9d08a0b4ff5431a3"
name = "github.com/uber/jaeger-lib" name = "github.com/uber/jaeger-lib"
packages = [ packages = [
"metrics", "metrics",
@ -153,16 +154,16 @@
"metrics/prometheus", "metrics/prometheus",
] ]
pruneopts = "UT" pruneopts = "UT"
revision = "0e30338a695636fe5bcf7301e8030ce8dd2a8530" revision = "a87ae9d84fb038a8d79266298970720be7c80fcd"
version = "v2.0.0" version = "v2.2.0"
[[projects]] [[projects]]
digest = "1:3c1a69cdae3501bf75e76d0d86dc6f2b0a7421bc205c0cb7b96b19eed464a34d" digest = "1:a5158647b553c61877aa9ae74f4015000294e47981e6b8b07525edcbb0747c81"
name = "go.uber.org/atomic" name = "go.uber.org/atomic"
packages = ["."] packages = ["."]
pruneopts = "UT" pruneopts = "UT"
revision = "1ea20fb1cbb1cc08cbd0d913a96dead89aa18289" revision = "df976f2515e274675050de7b3f42545de80594fd"
version = "v1.3.2" version = "v1.4.0"
[[projects]] [[projects]]
digest = "1:60bf2a5e347af463c42ed31a493d817f8a72f102543060ed992754e689805d1a" digest = "1:60bf2a5e347af463c42ed31a493d817f8a72f102543060ed992754e689805d1a"
@ -173,7 +174,7 @@
version = "v1.1.0" version = "v1.1.0"
[[projects]] [[projects]]
digest = "1:c52caf7bd44f92e54627a31b85baf06a68333a196b3d8d241480a774733dcf8b" digest = "1:676160e6a4722b08e0e26b11521d575c2cb2b6f0c679e1ee6178c5d8dee51e5e"
name = "go.uber.org/zap" name = "go.uber.org/zap"
packages = [ packages = [
".", ".",
@ -184,8 +185,8 @@
"zapcore", "zapcore",
] ]
pruneopts = "UT" pruneopts = "UT"
revision = "ff33455a0e382e8a81d14dd7c922020b6b5e7982" revision = "27376062155ad36be76b0f12cf1572a221d3a48c"
version = "v1.9.1" version = "v1.10.0"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -196,7 +197,23 @@
"context/ctxhttp", "context/ctxhttp",
] ]
pruneopts = "UT" 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] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"

View File

@ -8,7 +8,7 @@
[[constraint]] [[constraint]]
name = "github.com/prometheus/client_golang" name = "github.com/prometheus/client_golang"
version = "0.8.0" version = "^1"
[[constraint]] [[constraint]]
name = "github.com/stretchr/testify" name = "github.com/stretchr/testify"
@ -20,7 +20,7 @@
[[constraint]] [[constraint]]
name = "github.com/uber/jaeger-lib" name = "github.com/uber/jaeger-lib"
version = "^2.0" version = "^2.2"
[[constraint]] [[constraint]]
name = "go.uber.org/zap" name = "go.uber.org/zap"

View File

@ -1,14 +1,14 @@
PROJECT_ROOT=github.com/uber/jaeger-client-go 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 .go files that don't exist in hidden directories
ALL_SRC := $(shell find . -name "*.go" | grep -v -e vendor -e thrift-gen -e ./thrift/ \ ALL_SRC := $(shell find . -name "*.go" | grep -v -e vendor -e thrift-gen -e ./thrift/ \
-e ".*/\..*" \ -e ".*/\..*" \
-e ".*/_.*" \ -e ".*/_.*" \
-e ".*/mocks.*") -e ".*/mocks.*")
-include crossdock/rules.mk USE_DEP := true
export GO15VENDOREXPERIMENT=1 -include crossdock/rules.mk
RACE=-race RACE=-race
GOTEST=go test -v $(RACE) GOTEST=go test -v $(RACE)
@ -58,19 +58,24 @@ lint:
.PHONY: install .PHONY: install
install: install:
glide --version || go get github.com/Masterminds/glide @echo install: USE_DEP=$(USE_DEP) USE_GLIDE=$(USE_GLIDE)
ifeq ($(USE_DEP),true) ifeq ($(USE_DEP),true)
dep version || make install-dep
dep ensure dep ensure
else endif
ifeq ($(USE_GLIDE),true)
glide --version || go get github.com/Masterminds/glide
glide install glide install
endif endif
.PHONY: cover .PHONY: cover
cover: cover:
./scripts/cover.sh $(shell go list $(PACKAGES)) $(GOTEST) -cover -coverprofile cover.out $(PACKAGES)
go tool cover -html=cover.out -o cover.html
.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 # This is not part of the regular test target because we don't want to slow it
# down. # down.
@ -101,21 +106,20 @@ idl-submodule:
thrift-image: thrift-image:
$(THRIFT) -version $(THRIFT) -version
.PHONY: install-dep-ci .PHONY: install-dep
install-dep-ci: install-dep:
- curl -L -s https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 -o $$GOPATH/bin/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 - chmod +x $$GOPATH/bin/dep
.PHONY: install-ci .PHONY: install-ci
install-ci: install-dep-ci install install-ci: install
go get github.com/wadey/gocovmerge go get github.com/wadey/gocovmerge
go get github.com/mattn/goveralls go get github.com/mattn/goveralls
go get golang.org/x/tools/cmd/cover go get golang.org/x/tools/cmd/cover
go get golang.org/x/lint/golint go get golang.org/x/lint/golint
.PHONY: test-ci .PHONY: test-ci
test-ci: test-ci: cover
@./scripts/cover.sh $(shell go list $(PACKAGES))
ifeq ($(CI_SKIP_LINT),true) ifeq ($(CI_SKIP_LINT),true)
echo 'skipping lint' echo 'skipping lint'
else else

View File

@ -3,7 +3,7 @@
# Jaeger Bindings for Go OpenTracing API # Jaeger Bindings for Go OpenTracing API
Instrumentation library that implements an 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. **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"` * :white_check_mark: `import "github.com/uber/jaeger-client-go"`
@ -15,19 +15,20 @@ Please see [CONTRIBUTING.md](CONTRIBUTING.md).
## Installation ## 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. and [semantic versioning](http://semver.org/) when including this library into an application.
For example, Jaeger backend imports this library like this: For example, Jaeger backend imports this library like this:
```yaml ```toml
- package: github.com/uber/jaeger-client-go [[constraint]]
version: ^2.7.0 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`. 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 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 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 ```shell
go get -u github.com/uber/jaeger-client-go/ go get -u github.com/uber/jaeger-client-go/
@ -222,7 +223,7 @@ import (
) )
span := opentracing.SpanFromContext(ctx) span := opentracing.SpanFromContext(ctx)
ext.SamplingPriority.Set(span, 1) ext.SamplingPriority.Set(span, 1)
``` ```
#### Via HTTP Headers #### 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. 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 ## License
[Apache 2.0 License](LICENSE). [Apache 2.0 License](LICENSE).

View File

@ -181,13 +181,14 @@ func (c Configuration) New(
// NewTracer returns a new tracer based on the current configuration, using the given options, // 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. // and a closer func that can be used to flush buffers before shutdown.
func (c Configuration) NewTracer(options ...Option) (opentracing.Tracer, io.Closer, error) { func (c Configuration) NewTracer(options ...Option) (opentracing.Tracer, io.Closer, error) {
if c.Disabled {
return &opentracing.NoopTracer{}, &nullCloser{}, nil
}
if c.ServiceName == "" { if c.ServiceName == "" {
return nil, nil, errors.New("no service name provided") return nil, nil, errors.New("no service name provided")
} }
if c.Disabled {
return &opentracing.NoopTracer{}, &nullCloser{}, nil
}
opts := applyOptions(options...) opts := applyOptions(options...)
tracerMetrics := jaeger.NewMetrics(opts.metrics, nil) tracerMetrics := jaeger.NewMetrics(opts.metrics, nil)
if c.RPCMetrics { if c.RPCMetrics {
@ -234,6 +235,7 @@ func (c Configuration) NewTracer(options ...Option) (opentracing.Tracer, io.Clos
jaeger.TracerOptions.PoolSpans(opts.poolSpans), jaeger.TracerOptions.PoolSpans(opts.poolSpans),
jaeger.TracerOptions.ZipkinSharedRPCSpan(opts.zipkinSharedRPCSpan), jaeger.TracerOptions.ZipkinSharedRPCSpan(opts.zipkinSharedRPCSpan),
jaeger.TracerOptions.MaxTagValueLength(opts.maxTagValueLength), jaeger.TracerOptions.MaxTagValueLength(opts.maxTagValueLength),
jaeger.TracerOptions.NoDebugFlagOnForcedSampling(opts.noDebugFlagOnForcedSampling),
} }
for _, tag := range opts.tags { for _, tag := range opts.tags {

View File

@ -110,6 +110,9 @@ func samplerConfigFromEnv() (*SamplerConfig, error) {
if e := os.Getenv(envSamplerManagerHostPort); e != "" { if e := os.Getenv(envSamplerManagerHostPort); e != "" {
sc.SamplingServerURL = 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 != "" { if e := os.Getenv(envSamplerMaxOperations); e != "" {

View File

@ -26,19 +26,20 @@ type Option func(c *Options)
// Options control behavior of the client. // Options control behavior of the client.
type Options struct { type Options struct {
metrics metrics.Factory metrics metrics.Factory
logger jaeger.Logger logger jaeger.Logger
reporter jaeger.Reporter reporter jaeger.Reporter
sampler jaeger.Sampler sampler jaeger.Sampler
contribObservers []jaeger.ContribObserver contribObservers []jaeger.ContribObserver
observers []jaeger.Observer observers []jaeger.Observer
gen128Bit bool gen128Bit bool
poolSpans bool poolSpans bool
zipkinSharedRPCSpan bool zipkinSharedRPCSpan bool
maxTagValueLength int maxTagValueLength int
tags []opentracing.Tag noDebugFlagOnForcedSampling bool
injectors map[interface{}]jaeger.Injector tags []opentracing.Tag
extractors map[interface{}]jaeger.Extractor injectors map[interface{}]jaeger.Injector
extractors map[interface{}]jaeger.Extractor
} }
// Metrics creates an Option that initializes Metrics in the tracer, // 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. // Tag creates an option that adds a tracer-level tag.
func Tag(key string, value interface{}) Option { func Tag(key string, value interface{}) Option {
return func(c *Options) { return func(c *Options) {

View File

@ -14,9 +14,15 @@
package jaeger package jaeger
import (
"fmt"
"github.com/opentracing/opentracing-go"
)
const ( const (
// JaegerClientVersion is the version of the client library reported as Span tag. // 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 is the name of the tag used to report client version.
JaegerClientVersionTagKey = "jaeger.version" JaegerClientVersionTagKey = "jaeger.version"
@ -83,6 +89,18 @@ const (
// DefaultUDPSpanServerPort is the default port to send the spans to, via UDP // DefaultUDPSpanServerPort is the default port to send the spans to, via UDP
DefaultUDPSpanServerPort = 6831 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 is the default max length of byte array or string allowed in the tag value.
DefaultMaxTagValueLength = 256 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)
) )

View File

@ -22,8 +22,9 @@ import (
) )
const ( const (
flagSampled = byte(1) flagSampled = byte(1)
flagDebug = byte(2) flagDebug = byte(2)
flagFirehose = byte(8)
) )
var ( var (
@ -88,6 +89,11 @@ func (c SpanContext) IsDebug() bool {
return (c.flags & flagDebug) == flagDebug 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. // IsValid indicates whether this context actually represents a valid trace.
func (c SpanContext) IsValid() bool { func (c SpanContext) IsValid() bool {
return c.traceID.IsValid() && c.spanID != 0 return c.traceID.IsValid() && c.spanID != 0

View File

@ -1,8 +1,8 @@
hash: 92cc8f956428fc65bee07d809a752f34376aece141c934eff02aefa08d450b72 hash: a4a449cfc060c2d7be850a69b171e4382a3bd00d1a0a72cfc944facc3fe263bf
updated: 2019-03-23T18:26:09.960887-04:00 updated: 2019-09-23T17:10:15.213856-04:00
imports: imports:
- name: github.com/beorn7/perks - name: github.com/beorn7/perks
version: 3a771d992973f24aa725d07868b467d1ddfceafb version: 37c8de3658fcb183f997c4e13e8337516ab753e6
subpackages: subpackages:
- quantile - quantile
- name: github.com/codahale/hdrhistogram - name: github.com/codahale/hdrhistogram
@ -17,11 +17,11 @@ imports:
subpackages: subpackages:
- spew - spew
- name: github.com/golang/protobuf - name: github.com/golang/protobuf
version: bbd03ef6da3a115852eaf24c8a1c46aeb39aa175 version: 1680a479a2cfb3fa22b972af7e36d0a0fde47bf8
subpackages: subpackages:
- proto - proto
- name: github.com/matttproud/golang_protobuf_extensions - name: github.com/matttproud/golang_protobuf_extensions
version: c12348ce28de40eed0136aa2b644d0ee0650e56c version: c182affec369e30f25d3eb8cd8a478dee585ae7d
subpackages: subpackages:
- pbutil - pbutil
- name: github.com/opentracing/opentracing-go - name: github.com/opentracing/opentracing-go
@ -33,47 +33,49 @@ imports:
- name: github.com/pkg/errors - name: github.com/pkg/errors
version: ba968bfe8b2f7e042a574c888954fccecfa385b4 version: ba968bfe8b2f7e042a574c888954fccecfa385b4
- name: github.com/pmezard/go-difflib - name: github.com/pmezard/go-difflib
version: 792786c7400a136282c1664665ae0a8db921c6c2 version: 5d4384ee4fb2527b0a1256a821ebfc92f91efefc
subpackages: subpackages:
- difflib - difflib
- name: github.com/prometheus/client_golang - name: github.com/prometheus/client_golang
version: c5b7fccd204277076155f10851dad72b76a49317 version: 170205fb58decfd011f1550d4cfb737230d7ae4f
subpackages: subpackages:
- prometheus - prometheus
- prometheus/internal
- name: github.com/prometheus/client_model - name: github.com/prometheus/client_model
version: 99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c version: 14fe0d1b01d4d5fc031dd4bec1823bd3ebbe8016
subpackages: subpackages:
- go - go
- name: github.com/prometheus/common - name: github.com/prometheus/common
version: 38c53a9f4bfcd932d1b00bfc65e256a7fba6b37a version: 287d3e634a1e550c9e463dd7e5a75a422c614505
subpackages: subpackages:
- expfmt - expfmt
- internal/bitbucket.org/ww/goautoneg - internal/bitbucket.org/ww/goautoneg
- model - model
- name: github.com/prometheus/procfs - name: github.com/prometheus/procfs
version: 780932d4fbbe0e69b84c34c20f5c8d0981e109ea version: de25ac347ef9305868b04dc42425c973b863b18c
subpackages: subpackages:
- internal/fs
- internal/util - internal/util
- nfs
- xfs
- name: github.com/stretchr/testify - name: github.com/stretchr/testify
version: f35b8ab0b5a2cef36673838d662e249dd9c94686 version: 85f2b59c4459e5bf57488796be8c3667cb8246d6
subpackages: subpackages:
- assert - assert
- require - require
- suite - suite
- name: github.com/uber-go/atomic
version: df976f2515e274675050de7b3f42545de80594fd
- name: github.com/uber/jaeger-lib - name: github.com/uber/jaeger-lib
version: 0e30338a695636fe5bcf7301e8030ce8dd2a8530 version: a87ae9d84fb038a8d79266298970720be7c80fcd
subpackages: subpackages:
- metrics - metrics
- metrics/metricstest - metrics/metricstest
- metrics/prometheus - metrics/prometheus
- name: go.uber.org/atomic - name: go.uber.org/atomic
version: 1ea20fb1cbb1cc08cbd0d913a96dead89aa18289 version: df976f2515e274675050de7b3f42545de80594fd
- name: go.uber.org/multierr - name: go.uber.org/multierr
version: 3c4937480c32f4c13a875a1829af76c98ca3d40a version: 3c4937480c32f4c13a875a1829af76c98ca3d40a
- name: go.uber.org/zap - name: go.uber.org/zap
version: ff33455a0e382e8a81d14dd7c922020b6b5e7982 version: 27376062155ad36be76b0f12cf1572a221d3a48c
subpackages: subpackages:
- buffer - buffer
- internal/bufferpool - internal/bufferpool
@ -81,10 +83,14 @@ imports:
- internal/exit - internal/exit
- zapcore - zapcore
- name: golang.org/x/net - name: golang.org/x/net
version: 49bb7cea24b1df9410e1712aa6433dae904ff66a version: aa69164e4478b84860dc6769c710c699c67058a3
subpackages: subpackages:
- context - context
- context/ctxhttp - context/ctxhttp
testImports: - name: golang.org/x/sys
- name: github.com/uber-go/atomic version: 0a153f010e6963173baba2306531d173aa843137
version: 8474b86a5a6f79c443ce4b2992817ff32cf208b8 subpackages:
- windows
- name: gopkg.in/yaml.v2
version: 51d6538a90f86fe93ac480b35f37b2be17fef232
testImports: []

View File

@ -12,11 +12,16 @@ import:
- metrics - metrics
- package: github.com/pkg/errors - package: github.com/pkg/errors
version: ~0.8.0 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: testImport:
- package: github.com/stretchr/testify - package: github.com/stretchr/testify
subpackages: subpackages:
- assert - assert
- require - require
- suite - suite
- package: github.com/prometheus/client_golang
version: v0.8.0

View File

@ -93,13 +93,14 @@ func NewInMemoryReporter() *InMemoryReporter {
// Report implements Report() method of Reporter by storing the span in the buffer. // Report implements Report() method of Reporter by storing the span in the buffer.
func (r *InMemoryReporter) Report(span *Span) { func (r *InMemoryReporter) Report(span *Span) {
r.lock.Lock() 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() r.lock.Unlock()
} }
// Close implements Close() method of Reporter by doing nothing. // Close implements Close() method of Reporter
func (r *InMemoryReporter) Close() { func (r *InMemoryReporter) Close() {
// no-op r.Reset()
} }
// SpansSubmitted returns the number of spans accumulated in the buffer. // SpansSubmitted returns the number of spans accumulated in the buffer.
@ -122,7 +123,12 @@ func (r *InMemoryReporter) GetSpans() []opentracing.Span {
func (r *InMemoryReporter) Reset() { func (r *InMemoryReporter) Reset() {
r.lock.Lock() r.lock.Lock()
defer r.lock.Unlock() 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. // because some of them may still be successfully added to the queue.
func (r *remoteReporter) Report(span *Span) { func (r *remoteReporter) Report(span *Span) {
select { 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) atomic.AddInt64(&r.queueLength, 1)
default: default:
r.metrics.ReporterDropped.Inc(1) 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 // to reduce the number of gauge stats, we only emit queue length on flush
r.metrics.ReporterQueueLength.Update(atomic.LoadInt64(&r.queueLength)) r.metrics.ReporterQueueLength.Update(atomic.LoadInt64(&r.queueLength))
} }
span.Release()
case reporterQueueItemClose: case reporterQueueItemClose:
timer.Stop() timer.Stop()
flush() flush()

View File

@ -28,7 +28,6 @@ import (
) )
const ( const (
defaultSamplingServerURL = "http://localhost:5778/sampling"
defaultSamplingRefreshInterval = time.Minute defaultSamplingRefreshInterval = time.Minute
defaultMaxOperations = 2000 defaultMaxOperations = 2000
) )
@ -348,24 +347,27 @@ func (s *adaptiveSampler) Equal(other Sampler) bool {
func (s *adaptiveSampler) update(strategies *sampling.PerOperationSamplingStrategies) { func (s *adaptiveSampler) update(strategies *sampling.PerOperationSamplingStrategies) {
s.Lock() s.Lock()
defer s.Unlock() defer s.Unlock()
newSamplers := map[string]*GuaranteedThroughputProbabilisticSampler{}
for _, strategy := range strategies.PerOperationStrategies { for _, strategy := range strategies.PerOperationStrategies {
operation := strategy.Operation operation := strategy.Operation
samplingRate := strategy.ProbabilisticSampling.SamplingRate samplingRate := strategy.ProbabilisticSampling.SamplingRate
lowerBound := strategies.DefaultLowerBoundTracesPerSecond lowerBound := strategies.DefaultLowerBoundTracesPerSecond
if sampler, ok := s.samplers[operation]; ok { if sampler, ok := s.samplers[operation]; ok {
sampler.update(lowerBound, samplingRate) sampler.update(lowerBound, samplingRate)
newSamplers[operation] = sampler
} else { } else {
sampler := newGuaranteedThroughputProbabilisticSampler( sampler := newGuaranteedThroughputProbabilisticSampler(
lowerBound, lowerBound,
samplingRate, samplingRate,
) )
s.samplers[operation] = sampler newSamplers[operation] = sampler
} }
} }
s.lowerBound = strategies.DefaultLowerBoundTracesPerSecond s.lowerBound = strategies.DefaultLowerBoundTracesPerSecond
if s.defaultSampler.SamplingRate() != strategies.DefaultSamplingProbability { if s.defaultSampler.SamplingRate() != strategies.DefaultSamplingProbability {
s.defaultSampler = newProbabilisticSampler(strategies.DefaultSamplingProbability) s.defaultSampler = newProbabilisticSampler(strategies.DefaultSamplingProbability)
} }
s.samplers = newSamplers
} }
// ----------------------- // -----------------------
@ -432,7 +434,7 @@ func applySamplerOptions(opts ...SamplerOption) samplerOptions {
options.maxOperations = defaultMaxOperations options.maxOperations = defaultMaxOperations
} }
if options.samplingServerURL == "" { if options.samplingServerURL == "" {
options.samplingServerURL = defaultSamplingServerURL options.samplingServerURL = DefaultSamplingServerURL
} }
if options.metrics == nil { if options.metrics == nil {
options.metrics = NewNullMetrics() options.metrics = NewNullMetrics()

View File

@ -16,6 +16,7 @@ package jaeger
import ( import (
"sync" "sync"
"sync/atomic"
"time" "time"
"github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go"
@ -25,6 +26,10 @@ import (
// Span implements opentracing.Span // Span implements opentracing.Span
type Span struct { type Span struct {
// referenceCounter used to increase the lifetime of
// the object before return it into the pool.
referenceCounter int32
sync.RWMutex sync.RWMutex
tracer *Tracer tracer *Tracer
@ -91,6 +96,38 @@ func (s *Span) SetTag(key string, value interface{}) opentracing.Span {
return s 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{}) { func (s *Span) setTagNoLocking(key string, value interface{}) {
s.tags = append(s.tags, Tag{key: key, value: value}) 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 // 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() { func (s *Span) Finish() {
s.FinishWithOptions(opentracing.FinishOptions{}) s.FinishWithOptions(opentracing.FinishOptions{})
} }
@ -197,6 +236,7 @@ func (s *Span) FinishWithOptions(options opentracing.FinishOptions) {
} }
s.Unlock() s.Unlock()
// call reportSpan even for non-sampled traces, to return span to the pool // call reportSpan even for non-sampled traces, to return span to the pool
// and update metrics counter
s.tracer.reportSpan(s) s.tracer.reportSpan(s)
} }
@ -225,25 +265,66 @@ func (s *Span) OperationName() string {
return s.operationName 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 { func (s *Span) serviceName() string {
return s.tracer.serviceName return s.tracer.serviceName
} }
// setSamplingPriority returns true if the flag was updated successfully, false otherwise. // setSamplingPriority returns true if the flag was updated successfully, false otherwise.
func setSamplingPriority(s *Span, value interface{}) bool { func setSamplingPriority(s *Span, value interface{}) bool {
s.Lock()
defer s.Unlock()
val, ok := value.(uint16) val, ok := value.(uint16)
if !ok { if !ok {
return false return false
} }
s.Lock()
defer s.Unlock()
if val == 0 { if val == 0 {
s.context.flags = s.context.flags & (^flagSampled) s.context.flags = s.context.flags & (^flagSampled)
return true 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 s.context.flags = s.context.flags | flagDebug | flagSampled
return true return true
} }
return false return false
} }
// EnableFirehose enables firehose flag on the span context
func EnableFirehose(s *Span) {
s.Lock()
defer s.Unlock()
s.context.flags |= flagFirehose
}

View File

@ -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()
}

View File

@ -47,15 +47,15 @@ type Tracer struct {
randomNumber func() uint64 randomNumber func() uint64
options struct { options struct {
poolSpans bool gen128Bit bool // whether to generate 128bit trace IDs
gen128Bit bool // whether to generate 128bit trace IDs zipkinSharedRPCSpan bool
zipkinSharedRPCSpan bool highTraceIDGenerator func() uint64 // custom high trace ID generator
highTraceIDGenerator func() uint64 // custom high trace ID generator maxTagValueLength int
maxTagValueLength int noDebugFlagOnForcedSampling bool
// more options to come // more options to come
} }
// pool for Span objects // allocator of Span objects
spanPool sync.Pool spanAllocator SpanAllocator
injectors map[interface{}]Injector injectors map[interface{}]Injector
extractors map[interface{}]Extractor extractors map[interface{}]Extractor
@ -81,15 +81,13 @@ func NewTracer(
options ...TracerOption, options ...TracerOption,
) (opentracing.Tracer, io.Closer) { ) (opentracing.Tracer, io.Closer) {
t := &Tracer{ t := &Tracer{
serviceName: serviceName, serviceName: serviceName,
sampler: sampler, sampler: sampler,
reporter: reporter, reporter: reporter,
injectors: make(map[interface{}]Injector), injectors: make(map[interface{}]Injector),
extractors: make(map[interface{}]Extractor), extractors: make(map[interface{}]Extractor),
metrics: *NewNullMetrics(), metrics: *NewNullMetrics(),
spanPool: sync.Pool{New: func() interface{} { spanAllocator: simpleSpanAllocator{},
return &Span{}
}},
} }
for _, option := range options { for _, option := range options {
@ -148,7 +146,15 @@ func NewTracer(
if hostname, err := os.Hostname(); err == nil { if hostname, err := os.Hostname(); err == nil {
t.tags = append(t.tags, Tag{key: TracerHostnameTagKey, value: hostname}) 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.tags = append(t.tags, Tag{key: TracerIPTagKey, value: ip.String()})
t.hostIPv4 = utils.PackIPAsUint32(ip) t.hostIPv4 = utils.PackIPAsUint32(ip)
} else { } else {
@ -217,20 +223,30 @@ func (t *Tracer) startSpanWithOptions(
var references []Reference var references []Reference
var parent SpanContext var parent SpanContext
var hasParent bool // need this because `parent` is a value, not reference var hasParent bool // need this because `parent` is a value, not reference
var ctx SpanContext
var isSelfRef bool
for _, ref := range options.References { for _, ref := range options.References {
ctx, ok := ref.ReferencedContext.(SpanContext) ctxRef, ok := ref.ReferencedContext.(SpanContext)
if !ok { if !ok {
t.logger.Error(fmt.Sprintf( t.logger.Error(fmt.Sprintf(
"Reference contains invalid type of SpanReference: %s", "Reference contains invalid type of SpanReference: %s",
reflect.ValueOf(ref.ReferencedContext))) reflect.ValueOf(ref.ReferencedContext)))
continue continue
} }
if !isValidReference(ctx) { if !isValidReference(ctxRef) {
continue continue
} }
references = append(references, Reference{Type: ref.Type, Context: ctx})
if ref.Type == selfRefType {
isSelfRef = true
ctx = ctxRef
continue
}
references = append(references, Reference{Type: ref.Type, Context: ctxRef})
if !hasParent { if !hasParent {
parent = ctx parent = ctxRef
hasParent = ref.Type == opentracing.ChildOfRef hasParent = ref.Type == opentracing.ChildOfRef
} }
} }
@ -246,42 +262,43 @@ func (t *Tracer) startSpanWithOptions(
} }
var samplerTags []Tag var samplerTags []Tag
var ctx SpanContext
newTrace := false newTrace := false
if !hasParent || !parent.IsValid() { if !isSelfRef {
newTrace = true if !hasParent || !parent.IsValid() {
ctx.traceID.Low = t.randomID() newTrace = true
if t.options.gen128Bit { ctx.traceID.Low = t.randomID()
ctx.traceID.High = t.options.highTraceIDGenerator() if t.options.gen128Bit {
} ctx.traceID.High = t.options.highTraceIDGenerator()
ctx.spanID = SpanID(ctx.traceID.Low) }
ctx.parentID = 0 ctx.spanID = SpanID(ctx.traceID.Low)
ctx.flags = byte(0) ctx.parentID = 0
if hasParent && parent.isDebugIDContainerOnly() && t.isDebugAllowed(operationName) { ctx.flags = byte(0)
ctx.flags |= (flagSampled | flagDebug) if hasParent && parent.isDebugIDContainerOnly() && t.isDebugAllowed(operationName) {
samplerTags = []Tag{{key: JaegerDebugHeader, value: parent.debugID}} ctx.flags |= (flagSampled | flagDebug)
} else if sampled, tags := t.sampler.IsSampled(ctx.traceID, operationName); sampled { samplerTags = []Tag{{key: JaegerDebugHeader, value: parent.debugID}}
ctx.flags |= flagSampled } else if sampled, tags := t.sampler.IsSampled(ctx.traceID, operationName); sampled {
samplerTags = tags 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
} else { } else {
ctx.spanID = SpanID(t.randomID()) ctx.traceID = parent.traceID
ctx.parentID = parent.spanID 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 hasParent { if l := len(parent.baggage); l > 0 {
// copy baggage items ctx.baggage = make(map[string]string, len(parent.baggage))
if l := len(parent.baggage); l > 0 { for k, v := range parent.baggage {
ctx.baggage = make(map[string]string, len(parent.baggage)) ctx.baggage[k] = v
for k, v := range parent.baggage { }
ctx.baggage[k] = v
} }
} }
} }
@ -350,18 +367,20 @@ func (t *Tracer) Tags() []opentracing.Tag {
return tags 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. // newSpan returns an instance of a clean Span object.
// If options.PoolSpans is true, the spans are retrieved from an object pool. // If options.PoolSpans is true, the spans are retrieved from an object pool.
func (t *Tracer) newSpan() *Span { func (t *Tracer) newSpan() *Span {
if !t.options.poolSpans { return t.spanAllocator.Get()
return &Span{}
}
sp := t.spanPool.Get().(*Span)
sp.context = emptyContext
sp.tracer = nil
sp.tags = nil
sp.logs = nil
return sp
} }
func (t *Tracer) startSpanInternal( func (t *Tracer) startSpanInternal(
@ -416,12 +435,15 @@ func (t *Tracer) startSpanInternal(
func (t *Tracer) reportSpan(sp *Span) { func (t *Tracer) reportSpan(sp *Span) {
t.metrics.SpansFinished.Inc(1) 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() { if sp.context.IsSampled() {
t.reporter.Report(sp) 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. // 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 { func (t *Tracer) isDebugAllowed(operation string) bool {
return t.debugThrottler.IsAllowed(operation) 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,
}
}

View File

@ -81,7 +81,11 @@ func (tracerOptions) RandomNumber(randomNumber func() uint64) TracerOption {
// that can access parent spans after those spans have been finished. // that can access parent spans after those spans have been finished.
func (tracerOptions) PoolSpans(poolSpans bool) TracerOption { func (tracerOptions) PoolSpans(poolSpans bool) TracerOption {
return func(tracer *Tracer) { 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 { func (tracerOptions) HighTraceIDGenerator(highTraceIDGenerator func() uint64) TracerOption {
return func(tracer *Tracer) { return func(tracer *Tracer) {
tracer.options.highTraceIDGenerator = highTraceIDGenerator tracer.options.highTraceIDGenerator = highTraceIDGenerator

2
vendor/modules.txt vendored
View File

@ -433,7 +433,7 @@ github.com/stretchr/testify/require
github.com/syndtr/gocapability/capability github.com/syndtr/gocapability/capability
# github.com/tchap/go-patricia v2.3.0+incompatible # github.com/tchap/go-patricia v2.3.0+incompatible
github.com/tchap/go-patricia/patricia github.com/tchap/go-patricia/patricia
# github.com/uber/jaeger-client-go v2.16.0+incompatible # github.com/uber/jaeger-client-go v2.19.0+incompatible
github.com/uber/jaeger-client-go github.com/uber/jaeger-client-go
github.com/uber/jaeger-client-go/config github.com/uber/jaeger-client-go/config
github.com/uber/jaeger-client-go/internal/baggage github.com/uber/jaeger-client-go/internal/baggage