diff --git a/Makefile b/Makefile index 4588285a8..6b523e6d9 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ TEST_TIMEOUT := 3m TEST_ARG ?= -race -v -timeout $(TEST_TIMEOUT) INTEG_TEST_ROOT := ./test -COVER_ROOT := $(BUILD)/coverage +COVER_ROOT := $(abspath $(BUILD)/coverage) UT_COVER_FILE := $(COVER_ROOT)/unit_test_cover.out INTEG_ZERO_CACHE_COVER_FILE := $(COVER_ROOT)/integ_test_zero_cache_cover.out INTEG_NORMAL_CACHE_COVER_FILE := $(COVER_ROOT)/integ_test_normal_cache_cover.out @@ -18,12 +18,10 @@ INTEG_NORMAL_CACHE_COVER_FILE := $(COVER_ROOT)/integ_test_normal_cache_cover.out # Automatically gather all srcs ALL_SRC := $(shell find . -name "*.go") +MOD_DIRS := $(sort $(dir $(shell find . -name go.mod))) UT_DIRS := $(filter-out $(INTEG_TEST_ROOT)%, $(sort $(dir $(filter %_test.go,$(ALL_SRC))))) INTEG_TEST_DIRS := $(sort $(dir $(shell find $(INTEG_TEST_ROOT) -name *_test.go))) -# Files that needs to run lint. Excludes testify mocks. -LINT_SRC := $(filter-out ./mocks/%,$(ALL_SRC)) - # `make copyright` or depend on "copyright" to force-run licensegen, # or depend on $(BUILD)/copyright to let it run as needed. copyright $(BUILD)/copyright: @@ -41,20 +39,20 @@ unit-test: $(BUILD)/dummy @echo "mode: atomic" > $(UT_COVER_FILE) @for dir in $(UT_DIRS); do \ mkdir -p $(COVER_ROOT)/"$$dir"; \ - go test "$$dir" $(TEST_ARG) -coverprofile=$(COVER_ROOT)/"$$dir"/cover.out || exit 1; \ + (cd "$$dir" && go test . $(TEST_ARG) -coverprofile=$(COVER_ROOT)/"$$dir"/cover.out) || exit 1; \ cat $(COVER_ROOT)/"$$dir"/cover.out | grep -v "mode: atomic" >> $(UT_COVER_FILE); \ done; integration-test-zero-cache: $(BUILD)/dummy @mkdir -p $(COVER_ROOT) @for dir in $(INTEG_TEST_DIRS); do \ - WORKFLOW_CACHE_SIZE=0 go test $(TEST_ARG) "$$dir" -coverprofile=$(INTEG_ZERO_CACHE_COVER_FILE) -coverpkg=./... || exit 1; \ + (cd "$$dir" &&WORKFLOW_CACHE_SIZE=0 go test $(TEST_ARG) . -coverprofile=$(INTEG_ZERO_CACHE_COVER_FILE) -coverpkg=./...) || exit 1; \ done; integration-test-normal-cache: $(BUILD)/dummy @mkdir -p $(COVER_ROOT) @for dir in $(INTEG_TEST_DIRS); do \ - go test $(TEST_ARG) "$$dir" -coverprofile=$(INTEG_NORMAL_CACHE_COVER_FILE) -coverpkg=./... || exit 1; \ + (cd "$$dir" && go test $(TEST_ARG) . -coverprofile=$(INTEG_NORMAL_CACHE_COVER_FILE) -coverpkg=./...) || exit 1; \ done; test: unit-test integration-test-zero-cache integration-test-normal-cache @@ -71,43 +69,22 @@ cover: $(COVER_ROOT)/cover.out cover_ci: $(COVER_ROOT)/cover.out goveralls -coverprofile=$(COVER_ROOT)/cover.out -service=buildkite || echo -e "\x1b[31mCoveralls failed\x1b[m"; -# golint fails to report many lint failures if it is only given a single file -# to work on at a time, and it can't handle multiple packages at once, *and* -# we can't exclude files from its checks, so for best results we need to give -# it a whitelist of every file in every package that we want linted, per package. -# -# so lint + this golint func works like: -# - iterate over all lintable dirs (outputs "./folder/") -# - find .go files in a dir (via wildcard, so not recursively) -# - filter to only files in LINT_SRC -# - if it's not empty, run golint against the list -define lint_if_present -test -n "$1" && golint -set_exit_status $1 -endef - -lint: $(ALL_SRC) - GO111MODULE=off go get -u golang.org/x/lint/golint - @$(foreach pkg,\ - $(sort $(dir $(LINT_SRC))), \ - $(call lint_if_present,$(filter $(wildcard $(pkg)*.go),$(LINT_SRC))) || ERR=1; \ - ) test -z "$$ERR" || exit 1 - @OUTPUT=`gofmt -l $(ALL_SRC) 2>&1`; \ - if [ "$$OUTPUT" ]; then \ - echo "Run 'make fmt'. gofmt must be run on the following files:"; \ - echo "$$OUTPUT"; \ - exit 1; \ - fi - vet: $(ALL_SRC) - go vet ./... + @for dir in $(MOD_DIRS); do \ + (cd "$$dir" && go vet ./...) || exit 1; \ + done; staticcheck: $(ALL_SRC) go install honnef.co/go/tools/cmd/staticcheck@latest - staticcheck ./... + @for dir in $(MOD_DIRS); do \ + (cd "$$dir" && staticcheck ./...) || exit 1; \ + done; errcheck: $(ALL_SRC) GO111MODULE=off go get -u github.com/kisielk/errcheck - errcheck ./... + @for dir in $(MOD_DIRS); do \ + (cd "$$dir" && errcheck ./...) || exit 1; \ + done; fmt: @gofmt -w $(ALL_SRC) @@ -115,11 +92,8 @@ fmt: clean: rm -rf $(BUILD) -# golint is intentionally not included in the standard check since it is -# deprecated and inflexible, but it remains available as a utility check: vet errcheck staticcheck copyright bins - ##### Fossa ##### fossa-install: curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install.sh | bash diff --git a/activity/activity.go b/activity/activity.go index c66e67aed..d43ef2268 100644 --- a/activity/activity.go +++ b/activity/activity.go @@ -27,9 +27,8 @@ package activity import ( "context" - "github.com/uber-go/tally/v4" - "go.temporal.io/sdk/internal" + "go.temporal.io/sdk/internal/common/metrics" "go.temporal.io/sdk/log" ) @@ -61,9 +60,9 @@ func GetLogger(ctx context.Context) log.Logger { return internal.GetActivityLogger(ctx) } -// GetMetricsScope returns a metrics scope that can be used in activity -func GetMetricsScope(ctx context.Context) tally.Scope { - return internal.GetActivityMetricsScope(ctx) +// GetMetricsHandler returns a metrics handler that can be used in activity +func GetMetricsHandler(ctx context.Context) metrics.Handler { + return internal.GetActivityMetricsHandler(ctx) } // RecordHeartbeat sends heartbeat for the currently executing activity diff --git a/client/client.go b/client/client.go index fed84a69b..c7e06881e 100644 --- a/client/client.go +++ b/client/client.go @@ -37,6 +37,7 @@ import ( "go.temporal.io/sdk/converter" "go.temporal.io/sdk/internal" + "go.temporal.io/sdk/internal/common/metrics" ) const ( @@ -408,6 +409,28 @@ type ( } ) +// MetricsHandler is a handler for metrics emitted by the SDK. This interface is +// intentionally limited to only what the SDK needs to emit metrics and is not +// built to be a general purpose metrics abstraction for all uses. +// +// A common implementation is at +// go.temporal.io/sdk/contrib/tally.NewMetricsHandler. The MetricsNopHandler is +// a noop handler. A handler may implement "Unwrap() client.MetricsHandler" if +// it wraps a handler. +type MetricsHandler = metrics.Handler + +// MetricsCounter is an ever-increasing counter. +type MetricsCounter = metrics.Counter + +// MetricsGauge can be set to any float. +type MetricsGauge = metrics.Gauge + +// MetricsTimer records time durations. +type MetricsTimer = metrics.Timer + +// MetricsNopHandler is a noop handler that does nothing with the metrics. +var MetricsNopHandler = metrics.NopHandler + // NewClient creates an instance of a workflow client func NewClient(options Options) (Client, error) { return internal.NewClient(options) diff --git a/contrib/opentelemetry/go.mod b/contrib/opentelemetry/go.mod new file mode 100644 index 000000000..145c53ed7 --- /dev/null +++ b/contrib/opentelemetry/go.mod @@ -0,0 +1,13 @@ +module go.temporal.io/sdk/contrib/opentelemetry + +go 1.16 + +require ( + github.com/stretchr/testify v1.7.0 + go.opentelemetry.io/otel v1.2.0 + go.opentelemetry.io/otel/sdk v1.2.0 + go.opentelemetry.io/otel/trace v1.2.0 + go.temporal.io/sdk v1.11.1 +) + +replace go.temporal.io/sdk => ../../ diff --git a/contrib/opentelemetry/go.sum b/contrib/opentelemetry/go.sum new file mode 100644 index 000000000..9a98df9aa --- /dev/null +++ b/contrib/opentelemetry/go.sum @@ -0,0 +1,233 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a h1:yDWHCSQ40h88yih2JAcL6Ls/kVkSE8GFACTGVnMPruw= +github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a/go.mod h1:7Ga40egUymuWXxAe151lTNnCv97MddSOVsjpPPkityA= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= +github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/gogo/status v1.1.0 h1:+eIkrewn5q6b30y+g/BJINVVdi2xH7je5MPJ3ZPK3JA= +github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw= +github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ= +github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As= +github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.opentelemetry.io/otel v1.2.0 h1:YOQDvxO1FayUcT9MIhJhgMyNO1WqoduiyvQHzGN0kUQ= +go.opentelemetry.io/otel v1.2.0/go.mod h1:aT17Fk0Z1Nor9e0uisf98LrntPGMnk4frBO9+dkf69I= +go.opentelemetry.io/otel/sdk v1.2.0 h1:wKN260u4DesJYhyjxDa7LRFkuhH7ncEVKU37LWcyNIo= +go.opentelemetry.io/otel/sdk v1.2.0/go.mod h1:jNN8QtpvbsKhgaC6V5lHiejMoKD+V8uadoSafgHPx1U= +go.opentelemetry.io/otel/trace v1.2.0 h1:Ys3iqbqZhcf28hHzrm5WAquMkDHNZTUkw7KHbuNjej0= +go.opentelemetry.io/otel/trace v1.2.0/go.mod h1:N5FLswTubnxKxOJHM7XZC074qpeEdLy3CgAVsdMucK0= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.temporal.io/api v1.5.0 h1:o+I1ZK9jASakMyIMRN03rMaExKNicWebBSTrCSj55hs= +go.temporal.io/api v1.5.0/go.mod h1:BqKxEJJYdxb5dqf0ODfzfMxh8UEQ5L3zKS51FiIYYkA= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210913180222-943fd674d43e h1:+b/22bPvDYt4NPDcy4xAGCmON713ONAWFeY3Z7I3tR8= +golang.org/x/net v0.0.0-20210913180222-943fd674d43e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0 h1:xrCZDmdtoloIiooiA9q0OQb9r8HejIHYoHGhGCe1pGg= +golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af h1:aLMMXFYqw01RA6XJim5uaN+afqNNjc9P8HPAbnpnc5s= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/opentelemetry/tracing_interceptor.go b/contrib/opentelemetry/tracing_interceptor.go similarity index 100% rename from opentelemetry/tracing_interceptor.go rename to contrib/opentelemetry/tracing_interceptor.go diff --git a/opentelemetry/tracing_interceptor_test.go b/contrib/opentelemetry/tracing_interceptor_test.go similarity index 98% rename from opentelemetry/tracing_interceptor_test.go rename to contrib/opentelemetry/tracing_interceptor_test.go index 03019eab1..e7fa9f337 100644 --- a/opentelemetry/tracing_interceptor_test.go +++ b/contrib/opentelemetry/tracing_interceptor_test.go @@ -29,9 +29,9 @@ import ( sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" "go.opentelemetry.io/otel/trace" + "go.temporal.io/sdk/contrib/opentelemetry" "go.temporal.io/sdk/interceptor" "go.temporal.io/sdk/internal/interceptortest" - "go.temporal.io/sdk/opentelemetry" ) func TestSpanPropagation(t *testing.T) { diff --git a/contrib/opentracing/go.mod b/contrib/opentracing/go.mod new file mode 100644 index 000000000..14e101c81 --- /dev/null +++ b/contrib/opentracing/go.mod @@ -0,0 +1,11 @@ +module go.temporal.io/sdk/contrib/opentracing + +go 1.16 + +require ( + github.com/opentracing/opentracing-go v1.2.0 + github.com/stretchr/testify v1.7.0 + go.temporal.io/sdk v1.11.1 +) + +replace go.temporal.io/sdk => ../../ diff --git a/contrib/opentracing/go.sum b/contrib/opentracing/go.sum new file mode 100644 index 000000000..f6931faf1 --- /dev/null +++ b/contrib/opentracing/go.sum @@ -0,0 +1,228 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a h1:yDWHCSQ40h88yih2JAcL6Ls/kVkSE8GFACTGVnMPruw= +github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a/go.mod h1:7Ga40egUymuWXxAe151lTNnCv97MddSOVsjpPPkityA= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= +github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/gogo/status v1.1.0 h1:+eIkrewn5q6b30y+g/BJINVVdi2xH7je5MPJ3ZPK3JA= +github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw= +github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ= +github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As= +github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.temporal.io/api v1.5.0 h1:o+I1ZK9jASakMyIMRN03rMaExKNicWebBSTrCSj55hs= +go.temporal.io/api v1.5.0/go.mod h1:BqKxEJJYdxb5dqf0ODfzfMxh8UEQ5L3zKS51FiIYYkA= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210913180222-943fd674d43e h1:+b/22bPvDYt4NPDcy4xAGCmON713ONAWFeY3Z7I3tR8= +golang.org/x/net v0.0.0-20210913180222-943fd674d43e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0 h1:xrCZDmdtoloIiooiA9q0OQb9r8HejIHYoHGhGCe1pGg= +golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af h1:aLMMXFYqw01RA6XJim5uaN+afqNNjc9P8HPAbnpnc5s= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/opentracing/interceptor.go b/contrib/opentracing/interceptor.go similarity index 100% rename from opentracing/interceptor.go rename to contrib/opentracing/interceptor.go diff --git a/opentracing/interceptor_test.go b/contrib/opentracing/interceptor_test.go similarity index 98% rename from opentracing/interceptor_test.go rename to contrib/opentracing/interceptor_test.go index ee96ea1ed..d38aec624 100644 --- a/opentracing/interceptor_test.go +++ b/contrib/opentracing/interceptor_test.go @@ -27,9 +27,9 @@ import ( "github.com/opentracing/opentracing-go/mocktracer" "github.com/stretchr/testify/require" + "go.temporal.io/sdk/contrib/opentracing" "go.temporal.io/sdk/interceptor" "go.temporal.io/sdk/internal/interceptortest" - "go.temporal.io/sdk/opentracing" ) func TestSpanPropagation(t *testing.T) { diff --git a/contrib/tally/go.mod b/contrib/tally/go.mod new file mode 100644 index 000000000..9c83f41c4 --- /dev/null +++ b/contrib/tally/go.mod @@ -0,0 +1,11 @@ +module go.temporal.io/sdk/contrib/tally + +go 1.16 + +require ( + github.com/stretchr/testify v1.7.0 + github.com/uber-go/tally/v4 v4.1.1 + go.temporal.io/sdk v1.11.1 +) + +replace go.temporal.io/sdk => ../../ diff --git a/contrib/tally/go.sum b/contrib/tally/go.sum new file mode 100644 index 000000000..f02b48812 --- /dev/null +++ b/contrib/tally/go.sum @@ -0,0 +1,304 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cactus/go-statsd-client/statsd v0.0.0-20200423205355-cb0885a1018c/go.mod h1:l/bIBLeOl9eX+wxJAzxS4TveKRtAqlyDpHjhkfO0MEI= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a h1:yDWHCSQ40h88yih2JAcL6Ls/kVkSE8GFACTGVnMPruw= +github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a/go.mod h1:7Ga40egUymuWXxAe151lTNnCv97MddSOVsjpPPkityA= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= +github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/gogo/status v1.1.0 h1:+eIkrewn5q6b30y+g/BJINVVdi2xH7je5MPJ3ZPK3JA= +github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw= +github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ= +github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As= +github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/twmb/murmur3 v1.1.5 h1:i9OLS9fkuLzBXjt6dptlAEyk58fJsSTXbRg3SgVyqgk= +github.com/twmb/murmur3 v1.1.5/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= +github.com/uber-go/tally/v4 v4.1.1 h1:jhy6WOZp4nHyCqeV43x3Wz370LXUGBhgW2JmzOIHCWI= +github.com/uber-go/tally/v4 v4.1.1/go.mod h1:aXeSTDMl4tNosyf6rdU8jlgScHyjEGGtfJ/uwCIf/vM= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.temporal.io/api v1.5.0 h1:o+I1ZK9jASakMyIMRN03rMaExKNicWebBSTrCSj55hs= +go.temporal.io/api v1.5.0/go.mod h1:BqKxEJJYdxb5dqf0ODfzfMxh8UEQ5L3zKS51FiIYYkA= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210913180222-943fd674d43e h1:+b/22bPvDYt4NPDcy4xAGCmON713ONAWFeY3Z7I3tR8= +golang.org/x/net v0.0.0-20210913180222-943fd674d43e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0 h1:xrCZDmdtoloIiooiA9q0OQb9r8HejIHYoHGhGCe1pGg= +golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af h1:aLMMXFYqw01RA6XJim5uaN+afqNNjc9P8HPAbnpnc5s= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/validator.v2 v2.0.0-20200605151824-2b28d334fa05/go.mod h1:o4V0GXN9/CAmCsvJ0oXYZvrZOe7syiDZSN1GWGZTGzc= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/contrib/tally/handler.go b/contrib/tally/handler.go new file mode 100644 index 000000000..e5207d42e --- /dev/null +++ b/contrib/tally/handler.go @@ -0,0 +1,116 @@ +// The MIT License +// +// Copyright (c) 2021 Temporal Technologies Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package tally implements a MetricsHandler backed by github.com/uber-go/tally. +package tally + +import ( + "github.com/uber-go/tally/v4" + "go.temporal.io/sdk/client" +) + +type metricsHandler struct{ scope tally.Scope } + +// NewMetricsHandler returns a MetricsHandler that is backed by the given Tally +// scope. +// +// Default metrics are Prometheus compatible but default separator (.) should be +// replaced with some other character: +// opts := tally.ScopeOptions{ +// Separator: "_", +// } +// scope, _ := tally.NewRootScope(opts, time.Second) +// +// If you have custom metrics make sure they are compatible with Prometheus or +// create tally scope with sanitizer options set: +// var ( +// safeCharacters = []rune{'_'} +// sanitizeOptions = tally.SanitizeOptions{ +// NameCharacters: tally.ValidCharacters{ +// Ranges: tally.AlphanumericRange, +// Characters: safeCharacters, +// }, +// KeyCharacters: tally.ValidCharacters{ +// Ranges: tally.AlphanumericRange, +// Characters: safeCharacters, +// }, +// ValueCharacters: tally.ValidCharacters{ +// Ranges: tally.AlphanumericRange, +// Characters: safeCharacters, +// }, +// ReplacementCharacter: tally.DefaultReplacementCharacter, +// } +// ) +// opts := tally.ScopeOptions{ +// SanitizeOptions: &sanitizeOptions, +// Separator: "_", +// } +// scope, _ := tally.NewRootScope(opts, time.Second) +func NewMetricsHandler(scope tally.Scope) client.MetricsHandler { + return metricsHandler{scope} +} + +// ScopeFromHandler returns the underlying scope of the handler. Callers may +// need to check workflow.IsReplaying(ctx) to avoid recording metrics during +// replay. If this handler was not created via this package, tally.NoopScope is +// returned. +// +// Raw use of the scope is discouraged but may be used for Histograms or other +// advanced features. This scope does not skip metrics during replay like the +// metrics handler does. Therefore the caller should check replay state, for +// example: +// scope := tally.NoopScope +// if !workflow.IsReplaying(ctx) { +// scope = ScopeFromHandler(workflow.GetMetricsHandler(ctx)) +// } +// scope.Histogram("my_histogram", nil).RecordDuration(5 * time.Second) +func ScopeFromHandler(handler client.MetricsHandler) tally.Scope { + // Continually unwrap until we find an instance of our own handler + for { + tallyHandler, ok := handler.(metricsHandler) + if ok { + return tallyHandler.scope + } + // If unwrappable, do so, otherwise return noop + unwrappable, _ := handler.(interface{ Unwrap() client.MetricsHandler }) + if unwrappable == nil { + return tally.NoopScope + } + handler = unwrappable.Unwrap() + } +} + +func (m metricsHandler) WithTags(tags map[string]string) client.MetricsHandler { + return metricsHandler{m.scope.Tagged(tags)} +} + +func (m metricsHandler) Counter(name string) client.MetricsCounter { + return m.scope.Counter(name) +} + +func (m metricsHandler) Gauge(name string) client.MetricsGauge { + return m.scope.Gauge(name) +} + +func (m metricsHandler) Timer(name string) client.MetricsTimer { + return m.scope.Timer(name) +} diff --git a/contrib/tally/handler_test.go b/contrib/tally/handler_test.go new file mode 100644 index 000000000..9a118699f --- /dev/null +++ b/contrib/tally/handler_test.go @@ -0,0 +1,78 @@ +// The MIT License +// +// Copyright (c) 2021 Temporal Technologies Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package tally_test + +import ( + "fmt" + "sort" + "testing" + "time" + + "github.com/stretchr/testify/require" + "github.com/uber-go/tally/v4" + contribtally "go.temporal.io/sdk/contrib/tally" +) + +func TestTally(t *testing.T) { + scope := tally.NewTestScope("", nil) + handler := contribtally.NewMetricsHandler(scope) + // Confirm scope is the same + require.Equal(t, scope, contribtally.ScopeFromHandler(handler)) + + handler.Counter("counter_foo").Inc(1) + handler.Gauge("gauge_foo").Update(2.0) + handler.Timer("timer_foo").Record(3 * time.Second) + subHandler := handler.WithTags(map[string]string{"tagkey1": "tagval1"}) + subHandler.Counter("counter_foo").Inc(4) + subHandler.Gauge("gauge_foo").Update(5.0) + subHandler.Timer("timer_foo").Record(6 * time.Second) + subSubHandler := handler.WithTags(map[string]string{"tagkey1": "tagval2", "tagkey2": "tagval2"}) + subSubHandler.Counter("counter_foo").Inc(7) + subSubHandler.Gauge("gauge_foo").Update(8.0) + subSubHandler.Timer("timer_foo").Record(9 * time.Second) + + snap := scope.Snapshot() + // Since Go 1.12, maps are printed in deterministic order + var metrics []string + for _, c := range snap.Counters() { + metrics = append(metrics, fmt.Sprintf("%v: %v - %v", c.Name(), c.Tags(), c.Value())) + } + for _, g := range snap.Gauges() { + metrics = append(metrics, fmt.Sprintf("%v: %v - %v", g.Name(), g.Tags(), g.Value())) + } + for _, t := range snap.Timers() { + metrics = append(metrics, fmt.Sprintf("%v: %v - %v", t.Name(), t.Tags(), t.Values()[0])) + } + sort.Strings(metrics) + require.Equal(t, []string{ + "counter_foo: map[] - 1", + "counter_foo: map[tagkey1:tagval1] - 4", + "counter_foo: map[tagkey1:tagval2 tagkey2:tagval2] - 7", + "gauge_foo: map[] - 2", + "gauge_foo: map[tagkey1:tagval1] - 5", + "gauge_foo: map[tagkey1:tagval2 tagkey2:tagval2] - 8", + "timer_foo: map[] - 3s", + "timer_foo: map[tagkey1:tagval1] - 6s", + "timer_foo: map[tagkey1:tagval2 tagkey2:tagval2] - 9s", + }, metrics) +} diff --git a/go.mod b/go.mod index e6a5dca4f..a3b084085 100644 --- a/go.mod +++ b/go.mod @@ -8,23 +8,17 @@ require ( github.com/gogo/status v1.1.0 github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.2 + github.com/google/go-cmp v0.5.6 // indirect github.com/google/uuid v1.3.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/kr/text v0.2.0 // indirect github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect - github.com/opentracing/opentracing-go v1.2.0 github.com/pborman/uuid v1.2.1 github.com/robfig/cron v1.2.0 github.com/stretchr/objx v0.3.0 // indirect github.com/stretchr/testify v1.7.0 - github.com/twmb/murmur3 v1.1.6 // indirect - github.com/uber-go/tally/v4 v4.1.0 - go.opentelemetry.io/otel v1.1.0 - go.opentelemetry.io/otel/sdk v1.1.0 - go.opentelemetry.io/otel/trace v1.1.0 go.temporal.io/api v1.5.0 go.uber.org/atomic v1.9.0 - go.uber.org/goleak v1.1.11 golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 diff --git a/go.sum b/go.sum index 8962cb518..318e4c4b9 100644 --- a/go.sum +++ b/go.sum @@ -2,19 +2,9 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/cactus/go-statsd-client/statsd v0.0.0-20200423205355-cb0885a1018c/go.mod h1:l/bIBLeOl9eX+wxJAzxS4TveKRtAqlyDpHjhkfO0MEI= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -32,17 +22,12 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a h1:yDWHCSQ40h88yih2JAcL6Ls/kVkSE8GFACTGVnMPruw= github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a/go.mod h1:7Ga40egUymuWXxAe151lTNnCv97MddSOVsjpPPkityA= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= @@ -53,7 +38,6 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= @@ -72,11 +56,9 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= @@ -84,62 +66,27 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= -github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw= github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ= github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -151,32 +98,17 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/twmb/murmur3 v1.1.5/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= -github.com/twmb/murmur3 v1.1.6 h1:mqrRot1BRxm+Yct+vavLMou2/iJt0tNVTTC0QoIjaZg= -github.com/twmb/murmur3 v1.1.6/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= -github.com/uber-go/tally/v4 v4.1.0 h1:1eneqn/qX0td2GX1JHyu9qZSP5qxgugurnTlZa8/5Co= -github.com/uber-go/tally/v4 v4.1.0/go.mod h1:aXeSTDMl4tNosyf6rdU8jlgScHyjEGGtfJ/uwCIf/vM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.opentelemetry.io/otel v1.1.0 h1:8p0uMLcyyIx0KHNTgO8o3CW8A1aA+dJZJW6PvnMz0Wc= -go.opentelemetry.io/otel v1.1.0/go.mod h1:7cww0OW51jQ8IaZChIEdqLwgh+44+7uiTdWsAL0wQpA= -go.opentelemetry.io/otel/sdk v1.1.0 h1:j/1PngUJIDOddkCILQYTevrTIbWd494djgGkSsMit+U= -go.opentelemetry.io/otel/sdk v1.1.0/go.mod h1:3aQvM6uLm6C4wJpHtT8Od3vNzeZ34Pqc6bps8MywWzo= -go.opentelemetry.io/otel/trace v1.1.0 h1:N25T9qCL0+7IpOT8RrRy0WYlL7y6U0WiUJzXcVdXY/o= -go.opentelemetry.io/otel/trace v1.1.0/go.mod h1:i47XtdcBQiktu5IsrPqOHe8w+sBmnLwwHt8wiUsWGTI= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.temporal.io/api v1.5.0 h1:o+I1ZK9jASakMyIMRN03rMaExKNicWebBSTrCSj55hs= go.temporal.io/api v1.5.0/go.mod h1:BqKxEJJYdxb5dqf0ODfzfMxh8UEQ5L3zKS51FiIYYkA= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= -go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -184,8 +116,6 @@ golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -193,22 +123,18 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210913180222-943fd674d43e h1:+b/22bPvDYt4NPDcy4xAGCmON713ONAWFeY3Z7I3tR8= golang.org/x/net v0.0.0-20210913180222-943fd674d43e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -217,31 +143,21 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0 h1:xrCZDmdtoloIiooiA9q0OQb9r8HejIHYoHGhGCe1pGg= golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -259,7 +175,6 @@ golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -299,20 +214,11 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/validator.v2 v2.0.0-20200605151824-2b28d334fa05/go.mod h1:o4V0GXN9/CAmCsvJ0oXYZvrZOe7syiDZSN1GWGZTGzc= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/activity.go b/internal/activity.go index 111e20452..6e775e3f0 100644 --- a/internal/activity.go +++ b/internal/activity.go @@ -29,12 +29,12 @@ import ( "fmt" "time" - "github.com/uber-go/tally/v4" commonpb "go.temporal.io/api/common/v1" "go.temporal.io/api/workflowservice/v1" "go.temporal.io/sdk/converter" "go.temporal.io/sdk/internal/common" + "go.temporal.io/sdk/internal/common/metrics" "go.temporal.io/sdk/log" ) @@ -174,9 +174,9 @@ func GetActivityLogger(ctx context.Context) log.Logger { return getActivityOutboundInterceptor(ctx).GetLogger(ctx) } -// GetActivityMetricsScope returns a metrics scope that can be used in activity -func GetActivityMetricsScope(ctx context.Context) tally.Scope { - return getActivityOutboundInterceptor(ctx).GetMetricsScope(ctx) +// GetActivityMetricsHandler returns a metrics handler that can be used in activity +func GetActivityMetricsHandler(ctx context.Context) metrics.Handler { + return getActivityOutboundInterceptor(ctx).GetMetricsHandler(ctx) } // GetWorkerStopChannel returns a read-only channel. The closure of this channel indicates the activity worker is stopping. @@ -216,7 +216,7 @@ func WithActivityTask( taskQueue string, invoker ServiceInvoker, logger log.Logger, - scope tally.Scope, + metricsHandler metrics.Handler, dataConverter converter.DataConverter, workerStopChannel <-chan struct{}, contextPropagators []ContextPropagator, @@ -260,7 +260,7 @@ func WithActivityTask( RunID: task.WorkflowExecution.RunId, ID: task.WorkflowExecution.WorkflowId}, logger: logger, - metricsScope: scope, + metricsHandler: metricsHandler, deadline: deadline, heartbeatTimeout: heartbeatTimeout, scheduledTime: scheduled, @@ -283,7 +283,7 @@ func WithLocalActivityTask( ctx context.Context, task *localActivityTask, logger log.Logger, - scope tally.Scope, + metricsHandler metrics.Handler, dataConverter converter.DataConverter, interceptors []WorkerInterceptor, ) (context.Context, error) { @@ -309,7 +309,7 @@ func WithLocalActivityTask( activityID: fmt.Sprintf("%v", task.activityID), workflowExecution: task.params.WorkflowInfo.WorkflowExecution, logger: logger, - metricsScope: scope, + metricsHandler: metricsHandler, isLocalActivity: true, dataConverter: dataConverter, attempt: task.attempt, diff --git a/internal/activity_test.go b/internal/activity_test.go index 79cab55ea..1c3976bd0 100644 --- a/internal/activity_test.go +++ b/internal/activity_test.go @@ -33,8 +33,8 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "github.com/uber-go/tally/v4" "go.temporal.io/api/serviceerror" + "go.temporal.io/sdk/internal/common/metrics" "google.golang.org/grpc" "go.temporal.io/api/workflowservice/v1" @@ -65,7 +65,7 @@ func (s *activityTestSuite) TearDownTest() { func (s *activityTestSuite) TestActivityHeartbeat() { ctx, cancel := context.WithCancel(context.Background()) - invoker := newServiceInvoker([]byte("task-token"), "identity", s.service, tally.NoopScope, cancel, + invoker := newServiceInvoker([]byte("task-token"), "identity", s.service, metrics.NopHandler, cancel, 1*time.Second, make(chan struct{}), s.namespace) ctx, _ = newActivityContext(ctx, nil, &activityEnvironment{serviceInvoker: invoker}) @@ -77,7 +77,7 @@ func (s *activityTestSuite) TestActivityHeartbeat() { func (s *activityTestSuite) TestActivityHeartbeat_InternalError() { ctx, cancel := context.WithCancel(context.Background()) - invoker := newServiceInvoker([]byte("task-token"), "identity", s.service, tally.NoopScope, cancel, + invoker := newServiceInvoker([]byte("task-token"), "identity", s.service, metrics.NopHandler, cancel, 1*time.Second, make(chan struct{}), s.namespace) ctx, _ = newActivityContext(ctx, nil, &activityEnvironment{ serviceInvoker: invoker, @@ -94,7 +94,7 @@ func (s *activityTestSuite) TestActivityHeartbeat_InternalError() { func (s *activityTestSuite) TestActivityHeartbeat_CancelRequested() { ctx, cancel := context.WithCancel(context.Background()) - invoker := newServiceInvoker([]byte("task-token"), "identity", s.service, tally.NoopScope, cancel, + invoker := newServiceInvoker([]byte("task-token"), "identity", s.service, metrics.NopHandler, cancel, 1*time.Second, make(chan struct{}), s.namespace) ctx, _ = newActivityContext(ctx, nil, &activityEnvironment{ serviceInvoker: invoker, @@ -110,7 +110,7 @@ func (s *activityTestSuite) TestActivityHeartbeat_CancelRequested() { func (s *activityTestSuite) TestActivityHeartbeat_EntityNotExist() { ctx, cancel := context.WithCancel(context.Background()) - invoker := newServiceInvoker([]byte("task-token"), "identity", s.service, tally.NoopScope, cancel, + invoker := newServiceInvoker([]byte("task-token"), "identity", s.service, metrics.NopHandler, cancel, 1*time.Second, make(chan struct{}), s.namespace) ctx, _ = newActivityContext(ctx, nil, &activityEnvironment{ serviceInvoker: invoker, @@ -126,7 +126,7 @@ func (s *activityTestSuite) TestActivityHeartbeat_EntityNotExist() { func (s *activityTestSuite) TestActivityHeartbeat_SuppressContinousInvokes() { ctx, cancel := context.WithCancel(context.Background()) - invoker := newServiceInvoker([]byte("task-token"), "identity", s.service, tally.NoopScope, cancel, + invoker := newServiceInvoker([]byte("task-token"), "identity", s.service, metrics.NopHandler, cancel, 2*time.Second, make(chan struct{}), s.namespace) ctx, _ = newActivityContext(ctx, nil, &activityEnvironment{ serviceInvoker: invoker, @@ -142,7 +142,7 @@ func (s *activityTestSuite) TestActivityHeartbeat_SuppressContinousInvokes() { // No HB timeout configured. service2 := workflowservicemock.NewMockWorkflowServiceClient(s.mockCtrl) - invoker2 := newServiceInvoker([]byte("task-token"), "identity", service2, tally.NoopScope, cancel, + invoker2 := newServiceInvoker([]byte("task-token"), "identity", service2, metrics.NopHandler, cancel, 0, make(chan struct{}), s.namespace) ctx, _ = newActivityContext(ctx, nil, &activityEnvironment{ serviceInvoker: invoker2, @@ -156,7 +156,7 @@ func (s *activityTestSuite) TestActivityHeartbeat_SuppressContinousInvokes() { // simulate batch picks before expiry. waitCh := make(chan struct{}) service3 := workflowservicemock.NewMockWorkflowServiceClient(s.mockCtrl) - invoker3 := newServiceInvoker([]byte("task-token"), "identity", service3, tally.NoopScope, cancel, + invoker3 := newServiceInvoker([]byte("task-token"), "identity", service3, metrics.NopHandler, cancel, 2*time.Second, make(chan struct{}), s.namespace) ctx, _ = newActivityContext(ctx, nil, &activityEnvironment{ serviceInvoker: invoker3, @@ -187,7 +187,7 @@ func (s *activityTestSuite) TestActivityHeartbeat_SuppressContinousInvokes() { // simulate batch picks before expiry, without any progress specified. waitCh2 := make(chan struct{}) service4 := workflowservicemock.NewMockWorkflowServiceClient(s.mockCtrl) - invoker4 := newServiceInvoker([]byte("task-token"), "identity", service4, tally.NoopScope, cancel, + invoker4 := newServiceInvoker([]byte("task-token"), "identity", service4, metrics.NopHandler, cancel, 2*time.Second, make(chan struct{}), s.namespace) ctx, _ = newActivityContext(ctx, nil, &activityEnvironment{ serviceInvoker: invoker4, @@ -212,7 +212,7 @@ func (s *activityTestSuite) TestActivityHeartbeat_SuppressContinousInvokes() { func (s *activityTestSuite) TestActivityHeartbeat_WorkerStop() { ctx, cancel := context.WithCancel(context.Background()) workerStopChannel := make(chan struct{}) - invoker := newServiceInvoker([]byte("task-token"), "identity", s.service, tally.NoopScope, cancel, + invoker := newServiceInvoker([]byte("task-token"), "identity", s.service, metrics.NopHandler, cancel, 5*time.Second, workerStopChannel, s.namespace) ctx, _ = newActivityContext(ctx, nil, &activityEnvironment{serviceInvoker: invoker}) diff --git a/internal/client.go b/internal/client.go index feba7c550..e868c2b11 100644 --- a/internal/client.go +++ b/internal/client.go @@ -31,7 +31,6 @@ import ( "io" "time" - "github.com/uber-go/tally/v4" commonpb "go.temporal.io/api/common/v1" enumspb "go.temporal.io/api/enums/v1" "go.temporal.io/api/workflowservice/v1" @@ -380,39 +379,9 @@ type ( // default: default logger provided. Logger log.Logger - // Optional: Metrics to be reported. - // Default metrics are Prometheus compatible but default separator (.) should be replaced with some other character: - // opts := tally.ScopeOptions{ - // Separator: "_", - // } - // scope, _ := tally.NewRootScope(opts, time.Second) - // - // If you have custom metrics make sure they are compatible with Prometheus or create tally scope with sanitizer options set: - // var ( - // safeCharacters = []rune{'_'} - // sanitizeOptions = tally.SanitizeOptions{ - // NameCharacters: tally.ValidCharacters{ - // Ranges: tally.AlphanumericRange, - // Characters: _safeCharacters, - // }, - // KeyCharacters: tally.ValidCharacters{ - // Ranges: tally.AlphanumericRange, - // Characters: _safeCharacters, - // }, - // ValueCharacters: tally.ValidCharacters{ - // Ranges: tally.AlphanumericRange, - // Characters: _safeCharacters, - // }, - // ReplacementCharacter: tally.DefaultReplacementCharacter, - // } - // ) - // opts := tally.ScopeOptions{ - // SanitizeOptions: &sanitizeOptions, - // Separator: "_", - // } - // scope, _ := tally.NewRootScope(opts, time.Second) + // Optional: Metrics handler for reporting metrics. // default: no metrics. - MetricsScope tally.Scope + MetricsHandler metrics.Handler // Optional: Sets an identify that can be used to track this host for debugging. // default: default identity that include hostname, groupName and process ID. @@ -661,8 +630,11 @@ func NewClient(options ClientOptions) (Client, error) { options.Namespace = DefaultNamespace } - // Initializes the root metric scope. These tags are included on each metric which creates a child scope from it. - options.MetricsScope = metrics.GetRootScope(options.MetricsScope, options.Namespace) + // Initialize root tags + if options.MetricsHandler == nil { + options.MetricsHandler = metrics.NopHandler + } + options.MetricsHandler = options.MetricsHandler.WithTags(metrics.RootTags(options.Namespace)) if options.HostPort == "" { options.HostPort = LocalHostPort @@ -692,7 +664,7 @@ func newDialParameters(options *ClientOptions) dialParameters { return dialParameters{ UserConnectionOptions: options.ConnectionOptions, HostPort: options.HostPort, - RequiredInterceptors: requiredInterceptors(options.MetricsScope, options.HeadersProvider, options.TrafficController), + RequiredInterceptors: requiredInterceptors(options.MetricsHandler, options.HeadersProvider, options.TrafficController), DefaultServiceConfig: defaultServiceConfig, } } @@ -712,6 +684,10 @@ func NewServiceClient(workflowServiceClient workflowservice.WorkflowServiceClien options.DataConverter = converter.GetDefaultDataConverter() } + if options.MetricsHandler == nil { + options.MetricsHandler = metrics.NopHandler + } + // Collect set of applicable worker interceptors var workerInterceptors []WorkerInterceptor for _, interceptor := range options.Interceptors { @@ -725,7 +701,7 @@ func NewServiceClient(workflowServiceClient workflowservice.WorkflowServiceClien connectionCloser: connectionCloser, namespace: options.Namespace, registry: newRegistry(), - metricsScope: options.MetricsScope, + metricsHandler: options.MetricsHandler, logger: options.Logger, identity: options.Identity, dataConverter: options.DataConverter, @@ -744,8 +720,11 @@ func NewServiceClient(workflowServiceClient workflowservice.WorkflowServiceClien // NewNamespaceClient creates an instance of a namespace client, to manager lifecycle of namespaces. func NewNamespaceClient(options ClientOptions) (NamespaceClient, error) { - // Initializes the root metric scope. These tags are included on each metric which creates a child scope from it. - options.MetricsScope = metrics.GetRootScope(options.MetricsScope, metrics.NoneTagValue) + // Initialize root tags + if options.MetricsHandler == nil { + options.MetricsHandler = metrics.NopHandler + } + options.MetricsHandler = options.MetricsHandler.WithTags(metrics.RootTags(metrics.NoneTagValue)) if options.HostPort == "" { options.HostPort = LocalHostPort @@ -774,7 +753,7 @@ func newNamespaceServiceClient(workflowServiceClient workflowservice.WorkflowSer return &namespaceClient{ workflowService: workflowServiceClient, connectionCloser: clientConn, - metricsScope: options.MetricsScope, + metricsHandler: options.MetricsHandler, logger: options.Logger, identity: options.Identity, } diff --git a/internal/common/metrics/capturing_handler.go b/internal/common/metrics/capturing_handler.go new file mode 100644 index 000000000..ac9763269 --- /dev/null +++ b/internal/common/metrics/capturing_handler.go @@ -0,0 +1,222 @@ +// The MIT License +// +// Copyright (c) 2021 Temporal Technologies Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package metrics + +import ( + "sync" + "sync/atomic" + "time" +) + +// This file contains test helpers only. They are not private because they are used by other tests. + +type capturedInfo struct { + sliceLock sync.RWMutex // Only governs slice access, not what's in the slice + counters []*CapturedCounter + gauges []*CapturedGauge + timers []*CapturedTimer +} + +// CapturingHandler is a Handler that retains counted values locally. +type CapturingHandler struct { + *capturedInfo + // Never changed once created + tags map[string]string +} + +var _ Handler = &CapturingHandler{} + +// NewCapturingHandler creates a new CapturingHandler. +func NewCapturingHandler() *CapturingHandler { return &CapturingHandler{capturedInfo: &capturedInfo{}} } + +// Clear removes all known metrics from the root handler. +func (c *CapturingHandler) Clear() { + c.sliceLock.Lock() + defer c.sliceLock.Unlock() + c.counters = nil + c.gauges = nil + c.timers = nil +} + +// WithTags implements Handler.WithTags. +func (c *CapturingHandler) WithTags(tags map[string]string) Handler { + ret := &CapturingHandler{capturedInfo: c.capturedInfo, tags: make(map[string]string)} + for k, v := range c.tags { + ret.tags[k] = v + } + for k, v := range tags { + ret.tags[k] = v + } + return ret +} + +// Counter implements Handler.Counter. +func (c *CapturingHandler) Counter(name string) Counter { + c.sliceLock.Lock() + defer c.sliceLock.Unlock() + // Try to find one or create otherwise + var ret *CapturedCounter + for _, counter := range c.counters { + if counter.Name == name && counter.equalTags(c.tags) { + ret = counter + break + } + } + if ret == nil { + ret = &CapturedCounter{CapturedMetricMeta: CapturedMetricMeta{Name: name, Tags: c.tags}} + c.counters = append(c.counters, ret) + } + return ret +} + +// Counters returns shallow copy of the local counters. New counters will not +// get added here, but the value within the counter may still change. +func (c *CapturingHandler) Counters() []*CapturedCounter { + c.sliceLock.RLock() + defer c.sliceLock.RUnlock() + ret := make([]*CapturedCounter, len(c.counters)) + copy(ret, c.counters) + return ret +} + +// Gauge implements Handler.Gauge. +func (c *CapturingHandler) Gauge(name string) Gauge { + c.sliceLock.Lock() + defer c.sliceLock.Unlock() + // Try to find one or create otherwise + var ret *CapturedGauge + for _, gauge := range c.gauges { + if gauge.Name == name && gauge.equalTags(c.tags) { + ret = gauge + break + } + } + if ret == nil { + ret = &CapturedGauge{CapturedMetricMeta: CapturedMetricMeta{Name: name, Tags: c.tags}} + c.gauges = append(c.gauges, ret) + } + return ret +} + +// Gauges returns shallow copy of the local gauges. New gauges will not get +// added here, but the value within the gauge may still change. +func (c *CapturingHandler) Gauges() []*CapturedGauge { + c.sliceLock.RLock() + defer c.sliceLock.RUnlock() + ret := make([]*CapturedGauge, len(c.gauges)) + copy(ret, c.gauges) + return ret +} + +// Timer implements Handler.Timer. +func (c *CapturingHandler) Timer(name string) Timer { + c.sliceLock.Lock() + defer c.sliceLock.Unlock() + // Try to find one or create otherwise + var ret *CapturedTimer + for _, timer := range c.timers { + if timer.Name == name && timer.equalTags(c.tags) { + ret = timer + break + } + } + if ret == nil { + ret = &CapturedTimer{CapturedMetricMeta: CapturedMetricMeta{Name: name, Tags: c.tags}} + c.timers = append(c.timers, ret) + } + return ret +} + +// Timers returns shallow copy of the local timers. New timers will not get +// added here, but the value within the timer may still change. +func (c *CapturingHandler) Timers() []*CapturedTimer { + c.sliceLock.RLock() + defer c.sliceLock.RUnlock() + ret := make([]*CapturedTimer, len(c.timers)) + copy(ret, c.timers) + return ret +} + +// CapturedMetricMeta is common information for captured metrics. These fields +// should never by mutated. +type CapturedMetricMeta struct { + Name string + Tags map[string]string +} + +func (c *CapturedMetricMeta) equalTags(other map[string]string) bool { + if len(c.Tags) != len(other) { + return false + } + for k, v := range c.Tags { + if otherV, ok := other[k]; !ok || otherV != v { + return false + } + } + return true +} + +// CapturedCounter atomically implements Counter and provides an atomic getter. +type CapturedCounter struct { + CapturedMetricMeta + value int64 +} + +// Inc implements Counter.Inc. +func (c *CapturedCounter) Inc(d int64) { atomic.AddInt64(&c.value, d) } + +// Value atomically returns the current value. +func (c *CapturedCounter) Value() int64 { return atomic.LoadInt64(&c.value) } + +// CapturedGauge atomically implements Gauge and provides an atomic getter. +type CapturedGauge struct { + CapturedMetricMeta + value float64 + valueLock sync.RWMutex +} + +// Update implements Gauge.Update. +func (c *CapturedGauge) Update(d float64) { + c.valueLock.Lock() + defer c.valueLock.Unlock() + c.value = d +} + +// Value atomically returns the current value. +func (c *CapturedGauge) Value() float64 { + c.valueLock.RLock() + defer c.valueLock.RUnlock() + return c.value +} + +// CapturedTimer atomically implements Timer and provides an atomic getter. +type CapturedTimer struct { + CapturedMetricMeta + value int64 +} + +// Record implements Timer.Record. +func (c *CapturedTimer) Record(d time.Duration) { atomic.StoreInt64(&c.value, int64(d)) } + +// Value atomically returns the current value. +func (c *CapturedTimer) Value() time.Duration { return time.Duration(atomic.LoadInt64(&c.value)) } diff --git a/internal/common/metrics/capturing_stats_reporter.go b/internal/common/metrics/capturing_stats_reporter.go deleted file mode 100644 index 7a6d68c57..000000000 --- a/internal/common/metrics/capturing_stats_reporter.go +++ /dev/null @@ -1,278 +0,0 @@ -// The MIT License -// -// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved. -// -// Copyright (c) 2020 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package metrics - -import ( - "io" - "sync" - "time" - - "github.com/uber-go/tally/v4" -) - -// This file contains test helpers only. They are not private because they are used by other tests. - -// NewMetricsScope returns a new metric scope -func NewMetricsScope(isReplay *bool) (tally.Scope, io.Closer, *CapturingStatsReporter) { - reporter := &CapturingStatsReporter{} - opts := tally.ScopeOptions{Reporter: reporter} - scope, closer := tally.NewRootScope(opts, 100*time.Millisecond) - return WrapScope(isReplay, scope, &realClock{}), closer, reporter -} - -// NewTaggedMetricsScope return NewTaggedMetricsScope -func NewTaggedMetricsScope() (tally.Scope, io.Closer, *CapturingStatsReporter) { - isReplay := false - scope, closer, reporter := NewMetricsScope(&isReplay) - return scope, closer, reporter -} - -type realClock struct { -} - -func (c *realClock) Now() time.Time { - return time.Now() -} - -// CapturingStatsReporter is a reporter used by tests to capture the metric so we can verify our tests. -type CapturingStatsReporter struct { - sync.RWMutex - counts []CapturedCount - gauges []CapturedGauge - timers []CapturedTimer - histogramValueSamples []CapturedHistogramValueSamples - histogramDurationSamples []CapturedHistogramDurationSamples - capabilities int - flush int -} - -// HistogramDurationSamples return HistogramDurationSamples -func (c *CapturingStatsReporter) HistogramDurationSamples() []CapturedHistogramDurationSamples { - c.RLock() - defer c.RUnlock() - return c.histogramDurationSamples -} - -// HistogramValueSamples return HistogramValueSamples -func (c *CapturingStatsReporter) HistogramValueSamples() []CapturedHistogramValueSamples { - c.RLock() - defer c.RUnlock() - return c.histogramValueSamples -} - -// Timers return Timers -func (c *CapturingStatsReporter) Timers() []CapturedTimer { - c.RLock() - defer c.RUnlock() - return c.timers -} - -// Gauges return Gauges -func (c *CapturingStatsReporter) Gauges() []CapturedGauge { - c.RLock() - defer c.RUnlock() - return c.gauges -} - -// Counts return Counts -func (c *CapturingStatsReporter) Counts() []CapturedCount { - c.RLock() - defer c.RUnlock() - return c.counts -} - -// CapturedCount has associated name, tags and value -type CapturedCount struct { - name string - tags map[string]string - value int64 -} - -// Value return the value of CapturedCount -func (c *CapturedCount) Value() int64 { - return c.value -} - -// Tags return CapturedCount tags -func (c *CapturedCount) Tags() map[string]string { - return c.tags -} - -// Name return the name of CapturedCount -func (c *CapturedCount) Name() string { - return c.name -} - -// CapturedGauge has CapturedGauge name, tag and values -type CapturedGauge struct { - name string - tags map[string]string - value float64 -} - -// Value return the value of CapturedGauge -func (c *CapturedGauge) Value() float64 { - return c.value -} - -// Tags return the tags of CapturedGauge -func (c *CapturedGauge) Tags() map[string]string { - return c.tags -} - -// Name return the name of CapturedGauge -func (c *CapturedGauge) Name() string { - return c.name -} - -// CapturedTimer has related name , tags and value -type CapturedTimer struct { - name string - tags map[string]string - value time.Duration -} - -// Value return the value of CapturedTimer -func (c *CapturedTimer) Value() time.Duration { - return c.value -} - -// Tags return the tag of CapturedTimer -func (c *CapturedTimer) Tags() map[string]string { - return c.tags -} - -// Name return the name of CapturedTimer -func (c *CapturedTimer) Name() string { - return c.name -} - -// CapturedHistogramValueSamples has related information for CapturedHistogramValueSamples -type CapturedHistogramValueSamples struct { - name string - tags map[string]string - bucketLowerBound float64 - bucketUpperBound float64 - samples int64 -} - -// CapturedHistogramDurationSamples has related information for CapturedHistogramDurationSamples -type CapturedHistogramDurationSamples struct { - name string - tags map[string]string - bucketLowerBound time.Duration - bucketUpperBound time.Duration - samples int64 -} - -// ReportCounter reports the counts -func (c *CapturingStatsReporter) ReportCounter( - name string, - tags map[string]string, - value int64, -) { - c.Lock() - defer c.Unlock() - c.counts = append(c.counts, CapturedCount{name, tags, value}) -} - -// ReportGauge reports the gauges -func (c *CapturingStatsReporter) ReportGauge( - name string, - tags map[string]string, - value float64, -) { - c.Lock() - defer c.Unlock() - c.gauges = append(c.gauges, CapturedGauge{name, tags, value}) -} - -// ReportTimer reports timers -func (c *CapturingStatsReporter) ReportTimer( - name string, - tags map[string]string, - value time.Duration, -) { - c.Lock() - defer c.Unlock() - c.timers = append(c.timers, CapturedTimer{name, tags, value}) -} - -// ReportHistogramValueSamples reports histogramValueSamples -func (c *CapturingStatsReporter) ReportHistogramValueSamples( - name string, - tags map[string]string, - _ tally.Buckets, - bucketLowerBound, - bucketUpperBound float64, - samples int64, -) { - elem := CapturedHistogramValueSamples{name, tags, - bucketLowerBound, bucketUpperBound, samples} - c.Lock() - defer c.Unlock() - c.histogramValueSamples = append(c.histogramValueSamples, elem) -} - -// ReportHistogramDurationSamples reports ReportHistogramDurationSamples -func (c *CapturingStatsReporter) ReportHistogramDurationSamples( - name string, - tags map[string]string, - _ tally.Buckets, - bucketLowerBound, - bucketUpperBound time.Duration, - samples int64, -) { - elem := CapturedHistogramDurationSamples{name, tags, - bucketLowerBound, bucketUpperBound, samples} - c.Lock() - defer c.Unlock() - c.histogramDurationSamples = append(c.histogramDurationSamples, elem) -} - -// Capabilities return tally.Capabilities -func (c *CapturingStatsReporter) Capabilities() tally.Capabilities { - c.Lock() - defer c.Unlock() - c.capabilities++ - return c -} - -// Reporting will always return true -func (c *CapturingStatsReporter) Reporting() bool { - return true -} - -// Tagging will always return true -func (c *CapturingStatsReporter) Tagging() bool { - return true -} - -// Flush will add one to flush -func (c *CapturingStatsReporter) Flush() { - c.Lock() - defer c.Unlock() - c.flush++ -} diff --git a/internal/common/metrics/context.go b/internal/common/metrics/context.go deleted file mode 100644 index 632a63a0e..000000000 --- a/internal/common/metrics/context.go +++ /dev/null @@ -1,35 +0,0 @@ -// The MIT License -// -// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved. -// -// Copyright (c) 2020 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package metrics - -type ( - contextKey string -) - -// Context keys -const ( - ScopeContextKey = contextKey("MetricsScope") - LongPollContextKey = contextKey("IsLongPoll") -) diff --git a/internal/common/metrics/grpc.go b/internal/common/metrics/grpc.go new file mode 100644 index 000000000..1a07cc432 --- /dev/null +++ b/internal/common/metrics/grpc.go @@ -0,0 +1,101 @@ +// The MIT License +// +// Copyright (c) 2021 Temporal Technologies Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package metrics + +import ( + "context" + "strings" + "time" + + "google.golang.org/grpc" +) + +// HandlerContextKey is the context key for a MetricHandler value. +type HandlerContextKey struct{} + +// LongPollContextKey is the context key for a boolean stating whether the gRPC +// call is a long poll. +type LongPollContextKey struct{} + +// NewGRPCInterceptor creates a new gRPC unary interceptor to record metrics. +func NewGRPCInterceptor(defaultHandler Handler, suffix string) grpc.UnaryClientInterceptor { + return func( + ctx context.Context, + method string, + req interface{}, + reply interface{}, + cc *grpc.ClientConn, + invoker grpc.UnaryInvoker, + opts ...grpc.CallOption, + ) error { + handler, _ := ctx.Value(HandlerContextKey{}).(Handler) + if handler == nil { + handler = defaultHandler + } + longPoll, ok := ctx.Value(LongPollContextKey{}).(bool) + if !ok { + longPoll = false + } + + // Only take method name after the last slash + operation := method[strings.LastIndex(method, "/")+1:] + handler = handler.WithTags(map[string]string{OperationTagName: operation}) + + // Capture time, record start, run, and record end + start := time.Now() + recordRequestStart(handler, longPoll, suffix) + err := invoker(ctx, method, req, reply, cc, opts...) + recordRequestEnd(handler, longPoll, suffix, start, err) + return err + } +} + +func recordRequestStart(handler Handler, longPoll bool, suffix string) { + // Count request + metric := TemporalRequest + if longPoll { + metric = TemporalLongRequest + } + metric += suffix + handler.Counter(metric).Inc(1) +} + +func recordRequestEnd(handler Handler, longPoll bool, suffix string, start time.Time, err error) { + // Record latency + timerMetric := TemporalRequestLatency + if longPoll { + timerMetric = TemporalLongRequestLatency + } + timerMetric += suffix + handler.Timer(timerMetric).Record(time.Since(start)) + + // Count failure + if err != nil { + failureMetric := TemporalRequestFailure + if longPoll { + failureMetric = TemporalLongRequestFailure + } + failureMetric += suffix + handler.Counter(failureMetric).Inc(1) + } +} diff --git a/internal/common/metrics/grpc_test.go b/internal/common/metrics/grpc_test.go new file mode 100644 index 000000000..a400fa4fc --- /dev/null +++ b/internal/common/metrics/grpc_test.go @@ -0,0 +1,93 @@ +// The MIT License +// +// Copyright (c) 2021 Temporal Technologies Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package metrics_test + +import ( + "context" + "net" + "testing" + "time" + + "github.com/stretchr/testify/require" + "go.temporal.io/sdk/internal/common/metrics" + "google.golang.org/grpc" + "google.golang.org/grpc/health" + "google.golang.org/grpc/health/grpc_health_v1" +) + +func TestGRPCInterceptor(t *testing.T) { + // Start a health gRPC server + l, err := net.Listen("tcp", "127.0.0.1:0") + require.NoError(t, err) + srv := grpc.NewServer() + healthServer := health.NewServer() + healthServer.SetServingStatus("myservice", grpc_health_v1.HealthCheckResponse_SERVING) + grpc_health_v1.RegisterHealthServer(srv, healthServer) + defer srv.Stop() + go func() { _ = srv.Serve(l) }() + time.Sleep(100 * time.Millisecond) + + // Create client with interceptor + handler := metrics.NewCapturingHandler() + cc, err := grpc.Dial(l.Addr().String(), + grpc.WithInsecure(), + grpc.WithUnaryInterceptor(metrics.NewGRPCInterceptor(handler, "_my_suffix"))) + require.NoError(t, err) + defer func() { _ = cc.Close() }() + client := grpc_health_v1.NewHealthClient(cc) + + // Make successful call + _, err = client.Check(context.Background(), &grpc_health_v1.HealthCheckRequest{Service: "myservice"}) + require.NoError(t, err) + + // Check counters and timers + counters := handler.Counters() + require.Len(t, counters, 1) + require.Equal(t, metrics.TemporalRequest+"_my_suffix", counters[0].Name) + require.Equal(t, map[string]string{metrics.OperationTagName: "Check"}, counters[0].Tags) + require.Equal(t, int64(1), counters[0].Value()) + timers := handler.Timers() + require.Len(t, timers, 1) + require.Equal(t, metrics.TemporalRequestLatency+"_my_suffix", timers[0].Name) + require.Equal(t, map[string]string{metrics.OperationTagName: "Check"}, timers[0].Tags) + require.Greater(t, timers[0].Value(), 0*time.Second) + + // Now clear the metrics and set a handler with tags and long poll on the + // context and make a known failing call + handler.Clear() + ctx := context.WithValue(context.Background(), metrics.HandlerContextKey{}, + handler.WithTags(map[string]string{"roottag": "roottagval"})) + ctx = context.WithValue(ctx, metrics.LongPollContextKey{}, true) + _, err = client.Check(ctx, &grpc_health_v1.HealthCheckRequest{Service: "unknown"}) + require.Error(t, err) + + // Check counters + counters = handler.Counters() + require.Len(t, counters, 2) + require.Equal(t, metrics.TemporalLongRequest+"_my_suffix", counters[0].Name) + require.Equal(t, map[string]string{metrics.OperationTagName: "Check", "roottag": "roottagval"}, counters[0].Tags) + require.Equal(t, int64(1), counters[0].Value()) + require.Equal(t, metrics.TemporalLongRequestFailure+"_my_suffix", counters[1].Name) + require.Equal(t, map[string]string{metrics.OperationTagName: "Check", "roottag": "roottagval"}, counters[1].Tags) + require.Equal(t, int64(1), counters[1].Value()) +} diff --git a/internal/common/metrics/handler.go b/internal/common/metrics/handler.go new file mode 100644 index 000000000..c2c3477d5 --- /dev/null +++ b/internal/common/metrics/handler.go @@ -0,0 +1,142 @@ +// The MIT License +// +// Copyright (c) 2021 Temporal Technologies Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package metrics + +import "time" + +// Handler is a handler for metrics emitted by the SDK. This interface is +// intentionally limited to only what the SDK needs to emit metrics and is not +// built to be a general purpose metrics abstraction for all uses. +// +// A common implementation is at +// go.temporal.io/sdk/contrib/tally.NewMetricsHandler. The NopHandler is a noop +// handler. A handler may implement "Unwrap() Handler" if it wraps a handler. +type Handler interface { + // WithTags returns a new handler with the given tags set for each metric + // created from it. + WithTags(map[string]string) Handler + + // Counter obtains a counter for the given name. + Counter(name string) Counter + + // Gauge obtains a gauge for the given name. + Gauge(name string) Gauge + + // Timer obtains a timer for the given name. + Timer(name string) Timer +} + +// Counter is an ever-increasing counter. +type Counter interface { + // Inc increments the counter value. + Inc(int64) +} + +// CounterFunc implements Counter with a single function. +type CounterFunc func(int64) + +// Inc implements Counter.Inc. +func (c CounterFunc) Inc(d int64) { c(d) } + +// Gauge can be set to any float. +type Gauge interface { + // Update updates the gauge value. + Update(float64) +} + +// GaugeFunc implements Gauge with a single function. +type GaugeFunc func(float64) + +// Update implements Gauge.Update. +func (g GaugeFunc) Update(d float64) { g(d) } + +// Timer records time durations. +type Timer interface { + // Record sets the timer value. + Record(time.Duration) +} + +// TimerFunc implements Timer with a single function. +type TimerFunc func(time.Duration) + +// Record implements Timer.Record. +func (t TimerFunc) Record(d time.Duration) { t(d) } + +// NopHandler is a noop handler that does nothing with the metrics. +var NopHandler Handler = nopHandler{} + +type nopHandler struct{} + +func (nopHandler) WithTags(map[string]string) Handler { return nopHandler{} } +func (nopHandler) Counter(string) Counter { return nopHandler{} } +func (nopHandler) Gauge(string) Gauge { return nopHandler{} } +func (nopHandler) Timer(string) Timer { return nopHandler{} } +func (nopHandler) Inc(int64) {} +func (nopHandler) Update(float64) {} +func (nopHandler) Record(time.Duration) {} + +type replayAwareHandler struct { + replay *bool + underlying Handler +} + +// NewReplayAwareHandler is a handler that will not record any metrics if the +// boolean pointed to by "replay" is true. +func NewReplayAwareHandler(replay *bool, underlying Handler) Handler { + return &replayAwareHandler{replay, underlying} +} + +func (r *replayAwareHandler) WithTags(tags map[string]string) Handler { + return NewReplayAwareHandler(r.replay, r.underlying.WithTags(tags)) +} + +func (r *replayAwareHandler) Counter(name string) Counter { + underlying := r.underlying.Counter(name) + return CounterFunc(func(d int64) { + if !*r.replay { + underlying.Inc(d) + } + }) +} + +func (r *replayAwareHandler) Gauge(name string) Gauge { + underlying := r.underlying.Gauge(name) + return GaugeFunc(func(d float64) { + if !*r.replay { + underlying.Update(d) + } + }) +} + +func (r *replayAwareHandler) Timer(name string) Timer { + underlying := r.underlying.Timer(name) + return TimerFunc(func(d time.Duration) { + if !*r.replay { + underlying.Record(d) + } + }) +} + +func (r *replayAwareHandler) Unwrap() Handler { + return r.underlying +} diff --git a/internal/common/metrics/handler_test.go b/internal/common/metrics/handler_test.go new file mode 100644 index 000000000..bd7c86a70 --- /dev/null +++ b/internal/common/metrics/handler_test.go @@ -0,0 +1,61 @@ +// The MIT License +// +// Copyright (c) 2021 Temporal Technologies Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package metrics_test + +import ( + "testing" + "time" + + "github.com/stretchr/testify/require" + "go.temporal.io/sdk/internal/common/metrics" +) + +func TestReplayAwareHandler(t *testing.T) { + var replaying bool + capture := metrics.NewCapturingHandler() + handler := metrics.NewReplayAwareHandler(&replaying, capture) + + // As replaying + replaying = true + handler.Counter("counter1").Inc(1) + handler.Gauge("gauge1").Update(2.0) + handler.Timer("timer1").Record(3 * time.Second) + require.Len(t, capture.Counters(), 1) + require.Equal(t, int64(0), capture.Counters()[0].Value()) + require.Len(t, capture.Gauges(), 1) + require.Equal(t, 0.0, capture.Gauges()[0].Value()) + require.Len(t, capture.Timers(), 1) + require.Equal(t, 0*time.Second, capture.Timers()[0].Value()) + + // As not replaying + replaying = false + handler.Counter("counter1").Inc(4) + handler.Gauge("gauge1").Update(5.0) + handler.Timer("timer1").Record(6 * time.Second) + require.Len(t, capture.Counters(), 1) + require.Equal(t, int64(4), capture.Counters()[0].Value()) + require.Len(t, capture.Gauges(), 1) + require.Equal(t, 5.0, capture.Gauges()[0].Value()) + require.Len(t, capture.Timers(), 1) + require.Equal(t, 6*time.Second, capture.Timers()[0].Value()) +} diff --git a/internal/common/metrics/interceptor.go b/internal/common/metrics/interceptor.go deleted file mode 100644 index 426a07d27..000000000 --- a/internal/common/metrics/interceptor.go +++ /dev/null @@ -1,51 +0,0 @@ -// The MIT License -// -// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved. -// -// Copyright (c) 2020 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package metrics - -import ( - "context" - - "github.com/uber-go/tally/v4" - "google.golang.org/grpc" -) - -// NewGRPCMetricsInterceptor creates new metrics scope interceptor. -func NewGRPCMetricsInterceptor(defaultScope tally.Scope, metricSuffix string) grpc.UnaryClientInterceptor { - return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { - scope, ok := ctx.Value(ScopeContextKey).(tally.Scope) - if !ok || scope == nil { - scope = defaultScope - } - isLongPoll, ok := ctx.Value(LongPollContextKey).(bool) - if !ok { - isLongPoll = false - } - rs := newRequestScope(scope, method, isLongPoll, metricSuffix) - rs.recordStart() - err := invoker(ctx, method, req, reply, cc, opts...) - rs.recordEnd(err) - return err - } -} diff --git a/internal/common/metrics/interceptor_test.go b/internal/common/metrics/interceptor_test.go deleted file mode 100644 index 3351609a5..000000000 --- a/internal/common/metrics/interceptor_test.go +++ /dev/null @@ -1,157 +0,0 @@ -// The MIT License -// -// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved. -// -// Copyright (c) 2020 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package metrics - -import ( - "context" - "io" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/uber-go/tally/v4" - "go.temporal.io/api/serviceerror" - "google.golang.org/grpc" -) - -func TestMetricsInterceptor(t *testing.T) { - assert := assert.New(t) - - isReplay := false - - testCases := []struct { - name string - grpcMethod string - err error - expectedMetricName string - expectedCounterNames []string - isLongPoll bool - }{ - { - name: "Success", - grpcMethod: "/workflowservice.WorkflowService/RegisterNamespace", - err: nil, - expectedMetricName: "RegisterNamespace", - expectedCounterNames: []string{TemporalRequest}, - }, - { - name: "GenericErrorLongPoll", - grpcMethod: "/workflowservice.WorkflowService/PollActivityTaskQueue", - err: serviceerror.NewInternal("internal error"), - expectedMetricName: "PollActivityTaskQueue", - expectedCounterNames: []string{TemporalLongRequest, TemporalLongRequestFailure}, - isLongPoll: true, - }, - { - name: "InvalidRequestError", - grpcMethod: "/workflowservice.WorkflowService/QueryWorkflow", - err: serviceerror.NewNotFound("not found"), - expectedMetricName: "QueryWorkflow", - expectedCounterNames: []string{TemporalRequest, TemporalRequestFailure}, - }, - } - - // Normal metrics scope. - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - t.Parallel() - scope, closer, reporter := NewMetricsScope(&isReplay) - interceptor := NewGRPCMetricsInterceptor(scope, "") - - invoker := func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, opts ...grpc.CallOption) error { - return tc.err - } - - ctx := context.WithValue(context.Background(), LongPollContextKey, tc.isLongPoll) - - err := interceptor(ctx, tc.grpcMethod, nil, nil, nil, invoker) - if tc.err == nil { - assert.NoError(err) - } else { - assert.Error(err) - } - - // Important: close before assert. - assert.NoError(closer.Close()) - assertMetrics(assert, reporter, tc.expectedCounterNames) - }) - } - - // Prometheus metrics scope - for _, tc := range testCases { - t.Run(tc.name+"_Prometheus", func(t *testing.T) { - t.Parallel() - scope, closer, reporter := newPrometheusScope(&isReplay) - interceptor := NewGRPCMetricsInterceptor(scope, "") - - invoker := func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, opts ...grpc.CallOption) error { - return tc.err - } - - err := interceptor(context.Background(), tc.grpcMethod, nil, nil, nil, invoker) - if tc.err == nil { - assert.NoError(err) - } else { - assert.Error(err) - } - - // Important: close before assert. - assert.NoError(closer.Close()) - assertPrometheusMetrics(assert, reporter, tc.expectedCounterNames) - }) - } - -} - -func assertMetrics(assert *assert.Assertions, reporter *CapturingStatsReporter, counterNames []string) { - assert.Equal(len(counterNames), len(reporter.counts)) - for _, counterName := range counterNames { - find := false - // counters are not in order - for _, counter := range reporter.counts { - if counterName == counter.name { - find = true - break - } - } - assert.True(find) - } - assert.Equal(1, len(reporter.timers)) - assert.Equal(TemporalRequestLatency, reporter.timers[0].name) -} - -func assertPrometheusMetrics(assert *assert.Assertions, reporter *CapturingStatsReporter, counterNames []string) { - assertMetrics(assert, reporter, counterNames) -} - -func newPrometheusScope(isReplay *bool) (tally.Scope, io.Closer, *CapturingStatsReporter) { - reporter := &CapturingStatsReporter{} - opts := tally.ScopeOptions{ - Reporter: reporter, - Separator: "_", - } - scope, closer := tally.NewRootScope(opts, time.Second) - return WrapScope(isReplay, scope, &realClock{}), closer, reporter -} diff --git a/internal/common/metrics/replay_aware.go b/internal/common/metrics/replay_aware.go deleted file mode 100644 index a7fc49043..000000000 --- a/internal/common/metrics/replay_aware.go +++ /dev/null @@ -1,192 +0,0 @@ -// The MIT License -// -// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved. -// -// Copyright (c) 2020 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package metrics - -import ( - "time" - - "github.com/uber-go/tally/v4" -) - -type ( - // Clock defines interface used as time source - Clock interface { - Now() time.Time - } - - durationRecorder interface { - RecordDuration(duration time.Duration) - } - - replayAwareScope struct { - isReplay *bool - scope tally.Scope - clock Clock - } - - replayAwareCounter struct { - isReplay *bool - counter tally.Counter - } - - replayAwareGauge struct { - isReplay *bool - gauge tally.Gauge - } - - replayAwareTimer struct { - isReplay *bool - timer tally.Timer - clock Clock - } - - replayAwareHistogram struct { - isReplay *bool - histogram tally.Histogram - clock Clock - } - - replayAwareStopwatchRecorder struct { - isReplay *bool - recorder durationRecorder - clock Clock - } -) - -// WrapScope wraps a scope and skip recording metrics when isReplay is true. -// This is designed to be used by only by workflowEnvironmentImpl so we suppress metrics while replaying history events. -// Parameter isReplay is a pointer to workflowEnvironmentImpl.isReplay which will be updated when replaying history events. -func WrapScope(isReplay *bool, scope tally.Scope, clock Clock) tally.Scope { - return &replayAwareScope{isReplay, scope, clock} -} - -// Inc increments the counter by a delta. -func (c *replayAwareCounter) Inc(delta int64) { - if *c.isReplay { - return - } - c.counter.Inc(delta) -} - -// Update sets the gauges absolute value. -func (g *replayAwareGauge) Update(value float64) { - if *g.isReplay { - return - } - g.gauge.Update(value) -} - -// Record a specific duration. -func (t *replayAwareTimer) Record(value time.Duration) { - if *t.isReplay { - return - } - t.timer.Record(value) -} - -// RecordDuration a specific duration. -func (t *replayAwareTimer) RecordDuration(duration time.Duration) { - t.Record(duration) -} - -// Start gives you back a specific point in time to report via Stop. -func (t *replayAwareTimer) Start() tally.Stopwatch { - return tally.NewStopwatch(t.clock.Now(), &replayAwareStopwatchRecorder{t.isReplay, t, t.clock}) -} - -// RecordValue records a specific value directly. Will use the configured value buckets for the histogram. -func (h *replayAwareHistogram) RecordValue(value float64) { - if *h.isReplay { - return - } - h.histogram.RecordValue(value) -} - -// RecordDuration records a specific duration directly. -// Will use the configured duration buckets for the histogram. -func (h *replayAwareHistogram) RecordDuration(value time.Duration) { - if *h.isReplay { - return - } - h.histogram.RecordDuration(value) -} - -// Start gives you a specific point in time to then record a duration. -// Will use the configured duration buckets for the histogram. -func (h *replayAwareHistogram) Start() tally.Stopwatch { - return tally.NewStopwatch(h.clock.Now(), &replayAwareStopwatchRecorder{h.isReplay, h, h.clock}) -} - -// RecordStopwatch is a recorder that is called when a stopwatch is stopped with Stop(). -func (r *replayAwareStopwatchRecorder) RecordStopwatch(stopwatchStart time.Time) { - if *r.isReplay { - return - } - d := r.clock.Now().Sub(stopwatchStart) - r.recorder.RecordDuration(d) -} - -// Counter returns the Counter object corresponding to the name. -func (s *replayAwareScope) Counter(name string) tally.Counter { - return &replayAwareCounter{s.isReplay, s.scope.Counter(name)} -} - -// Gauge returns the Gauge object corresponding to the name. -func (s *replayAwareScope) Gauge(name string) tally.Gauge { - return &replayAwareGauge{s.isReplay, s.scope.Gauge(name)} -} - -// Timer returns the Timer object corresponding to the name. -func (s *replayAwareScope) Timer(name string) tally.Timer { - return &replayAwareTimer{s.isReplay, s.scope.Timer(name), s.clock} -} - -// Histogram returns the Histogram object corresponding to the name. -// To use default value and duration buckets configured for the scope -// simply pass tally.DefaultBuckets or nil. -// You can use tally.ValueBuckets{x, y, ...} for value buckets. -// You can use tally.DurationBuckets{x, y, ...} for duration buckets. -// You can use tally.MustMakeLinearValueBuckets(start, width, count) for linear values. -// You can use tally.MustMakeLinearDurationBuckets(start, width, count) for linear durations. -// You can use tally.MustMakeExponentialValueBuckets(start, factor, count) for exponential values. -// You can use tally.MustMakeExponentialDurationBuckets(start, factor, count) for exponential durations. -func (s *replayAwareScope) Histogram(name string, buckets tally.Buckets) tally.Histogram { - return &replayAwareHistogram{s.isReplay, s.scope.Histogram(name, buckets), s.clock} -} - -// Tagged returns a new child scope with the given tags and current tags. -func (s *replayAwareScope) Tagged(tags map[string]string) tally.Scope { - return &replayAwareScope{s.isReplay, s.scope.Tagged(tags), s.clock} -} - -// SubScope returns a new child scope appending a further name prefix. -func (s *replayAwareScope) SubScope(name string) tally.Scope { - return &replayAwareScope{s.isReplay, s.scope.SubScope(name), s.clock} -} - -// Capabilities returns a description of metrics reporting capabilities. -func (s *replayAwareScope) Capabilities() tally.Capabilities { - return s.scope.Capabilities() -} diff --git a/internal/common/metrics/replay_aware_test.go b/internal/common/metrics/replay_aware_test.go deleted file mode 100644 index b23c0cbbb..000000000 --- a/internal/common/metrics/replay_aware_test.go +++ /dev/null @@ -1,233 +0,0 @@ -// The MIT License -// -// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved. -// -// Copyright (c) 2020 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package metrics - -import ( - "testing" - "time" - - "github.com/stretchr/testify/require" - "github.com/uber-go/tally/v4" -) - -func Test_Counter(t *testing.T) { - t.Parallel() - replayed, executed := withScope(t, func(scope tally.Scope) { - scope.Counter("test-name").Inc(3) - }) - require.Equal(t, 0, len(replayed.Counts())) - require.Equal(t, 1, len(executed.Counts())) - require.Equal(t, int64(3), executed.Counts()[0].Value()) -} - -func Test_Gauge(t *testing.T) { - t.Parallel() - replayed, executed := withScope(t, func(scope tally.Scope) { - scope.Gauge("test-name").Update(3) - }) - require.Equal(t, 0, len(replayed.Gauges())) - require.Equal(t, 1, len(executed.Gauges())) - require.Equal(t, float64(3), executed.Gauges()[0].Value()) -} - -func Test_Timer(t *testing.T) { - t.Parallel() - replayed, executed := withScope(t, func(scope tally.Scope) { - scope.Timer("test-name").Record(time.Second) - scope.Timer("test-stopwatch").Start().Stop() - }) - require.Equal(t, 0, len(replayed.Timers())) - require.Equal(t, 2, len(executed.Timers())) - require.Equal(t, time.Second, executed.Timers()[0].Value()) -} - -func Test_Histogram(t *testing.T) { - t.Parallel() - t.Run("values", func(t *testing.T) { - t.Parallel() - replayed, executed := withScope(t, func(scope tally.Scope) { - valueBuckets := tally.MustMakeLinearValueBuckets(0, 10, 10) - scope.Histogram("test-hist-1", valueBuckets).RecordValue(5) - scope.Histogram("test-hist-2", valueBuckets).RecordValue(15) - }) - require.Equal(t, 0, len(replayed.HistogramValueSamples())) - require.Equal(t, 2, len(executed.HistogramValueSamples())) - }) - t.Run("durations", func(t *testing.T) { - t.Parallel() - replayed, executed := withScope(t, func(scope tally.Scope) { - durationBuckets := tally.MustMakeLinearDurationBuckets(0, time.Hour, 10) - scope.Histogram("test-hist-1", durationBuckets).RecordDuration(time.Minute) - scope.Histogram("test-hist-2", durationBuckets).RecordDuration(time.Minute * 61) - scope.Histogram("test-hist-3", durationBuckets).Start().Stop() - }) - require.Equal(t, 0, len(replayed.HistogramDurationSamples())) - require.Equal(t, 3, len(executed.HistogramDurationSamples())) - }) -} - -func Test_ScopeCoverage(t *testing.T) { - isReplay := false - scope, closer, reporter := NewMetricsScope(&isReplay) - caps := scope.Capabilities() - require.Equal(t, true, caps.Reporting()) - require.Equal(t, true, caps.Tagging()) - subScope := scope.SubScope("test") - taggedScope := subScope.Tagged(make(map[string]string)) - taggedScope.Counter("test-counter").Inc(1) - _ = closer.Close() - require.Equal(t, 1, len(reporter.Counts())) -} - -// withScope runs your callback twice, once for "during replay" and once for "after replay" / "executing". -// stats are captured, and the results are returned for your validation. -func withScope(t *testing.T, cb func(scope tally.Scope)) (replayed *CapturingStatsReporter, executed *CapturingStatsReporter) { - replaying, executing := true, false - - replayingScope, replayingCloser, replayed := NewMetricsScope(&replaying) - executingScope, executingCloser, executed := NewMetricsScope(&executing) - - defer func() { - require.NoError(t, replayingCloser.Close()) - require.NoError(t, executingCloser.Close()) - }() - - cb(replayingScope) - cb(executingScope) - - return replayed, executed -} - -// capturingStatsReporter is a reporter used by tests to capture the metric so we can verify our tests. -type capturingStatsReporter struct { - counts []capturedCount - gauges []capturedGauge - timers []capturedTimer - histogramValueSamples []capturedHistogramValueSamples - histogramDurationSamples []capturedHistogramDurationSamples - capabilities int - flush int -} - -type capturedCount struct { - name string - tags map[string]string - value int64 -} - -type capturedGauge struct { - name string - tags map[string]string - value float64 -} - -type capturedTimer struct { - name string - tags map[string]string - value time.Duration -} - -type capturedHistogramValueSamples struct { - name string - tags map[string]string - bucketLowerBound float64 - bucketUpperBound float64 - samples int64 -} - -type capturedHistogramDurationSamples struct { - name string - tags map[string]string - bucketLowerBound time.Duration - bucketUpperBound time.Duration - samples int64 -} - -func (r *capturingStatsReporter) ReportCounter( - name string, - tags map[string]string, - value int64, -) { - r.counts = append(r.counts, capturedCount{name, tags, value}) -} - -func (r *capturingStatsReporter) ReportGauge( - name string, - tags map[string]string, - value float64, -) { - r.gauges = append(r.gauges, capturedGauge{name, tags, value}) -} - -func (r *capturingStatsReporter) ReportTimer( - name string, - tags map[string]string, - value time.Duration, -) { - r.timers = append(r.timers, capturedTimer{name, tags, value}) -} - -func (r *capturingStatsReporter) ReportHistogramValueSamples( - name string, - tags map[string]string, - _ tally.Buckets, - bucketLowerBound, - bucketUpperBound float64, - samples int64, -) { - elem := capturedHistogramValueSamples{name, tags, - bucketLowerBound, bucketUpperBound, samples} - r.histogramValueSamples = append(r.histogramValueSamples, elem) -} - -func (r *capturingStatsReporter) ReportHistogramDurationSamples( - name string, - tags map[string]string, - _ tally.Buckets, - bucketLowerBound, - bucketUpperBound time.Duration, - samples int64, -) { - elem := capturedHistogramDurationSamples{name, tags, - bucketLowerBound, bucketUpperBound, samples} - r.histogramDurationSamples = append(r.histogramDurationSamples, elem) -} - -func (r *capturingStatsReporter) Capabilities() tally.Capabilities { - r.capabilities++ - return r -} - -func (r *capturingStatsReporter) Reporting() bool { - return true -} - -func (r *capturingStatsReporter) Tagging() bool { - return true -} - -func (r *capturingStatsReporter) Flush() { - r.flush++ -} diff --git a/internal/common/metrics/request_scope.go b/internal/common/metrics/request_scope.go deleted file mode 100644 index ed431b5c2..000000000 --- a/internal/common/metrics/request_scope.go +++ /dev/null @@ -1,96 +0,0 @@ -// The MIT License -// -// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved. -// -// Copyright (c) 2020 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package metrics - -import ( - "strings" - "time" - - "github.com/uber-go/tally/v4" -) - -type ( - requestScope struct { - scope tally.Scope - startTime time.Time - isLongPoll bool - longPollRequestCountMetric string - requestCountMetric string - longPollRequestLatencyMetric string - requestLatencyMetric string - longPollRequestFailureMetric string - requestFailureMetric string - } -) - -// newRequestScope creates metric scope for a specified operation, defined by gRPC method string, isLongPoll flag and -// metric suffix. Suffix should be an empty string for individual calls and should have non-empty value for aggregated values. -func newRequestScope(scope tally.Scope, method string, isLongPoll bool, suffix string) *requestScope { - operation := ConvertMethodToScope(method) - subScope := getMetricsScopeForOperation(scope, operation) - - return &requestScope{ - scope: subScope, - startTime: time.Now(), - isLongPoll: isLongPoll, - longPollRequestCountMetric: TemporalLongRequest + suffix, - requestCountMetric: TemporalRequest + suffix, - longPollRequestLatencyMetric: TemporalLongRequestLatency + suffix, - requestLatencyMetric: TemporalRequestLatency + suffix, - longPollRequestFailureMetric: TemporalLongRequestFailure + suffix, - requestFailureMetric: TemporalRequestFailure + suffix, - } -} - -func (rs *requestScope) recordStart() { - if rs.isLongPoll { - rs.scope.Counter(rs.longPollRequestCountMetric).Inc(1) - } else { - rs.scope.Counter(rs.requestCountMetric).Inc(1) - } -} - -func (rs *requestScope) recordEnd(err error) { - if rs.isLongPoll { - rs.scope.Timer(rs.longPollRequestLatencyMetric).Record(time.Since(rs.startTime)) - } else { - rs.scope.Timer(rs.requestLatencyMetric).Record(time.Since(rs.startTime)) - } - - if err != nil { - if rs.isLongPoll { - rs.scope.Counter(rs.longPollRequestFailureMetric).Inc(1) - } else { - rs.scope.Counter(rs.requestFailureMetric).Inc(1) - } - } -} - -// ConvertMethodToScope extracts API name from the method string by truncating the prefix -func ConvertMethodToScope(method string) string { - // method is something like "/temporal.api.workflowservice.v1.WorkflowService/RegisterNamespace" - methodStart := strings.LastIndex(method, "/") + 1 - return method[methodStart:] -} diff --git a/internal/common/metrics/tagged_scope_test.go b/internal/common/metrics/tagged_scope_test.go deleted file mode 100644 index 54a5fd189..000000000 --- a/internal/common/metrics/tagged_scope_test.go +++ /dev/null @@ -1,87 +0,0 @@ -// The MIT License -// -// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved. -// -// Copyright (c) 2020 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package metrics - -import ( - "io" - "testing" - "time" - - "github.com/stretchr/testify/require" - "github.com/uber-go/tally/v4" -) - -func Test_TaggedScope(t *testing.T) { - scope, closer, reporter := NewTaggedMetricsScope() - taggedScope := TagScope(scope, "tag1", "val1") - taggedScope.Counter("test-name").Inc(3) - _ = closer.Close() - require.Equal(t, 1, len(reporter.Counts())) - require.Equal(t, int64(3), reporter.Counts()[0].Value()) - - scope, closer, reporter = NewTaggedMetricsScope() - taggedScope = TagScope(scope, "tag2", "val1") - taggedScope.Counter("test-name").Inc(2) - - taggedScope2 := TagScope(scope, "tag2", "val1") - taggedScope2.Counter("test-name").Inc(1) - _ = closer.Close() - require.Equal(t, 1, len(reporter.Counts())) - require.Equal(t, int64(3), reporter.Counts()[0].Value()) -} - -func Test_TaggedScope_WithMultiTags(t *testing.T) { - scope, closer, reporter := newTaggedMetricsScope() - taggedScope := TagScope(scope, "tag1", "val1", "tag2", "val2") - taggedScope.Counter("test-name").Inc(3) - _ = closer.Close() - require.Equal(t, 1, len(reporter.counts)) - require.Equal(t, int64(3), reporter.counts[0].value) - - scope, closer, reporter = newTaggedMetricsScope() - taggedScope = TagScope(scope, "tag2", "val1", "tag3", "val3") - taggedScope.Counter("test-name").Inc(2) - scope2 := TagScope(scope, "tag2", "val1", "tag3", "val3") - scope2.Counter("test-name").Inc(1) - _ = closer.Close() - require.Equal(t, 1, len(reporter.counts)) - require.Equal(t, int64(3), reporter.counts[0].value) - - //lint:ignore SA5012 We test exactly for this for this - require.Panics(t, func() { TagScope(scope, "tag") }) -} - -func newMetricsScope(isReplay *bool) (tally.Scope, io.Closer, *capturingStatsReporter) { - reporter := &capturingStatsReporter{} - opts := tally.ScopeOptions{Reporter: reporter} - scope, closer := tally.NewRootScope(opts, time.Second) - return WrapScope(isReplay, scope, &realClock{}), closer, reporter -} - -func newTaggedMetricsScope() (tally.Scope, io.Closer, *capturingStatsReporter) { - isReplay := false - scope, closer, reporter := newMetricsScope(&isReplay) - return scope, closer, reporter -} diff --git a/internal/common/metrics/tags.go b/internal/common/metrics/tags.go new file mode 100644 index 000000000..8446f9224 --- /dev/null +++ b/internal/common/metrics/tags.go @@ -0,0 +1,75 @@ +// The MIT License +// +// Copyright (c) 2021 Temporal Technologies Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package metrics + +// RootTags returns a set of base tags for all metrics. +func RootTags(namespace string) map[string]string { + return map[string]string{ + NamespaceTagName: namespace, + ClientTagName: ClientTagValue, + WorkerTypeTagName: NoneTagValue, + WorkflowTypeNameTagName: NoneTagValue, + ActivityTypeNameTagName: NoneTagValue, + TaskQueueTagName: NoneTagValue, + } +} + +// RPCTags returns a set of tags for RPC calls. +func RPCTags(workflowType, activityType, taskQueueName string) map[string]string { + return map[string]string{ + WorkflowTypeNameTagName: workflowType, + ActivityTypeNameTagName: activityType, + TaskQueueTagName: taskQueueName, + } +} + +// WorkflowTags returns a set of tags for workflows. +func WorkflowTags(workflowType string) map[string]string { + return map[string]string{ + WorkflowTypeNameTagName: workflowType, + } +} + +// ActivityTags returns a set of tags for activities. +func ActivityTags(workflowType, activityType, taskQueueName string) map[string]string { + return map[string]string{ + WorkflowTypeNameTagName: workflowType, + ActivityTypeNameTagName: activityType, + TaskQueueTagName: taskQueueName, + } +} + +// LocalActivityTags returns a set of tags for local activities. +func LocalActivityTags(workflowType, activityType string) map[string]string { + return map[string]string{ + WorkflowTypeNameTagName: workflowType, + ActivityTypeNameTagName: activityType, + } +} + +// WorkerTags returns a set of tags for workers. +func WorkerTags(workerType string) map[string]string { + return map[string]string{ + WorkerTypeTagName: workerType, + } +} diff --git a/internal/common/metrics/utils.go b/internal/common/metrics/utils.go deleted file mode 100644 index df1c85962..000000000 --- a/internal/common/metrics/utils.go +++ /dev/null @@ -1,90 +0,0 @@ -// The MIT License -// -// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved. -// -// Copyright (c) 2020 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package metrics - -import ( - "github.com/uber-go/tally/v4" -) - -// TagScope return a scope with one or multiple tags, -// input should be key value pairs like: tagScope(tag1, val1, tag2, val2). -func TagScope(metricsScope tally.Scope, keyValuePairs ...string) tally.Scope { - if metricsScope == nil { - metricsScope = tally.NoopScope - } - - if len(keyValuePairs)%2 != 0 { - panic("TagScope key value are not in pairs") - } - - tagsMap := map[string]string{} - for i := 0; i < len(keyValuePairs); i += 2 { - tagName := keyValuePairs[i] - tagValue := keyValuePairs[i+1] - tagsMap[tagName] = tagValue - } - - return metricsScope.Tagged(tagsMap) -} - -// GetRootScope return properly tagged tally scope with base tags included on all metric emitted by the client -func GetRootScope(ts tally.Scope, namespace string) tally.Scope { - // Include all tags on the root scope which are emitted by rpc calls to Temporal - return TagScope(ts, NamespaceTagName, namespace, ClientTagName, ClientTagValue, WorkerTypeTagName, NoneTagValue, - WorkflowTypeNameTagName, NoneTagValue, ActivityTypeNameTagName, NoneTagValue, TaskQueueTagName, NoneTagValue) -} - -// GetWorkerScope return properly tagged tally scope worker type tag -func GetWorkerScope(ts tally.Scope, workerType string) tally.Scope { - return TagScope(ts, WorkerTypeTagName, workerType) -} - -// GetMetricsScopeForActivity return properly tagged tally scope for activity -func GetMetricsScopeForActivity(ts tally.Scope, workflowType, activityType, taskQueueName string) tally.Scope { - return TagScope(ts, WorkflowTypeNameTagName, workflowType, ActivityTypeNameTagName, - activityType, TaskQueueTagName, taskQueueName) -} - -// GetMetricsScopeForLocalActivity return properly tagged tally scope for local activity -func GetMetricsScopeForLocalActivity(ts tally.Scope, workflowType, localActivityType string) tally.Scope { - return TagScope(ts, WorkflowTypeNameTagName, workflowType, ActivityTypeNameTagName, - localActivityType) -} - -// GetMetricsScopeForWorkflow return properly tagged tally scope for workflow execution -func GetMetricsScopeForWorkflow(ts tally.Scope, workflowType string) tally.Scope { - return TagScope(ts, WorkflowTypeNameTagName, workflowType) -} - -// GetMetricsScopeForRPC return properly tagged tally scope for workflow execution -func GetMetricsScopeForRPC(ts tally.Scope, workflowType, activityType, taskQueueName string) tally.Scope { - return TagScope(ts, WorkflowTypeNameTagName, workflowType, ActivityTypeNameTagName, - activityType, TaskQueueTagName, taskQueueName) -} - -// getMetricsScopeForOperation return properly tagged tally scope for rpc operation -func getMetricsScopeForOperation(ts tally.Scope, operation string) tally.Scope { - return TagScope(ts, OperationTagName, operation) -} diff --git a/internal/grpc_dialer.go b/internal/grpc_dialer.go index e933e08f1..8a7583f18 100644 --- a/internal/grpc_dialer.go +++ b/internal/grpc_dialer.go @@ -30,16 +30,14 @@ import ( "github.com/gogo/status" grpc_retry "github.com/grpc-ecosystem/go-grpc-middleware/retry" - "github.com/uber-go/tally/v4" "go.temporal.io/api/serviceerror" + "go.temporal.io/sdk/internal/common/metrics" "go.temporal.io/sdk/internal/common/retry" "google.golang.org/grpc" "google.golang.org/grpc/backoff" "google.golang.org/grpc/credentials" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" - - "go.temporal.io/sdk/internal/common/metrics" ) type ( @@ -128,18 +126,22 @@ func dial(params dialParameters) (*grpc.ClientConn, error) { return grpc.Dial(params.HostPort, opts...) } -func requiredInterceptors(metricScope tally.Scope, headersProvider HeadersProvider, controller TrafficController) []grpc.UnaryClientInterceptor { +func requiredInterceptors( + metricsHandler metrics.Handler, + headersProvider HeadersProvider, + controller TrafficController, +) []grpc.UnaryClientInterceptor { interceptors := []grpc.UnaryClientInterceptor{ errorInterceptor, // Report aggregated metrics for the call, this is done outside of the retry loop. - metrics.NewGRPCMetricsInterceptor(metricScope, ""), + metrics.NewGRPCInterceptor(metricsHandler, ""), // By default the grpc retry interceptor *is disabled*, preventing accidental use of retries. // We add call options for retry configuration based on the values present in the context. retry.NewRetryOptionsInterceptor(), // Performs retries *IF* retry options are set for the call. grpc_retry.UnaryClientInterceptor(), // Report metrics for every call made to the server. - metrics.NewGRPCMetricsInterceptor(metricScope, attemptSuffix), + metrics.NewGRPCInterceptor(metricsHandler, attemptSuffix), } if headersProvider != nil { interceptors = append(interceptors, headersProviderInterceptor(headersProvider)) diff --git a/internal/grpc_dialer_test.go b/internal/grpc_dialer_test.go index 5c176d7c5..0b5552011 100644 --- a/internal/grpc_dialer_test.go +++ b/internal/grpc_dialer_test.go @@ -31,6 +31,7 @@ import ( "net" "strings" "testing" + "time" "github.com/gogo/status" "github.com/pborman/uuid" @@ -187,6 +188,8 @@ func TestCustomResolver(t *testing.T) { s2, err := startAdditionalHostPortsGRPCServer() require.NoError(t, err) defer s2.Stop() + // Wait a bit to ensure they are serving + time.Sleep(100 * time.Millisecond) // Register resolver for both IPs and create client using it scheme := "test-resolve-" + uuid.New() diff --git a/internal/interceptor.go b/internal/interceptor.go index 483b04759..a4de314aa 100644 --- a/internal/interceptor.go +++ b/internal/interceptor.go @@ -26,9 +26,9 @@ import ( "context" "time" - "github.com/uber-go/tally/v4" commonpb "go.temporal.io/api/common/v1" "go.temporal.io/sdk/converter" + "go.temporal.io/sdk/internal/common/metrics" "go.temporal.io/sdk/log" ) @@ -83,8 +83,8 @@ type ActivityOutboundInterceptor interface { // GetLogger intercepts activity.GetLogger. GetLogger(ctx context.Context) log.Logger - // GetMetricsScope intercepts activity.GetMetricsScope. - GetMetricsScope(ctx context.Context) tally.Scope + // GetMetricsHandler intercepts activity.GetMetricsHandler. + GetMetricsHandler(ctx context.Context) metrics.Handler // RecordHeartbeat intercepts activity.RecordHeartbeat. RecordHeartbeat(ctx context.Context, details ...interface{}) @@ -167,8 +167,8 @@ type WorkflowOutboundInterceptor interface { // GetLogger intercepts workflow.GetLogger. GetLogger(ctx Context) log.Logger - // GetMetricsScope intercepts workflow.GetMetricsScope. - GetMetricsScope(ctx Context) tally.Scope + // GetMetricsHandler intercepts workflow.GetMetricsHandler. + GetMetricsHandler(ctx Context) metrics.Handler // Now intercepts workflow.Now. Now(ctx Context) time.Time diff --git a/internal/interceptor_base.go b/internal/interceptor_base.go index 3efd7b770..ae4498f1f 100644 --- a/internal/interceptor_base.go +++ b/internal/interceptor_base.go @@ -26,8 +26,8 @@ import ( "context" "time" - "github.com/uber-go/tally/v4" "go.temporal.io/sdk/converter" + "go.temporal.io/sdk/internal/common/metrics" "go.temporal.io/sdk/log" ) @@ -105,9 +105,9 @@ func (a *ActivityOutboundInterceptorBase) GetLogger(ctx context.Context) log.Log return a.Next.GetLogger(ctx) } -// GetMetricsScope implements ActivityOutboundInterceptor.GetMetricsScope. -func (a *ActivityOutboundInterceptorBase) GetMetricsScope(ctx context.Context) tally.Scope { - return a.Next.GetMetricsScope(ctx) +// GetMetricsHandler implements ActivityOutboundInterceptor.GetMetricsHandler. +func (a *ActivityOutboundInterceptorBase) GetMetricsHandler(ctx context.Context) metrics.Handler { + return a.Next.GetMetricsHandler(ctx) } // RecordHeartbeat implements ActivityOutboundInterceptor.RecordHeartbeat. @@ -213,9 +213,9 @@ func (w *WorkflowOutboundInterceptorBase) GetLogger(ctx Context) log.Logger { return w.Next.GetLogger(ctx) } -// GetMetricsScope implements WorkflowOutboundInterceptor.GetMetricsScope. -func (w *WorkflowOutboundInterceptorBase) GetMetricsScope(ctx Context) tally.Scope { - return w.Next.GetMetricsScope(ctx) +// GetMetricsHandler implements WorkflowOutboundInterceptor.GetMetricsHandler. +func (w *WorkflowOutboundInterceptorBase) GetMetricsHandler(ctx Context) metrics.Handler { + return w.Next.GetMetricsHandler(ctx) } // Now implements WorkflowOutboundInterceptor.Now. diff --git a/internal/interceptortest/proxy.go b/internal/interceptortest/proxy.go index e5bb00f6b..58b64965c 100644 --- a/internal/interceptortest/proxy.go +++ b/internal/interceptortest/proxy.go @@ -31,11 +31,11 @@ import ( "sync" "time" - "github.com/uber-go/tally/v4" "go.temporal.io/sdk/activity" "go.temporal.io/sdk/client" "go.temporal.io/sdk/converter" "go.temporal.io/sdk/interceptor" + "go.temporal.io/sdk/internal/common/metrics" "go.temporal.io/sdk/log" "go.temporal.io/sdk/workflow" ) @@ -225,8 +225,8 @@ func (p *proxyActivityOutbound) GetLogger(ctx context.Context) (ret log.Logger) return } -func (p *proxyActivityOutbound) GetMetricsScope(ctx context.Context) (ret tally.Scope) { - ret, _ = p.invoke(ctx)[0].Interface().(tally.Scope) +func (p *proxyActivityOutbound) GetMetricsHandler(ctx context.Context) (ret metrics.Handler) { + ret, _ = p.invoke(ctx)[0].Interface().(metrics.Handler) return } @@ -338,8 +338,8 @@ func (p *proxyWorkflowOutbound) GetLogger(ctx workflow.Context) (ret log.Logger) return } -func (p *proxyWorkflowOutbound) GetMetricsScope(ctx workflow.Context) (ret tally.Scope) { - ret, _ = p.invoke(ctx)[0].Interface().(tally.Scope) +func (p *proxyWorkflowOutbound) GetMetricsHandler(ctx workflow.Context) (ret metrics.Handler) { + ret, _ = p.invoke(ctx)[0].Interface().(metrics.Handler) return } diff --git a/internal/internal_activity.go b/internal/internal_activity.go index dbcc589ec..65e5a248f 100644 --- a/internal/internal_activity.go +++ b/internal/internal_activity.go @@ -33,10 +33,10 @@ import ( "reflect" "time" - "github.com/uber-go/tally/v4" commonpb "go.temporal.io/api/common/v1" "go.temporal.io/sdk/converter" + "go.temporal.io/sdk/internal/common/metrics" "go.temporal.io/sdk/log" ) @@ -127,7 +127,7 @@ type ( activityType ActivityType serviceInvoker ServiceInvoker logger log.Logger - metricsScope tally.Scope + metricsHandler metrics.Handler isLocalActivity bool heartbeatTimeout time.Duration deadline time.Time @@ -383,8 +383,8 @@ func (a *activityEnvironmentInterceptor) GetLogger(ctx context.Context) log.Logg return a.env.logger } -func (a *activityEnvironmentInterceptor) GetMetricsScope(ctx context.Context) tally.Scope { - return a.env.metricsScope +func (a *activityEnvironmentInterceptor) GetMetricsHandler(ctx context.Context) metrics.Handler { + return a.env.metricsHandler } func (a *activityEnvironmentInterceptor) RecordHeartbeat(ctx context.Context, details ...interface{}) { diff --git a/internal/internal_event_handlers.go b/internal/internal_event_handlers.go index 0ff6df1ed..85fda2072 100644 --- a/internal/internal_event_handlers.go +++ b/internal/internal_event_handlers.go @@ -34,14 +34,12 @@ import ( "time" "github.com/gogo/protobuf/proto" - "github.com/uber-go/tally/v4" commandpb "go.temporal.io/api/command/v1" commonpb "go.temporal.io/api/common/v1" enumspb "go.temporal.io/api/enums/v1" failurepb "go.temporal.io/api/failure/v1" historypb "go.temporal.io/api/history/v1" taskqueuepb "go.temporal.io/api/taskqueue/v1" - "go.temporal.io/sdk/converter" "go.temporal.io/sdk/internal/common" "go.temporal.io/sdk/internal/common/metrics" @@ -127,7 +125,7 @@ type ( isReplay bool // flag to indicate if workflow is in replay mode enableLoggingInReplay bool // flag to indicate if workflow should enable logging in replay mode - metricsScope tally.Scope + metricsHandler metrics.Handler registry *registry dataConverter converter.DataConverter contextPropagators []ContextPropagator @@ -172,7 +170,7 @@ func newWorkflowExecutionEventHandler( completeHandler completionHandler, logger log.Logger, enableLoggingInReplay bool, - scope tally.Scope, + metricsHandler metrics.Handler, registry *registry, dataConverter converter.DataConverter, contextPropagators []ContextPropagator, @@ -204,9 +202,9 @@ func newWorkflowExecutionEventHandler( &context.isReplay, &context.enableLoggingInReplay) - if scope != nil { - replayAwareScope := metrics.WrapScope(&context.isReplay, scope, context) - context.metricsScope = metrics.GetMetricsScopeForWorkflow(replayAwareScope, workflowInfo.WorkflowType.Name) + if metricsHandler != nil { + context.metricsHandler = metrics.NewReplayAwareHandler(&context.isReplay, metricsHandler). + WithTags(metrics.WorkflowTags(workflowInfo.WorkflowType.Name)) } return &workflowExecutionEventHandlerImpl{context, nil} @@ -428,8 +426,8 @@ func (wc *workflowEnvironmentImpl) GetLogger() log.Logger { return wc.logger } -func (wc *workflowEnvironmentImpl) GetMetricsScope() tally.Scope { - return wc.metricsScope +func (wc *workflowEnvironmentImpl) GetMetricsHandler() metrics.Handler { + return wc.metricsHandler } func (wc *workflowEnvironmentImpl) GetDataConverter() converter.DataConverter { @@ -769,7 +767,7 @@ func (weh *workflowExecutionEventHandlerImpl) ProcessEvent( } defer func() { if p := recover(); p != nil { - weh.metricsScope.Counter(metrics.WorkflowTaskExecutionFailureCounter).Inc(1) + weh.metricsHandler.Counter(metrics.WorkflowTaskExecutionFailureCounter).Inc(1) topLine := fmt.Sprintf("process event for %s [panic]:", weh.workflowInfo.TaskQueueName) st := getStackTraceRaw(topLine, 7, 0) weh.Complete(nil, newWorkflowPanicError(p, st)) diff --git a/internal/internal_task_handlers.go b/internal/internal_task_handlers.go index 245d4b2b2..cc8fa1059 100644 --- a/internal/internal_task_handlers.go +++ b/internal/internal_task_handlers.go @@ -38,7 +38,6 @@ import ( "github.com/gogo/protobuf/proto" "github.com/gogo/status" - "github.com/uber-go/tally/v4" commandpb "go.temporal.io/api/command/v1" commonpb "go.temporal.io/api/common/v1" enumspb "go.temporal.io/api/enums/v1" @@ -121,7 +120,7 @@ type ( // workflowTaskHandlerImpl is the implementation of WorkflowTaskHandler workflowTaskHandlerImpl struct { namespace string - metricsScope tally.Scope + metricsHandler metrics.Handler ppMgr pressurePointMgr logger log.Logger identity string @@ -142,7 +141,7 @@ type ( taskQueueName string identity string service workflowservice.WorkflowServiceClient - metricsScope tally.Scope + metricsHandler metrics.Handler logger log.Logger userContext context.Context registry *registry @@ -386,7 +385,7 @@ func newWorkflowTaskHandler(params workerExecutionParameters, ppMgr pressurePoin namespace: params.Namespace, logger: params.Logger, ppMgr: ppMgr, - metricsScope: params.MetricsScope, + metricsHandler: params.MetricsHandler, identity: params.Identity, enableLoggingInReplay: params.EnableLoggingInReplay, registry: registry, @@ -513,7 +512,7 @@ func (w *workflowExecutionContextImpl) createEventHandler() { w.completeWorkflow, w.wth.logger, w.wth.enableLoggingInReplay, - w.wth.metricsScope, + w.wth.metricsHandler, w.wth.registry, w.wth.dataConverter, w.wth.contextPropagators, @@ -586,12 +585,12 @@ func (wth *workflowTaskHandlerImpl) getOrCreateWorkflowContext( task *workflowservice.PollWorkflowTaskQueueResponse, historyIterator HistoryIterator, ) (workflowContext *workflowExecutionContextImpl, err error) { - workflowMetricsScope := metrics.GetMetricsScopeForWorkflow(wth.metricsScope, task.WorkflowType.GetName()) + metricsHandler := wth.metricsHandler.WithTags(metrics.WorkflowTags(task.WorkflowType.GetName())) defer func() { if err == nil && workflowContext != nil && workflowContext.laTunnel == nil { workflowContext.laTunnel = wth.laTunnel } - workflowMetricsScope.Gauge(metrics.StickyCacheSize).Update(float64(wth.cache.getWorkflowCache().Size())) + metricsHandler.Gauge(metrics.StickyCacheSize).Update(float64(wth.cache.getWorkflowCache().Size())) }() runID := task.WorkflowExecution.GetRunId() @@ -608,10 +607,10 @@ func (wth *workflowTaskHandlerImpl) getOrCreateWorkflowContext( workflowContext.Lock() if task.Query != nil && !isFullHistory { // query task and we have a valid cached state - workflowMetricsScope.Counter(metrics.StickyCacheHit).Inc(1) + metricsHandler.Counter(metrics.StickyCacheHit).Inc(1) } else if history.Events[0].GetEventId() == workflowContext.previousStartedEventID+1 { // non query task and we have a valid cached state - workflowMetricsScope.Counter(metrics.StickyCacheHit).Inc(1) + metricsHandler.Counter(metrics.StickyCacheHit).Inc(1) } else { // non query task and cached state is missing events, we need to discard the cached state and rebuild one. _ = workflowContext.ResetIfStale(task, historyIterator) @@ -620,7 +619,7 @@ func (wth *workflowTaskHandlerImpl) getOrCreateWorkflowContext( if !isFullHistory { // we are getting partial history task, but cached state was already evicted. // we need to reset history so we get events from beginning to replay/rebuild the state - workflowMetricsScope.Counter(metrics.StickyCacheMiss).Inc(1) + metricsHandler.Counter(metrics.StickyCacheMiss).Inc(1) if _, err = resetHistory(task, historyIterator); err != nil { return } @@ -813,9 +812,11 @@ func (w *workflowExecutionContextImpl) ProcessWorkflowTask(workflowTask *workflo var respondEvents []*historypb.HistoryEvent skipReplayCheck := w.skipReplayCheck() - workflowMetricsScope := metrics.GetMetricsScopeForWorkflow(w.wth.metricsScope, task.WorkflowType.GetName()) - replayStopWatch := workflowMetricsScope.Timer(metrics.WorkflowTaskReplayLatency).Start() - replayStopWatchStopped := false + + metricsHandler := w.wth.metricsHandler.WithTags(metrics.WorkflowTags(task.WorkflowType.GetName())) + start := time.Now() + // This is set to nil once recorded + metricsTimer := metricsHandler.Timer(metrics.WorkflowTaskReplayLatency) // Process events ProcessEvents: @@ -849,9 +850,9 @@ ProcessEvents: for i, event := range reorderedEvents { isInReplay := reorderedHistory.IsReplayEvent(event) - if !isInReplay && !replayStopWatchStopped { - replayStopWatch.Stop() - replayStopWatchStopped = true + if !isInReplay && metricsTimer != nil { + metricsTimer.Record(time.Since(start)) + metricsTimer = nil } isLast := !isInReplay && i == len(reorderedEvents)-1 @@ -900,8 +901,9 @@ ProcessEvents: } } - if !replayStopWatchStopped { - replayStopWatch.Stop() + if metricsTimer != nil { + metricsTimer.Record(time.Since(start)) + metricsTimer = nil } // Non-deterministic error could happen in 2 different places: @@ -1441,7 +1443,8 @@ func (wth *workflowTaskHandlerImpl) completeWorkflow( return queryCompletedRequest } - metricsScope := metrics.GetMetricsScopeForWorkflow(wth.metricsScope, eventHandler.workflowEnvironmentImpl.workflowInfo.WorkflowType.Name) + metricsHandler := wth.metricsHandler.WithTags(metrics.WorkflowTags( + eventHandler.workflowEnvironmentImpl.workflowInfo.WorkflowType.Name)) // complete workflow task var closeCommand *commandpb.Command @@ -1450,14 +1453,14 @@ func (wth *workflowTaskHandlerImpl) completeWorkflow( if errors.As(workflowContext.err, &canceledErr) { // Workflow canceled - metricsScope.Counter(metrics.WorkflowCanceledCounter).Inc(1) + metricsHandler.Counter(metrics.WorkflowCanceledCounter).Inc(1) closeCommand = createNewCommand(enumspb.COMMAND_TYPE_CANCEL_WORKFLOW_EXECUTION) closeCommand.Attributes = &commandpb.Command_CancelWorkflowExecutionCommandAttributes{CancelWorkflowExecutionCommandAttributes: &commandpb.CancelWorkflowExecutionCommandAttributes{ Details: convertErrDetailsToPayloads(canceledErr.details, wth.dataConverter), }} } else if errors.As(workflowContext.err, &contErr) { // Continue as new error. - metricsScope.Counter(metrics.WorkflowContinueAsNewCounter).Inc(1) + metricsHandler.Counter(metrics.WorkflowContinueAsNewCounter).Inc(1) closeCommand = createNewCommand(enumspb.COMMAND_TYPE_CONTINUE_AS_NEW_WORKFLOW_EXECUTION) closeCommand.Attributes = &commandpb.Command_ContinueAsNewWorkflowExecutionCommandAttributes{ContinueAsNewWorkflowExecutionCommandAttributes: &commandpb.ContinueAsNewWorkflowExecutionCommandAttributes{ WorkflowType: &commonpb.WorkflowType{Name: contErr.WorkflowType.Name}, @@ -1471,7 +1474,7 @@ func (wth *workflowTaskHandlerImpl) completeWorkflow( }} } else if workflowContext.err != nil { // Workflow failures - metricsScope.Counter(metrics.WorkflowFailedCounter).Inc(1) + metricsHandler.Counter(metrics.WorkflowFailedCounter).Inc(1) closeCommand = createNewCommand(enumspb.COMMAND_TYPE_FAIL_WORKFLOW_EXECUTION) failure := ConvertErrorToFailure(workflowContext.err, wth.dataConverter) closeCommand.Attributes = &commandpb.Command_FailWorkflowExecutionCommandAttributes{FailWorkflowExecutionCommandAttributes: &commandpb.FailWorkflowExecutionCommandAttributes{ @@ -1479,7 +1482,7 @@ func (wth *workflowTaskHandlerImpl) completeWorkflow( }} } else if workflowContext.isWorkflowCompleted { // Workflow completion - metricsScope.Counter(metrics.WorkflowCompletedCounter).Inc(1) + metricsHandler.Counter(metrics.WorkflowCompletedCounter).Inc(1) closeCommand = createNewCommand(enumspb.COMMAND_TYPE_COMPLETE_WORKFLOW_EXECUTION) closeCommand.Attributes = &commandpb.Command_CompleteWorkflowExecutionCommandAttributes{CompleteWorkflowExecutionCommandAttributes: &commandpb.CompleteWorkflowExecutionCommandAttributes{ Result: workflowContext.result, @@ -1489,7 +1492,7 @@ func (wth *workflowTaskHandlerImpl) completeWorkflow( if closeCommand != nil { commands = append(commands, closeCommand) elapsed := time.Since(workflowContext.workflowInfo.WorkflowStartTime) - metricsScope.Timer(metrics.WorkflowEndToEndLatency).Record(elapsed) + metricsHandler.Timer(metrics.WorkflowEndToEndLatency).Record(elapsed) forceNewWorkflowTask = false } @@ -1571,7 +1574,7 @@ func newActivityTaskHandlerWithCustomProvider( identity: params.Identity, service: service, logger: params.Logger, - metricsScope: params.MetricsScope, + metricsHandler: params.MetricsHandler, userContext: params.UserContext, registry: registry, activityProvider: activityProvider, @@ -1586,7 +1589,7 @@ type temporalInvoker struct { sync.Mutex identity string service workflowservice.WorkflowServiceClient - metricsScope tally.Scope + metricsHandler metrics.Handler taskToken []byte cancelHandler func() heartBeatTimeout time.Duration // The heart beat interval configured for this activity. @@ -1668,7 +1671,7 @@ func (i *temporalInvoker) internalHeartBeat(ctx context.Context, details *common ctx, cancel := context.WithTimeout(ctx, timeout) defer cancel() - err := recordActivityHeartbeat(ctx, i.service, i.metricsScope, i.identity, i.taskToken, details) + err := recordActivityHeartbeat(ctx, i.service, i.metricsHandler, i.identity, i.taskToken, details) switch err.(type) { case *CanceledError: @@ -1724,7 +1727,7 @@ func newServiceInvoker( taskToken []byte, identity string, service workflowservice.WorkflowServiceClient, - metricsScope tally.Scope, + metricsHandler metrics.Handler, cancelHandler func(), heartBeatTimeout time.Duration, workerStopChannel <-chan struct{}, @@ -1734,7 +1737,7 @@ func newServiceInvoker( taskToken: taskToken, identity: identity, service: service, - metricsScope: metricsScope, + metricsHandler: metricsHandler, cancelHandler: cancelHandler, heartBeatTimeout: heartBeatTimeout, closeCh: make(chan struct{}), @@ -1762,13 +1765,13 @@ func (ath *activityTaskHandlerImpl) Execute(taskQueue string, t *workflowservice defer cancel() invoker := newServiceInvoker( - t.TaskToken, ath.identity, ath.service, ath.metricsScope, cancel, common.DurationValue(t.GetHeartbeatTimeout()), + t.TaskToken, ath.identity, ath.service, ath.metricsHandler, cancel, common.DurationValue(t.GetHeartbeatTimeout()), ath.workerStopCh, ath.namespace) workflowType := t.WorkflowType.GetName() activityType := t.ActivityType.GetName() - activityMetricsScope := metrics.GetMetricsScopeForActivity(ath.metricsScope, workflowType, activityType, ath.taskQueueName) - ctx, err := WithActivityTask(canCtx, t, taskQueue, invoker, ath.logger, activityMetricsScope, + metricsHandler := ath.metricsHandler.WithTags(metrics.ActivityTags(workflowType, activityType, ath.taskQueueName)) + ctx, err := WithActivityTask(canCtx, t, taskQueue, invoker, ath.logger, metricsHandler, ath.dataConverter, ath.workerStopCh, ath.contextPropagators, ath.registry.interceptors) if err != nil { return nil, err @@ -1785,7 +1788,7 @@ func (ath *activityTaskHandlerImpl) Execute(taskQueue string, t *workflowservice if activityImplementation == nil { // In case if activity is not registered we should report a failure to the server to allow activity retry // instead of making it stuck on the same attempt. - activityMetricsScope.Counter(metrics.UnregisteredActivityInvocationCounter).Inc(1) + metricsHandler.Counter(metrics.UnregisteredActivityInvocationCounter).Inc(1) return convertActivityResultToRespondRequest(ath.identity, t.TaskToken, nil, NewActivityNotRegisteredError(activityType, ath.getRegisteredActivityNames()), ath.dataConverter, ath.namespace), nil @@ -1803,7 +1806,7 @@ func (ath *activityTaskHandlerImpl) Execute(taskQueue string, t *workflowservice tagAttempt, t.Attempt, tagPanicError, fmt.Sprintf("%v", p), tagPanicStack, st) - activityMetricsScope.Counter(metrics.ActivityTaskErrorCounter).Inc(1) + metricsHandler.Counter(metrics.ActivityTaskErrorCounter).Inc(1) panicErr := newPanicError(p, st) result = convertActivityResultToRespondRequest(ath.identity, t.TaskToken, nil, panicErr, ath.dataConverter, ath.namespace) @@ -1872,7 +1875,7 @@ func createNewCommand(commandType enumspb.CommandType) *commandpb.Command { } } -func recordActivityHeartbeat(ctx context.Context, service workflowservice.WorkflowServiceClient, metricsScope tally.Scope, +func recordActivityHeartbeat(ctx context.Context, service workflowservice.WorkflowServiceClient, metricsHandler metrics.Handler, identity string, taskToken []byte, details *commonpb.Payloads) error { namespace := getNamespaceFromActivityCtx(ctx) request := &workflowservice.RecordActivityTaskHeartbeatRequest{ @@ -1884,7 +1887,7 @@ func recordActivityHeartbeat(ctx context.Context, service workflowservice.Workfl var heartbeatResponse *workflowservice.RecordActivityTaskHeartbeatResponse grpcCtx, cancel := newGRPCContext(ctx, - grpcMetricsScope(metricsScope), + grpcMetricsHandler(metricsHandler), defaultGrpcRetryParameters(ctx)) defer cancel() @@ -1895,7 +1898,7 @@ func recordActivityHeartbeat(ctx context.Context, service workflowservice.Workfl return err } -func recordActivityHeartbeatByID(ctx context.Context, service workflowservice.WorkflowServiceClient, metricsScope tally.Scope, +func recordActivityHeartbeatByID(ctx context.Context, service workflowservice.WorkflowServiceClient, metricsHandler metrics.Handler, identity, namespace, workflowID, runID, activityID string, details *commonpb.Payloads) error { request := &workflowservice.RecordActivityTaskHeartbeatByIdRequest{ Namespace: namespace, @@ -1907,7 +1910,7 @@ func recordActivityHeartbeatByID(ctx context.Context, service workflowservice.Wo var heartbeatResponse *workflowservice.RecordActivityTaskHeartbeatByIdResponse grpcCtx, cancel := newGRPCContext(ctx, - grpcMetricsScope(metricsScope), + grpcMetricsHandler(metricsHandler), defaultGrpcRetryParameters(ctx)) defer cancel() diff --git a/internal/internal_task_handlers_test.go b/internal/internal_task_handlers_test.go index 31cf759b6..c2fcf1b4b 100644 --- a/internal/internal_task_handlers_test.go +++ b/internal/internal_task_handlers_test.go @@ -38,7 +38,6 @@ import ( "github.com/pborman/uuid" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "github.com/uber-go/tally/v4" commandpb "go.temporal.io/api/command/v1" commonpb "go.temporal.io/api/common/v1" enumspb "go.temporal.io/api/enums/v1" @@ -51,6 +50,7 @@ import ( "go.temporal.io/sdk/converter" "go.temporal.io/sdk/internal/common" + "go.temporal.io/sdk/internal/common/metrics" ilog "go.temporal.io/sdk/internal/log" "go.temporal.io/sdk/log" ) @@ -462,11 +462,12 @@ var testWorkflowTaskTaskqueue = "tq1" func (t *TaskHandlersTestSuite) getTestWorkerExecutionParams() workerExecutionParameters { cache := NewWorkerCache() return workerExecutionParameters{ - TaskQueue: testWorkflowTaskTaskqueue, - Namespace: testNamespace, - Identity: "test-id-1", - Logger: t.logger, - cache: cache, + TaskQueue: testWorkflowTaskTaskqueue, + Namespace: testNamespace, + Identity: "test-id-1", + MetricsHandler: metrics.NopHandler, + Logger: t.logger, + cache: cache, } } @@ -1395,7 +1396,7 @@ func (t *TaskHandlersTestSuite) TestHeartBeat_NilResponseWithError() { mockService.EXPECT().RecordActivityTaskHeartbeat(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, serviceerror.NewNotFound("")) temporalInvoker := newServiceInvoker( - nil, "Test_Temporal_Invoker", mockService, tally.NoopScope, func() {}, 0, + nil, "Test_Temporal_Invoker", mockService, metrics.NopHandler, func() {}, 0, make(chan struct{}), t.namespace) ctx, err := newActivityContext(context.Background(), nil, &activityEnvironment{serviceInvoker: temporalInvoker, logger: t.logger}) @@ -1416,7 +1417,7 @@ func (t *TaskHandlersTestSuite) TestHeartBeat_NilResponseWithNamespaceNotActiveE cancelHandler := func() { called = true } temporalInvoker := newServiceInvoker( - nil, "Test_Temporal_Invoker", mockService, tally.NoopScope, cancelHandler, + nil, "Test_Temporal_Invoker", mockService, metrics.NopHandler, cancelHandler, 0, make(chan struct{}), t.namespace) ctx, err := newActivityContext(context.Background(), nil, &activityEnvironment{serviceInvoker: temporalInvoker, logger: t.logger}) diff --git a/internal/internal_task_pollers.go b/internal/internal_task_pollers.go index 92bd2b455..0e37c5e11 100644 --- a/internal/internal_task_pollers.go +++ b/internal/internal_task_pollers.go @@ -35,7 +35,6 @@ import ( "github.com/gogo/protobuf/types" "github.com/pborman/uuid" - "github.com/uber-go/tally/v4" commonpb "go.temporal.io/api/common/v1" enumspb "go.temporal.io/api/enums/v1" historypb "go.temporal.io/api/history/v1" @@ -70,8 +69,8 @@ type ( // basePoller is the base class for all poller implementations basePoller struct { - metricsScope tally.Scope // base metric scope used for rpc calls - stopC <-chan struct{} + metricsHandler metrics.Handler // base metric handler used for rpc calls + stopC <-chan struct{} } // workflowTaskPoller implements polling/processing a workflow task @@ -108,14 +107,14 @@ type ( } historyIteratorImpl struct { - iteratorFunc func(nextPageToken []byte) (*historypb.History, []byte, error) - execution *commonpb.WorkflowExecution - nextPageToken []byte - namespace string - service workflowservice.WorkflowServiceClient - maxEventID int64 - metricsScope tally.Scope - taskQueue string + iteratorFunc func(nextPageToken []byte) (*historypb.History, []byte, error) + execution *commonpb.WorkflowExecution + nextPageToken []byte + namespace string + service workflowservice.WorkflowServiceClient + maxEventID int64 + metricsHandler metrics.Handler + taskQueue string } localActivityTaskPoller struct { @@ -127,7 +126,7 @@ type ( localActivityTaskHandler struct { userContext context.Context - metricsScope tally.Scope + metricsHandler metrics.Handler logger log.Logger dataConverter converter.DataConverter contextPropagators []ContextPropagator @@ -220,7 +219,7 @@ func (bp *basePoller) doPoll(pollFunc func(ctx context.Context) (interface{}, er // newWorkflowTaskPoller creates a new workflow task poller which must have a one to one relationship to workflow worker func newWorkflowTaskPoller(taskHandler WorkflowTaskHandler, service workflowservice.WorkflowServiceClient, params workerExecutionParameters) *workflowTaskPoller { return &workflowTaskPoller{ - basePoller: basePoller{metricsScope: params.MetricsScope, stopC: params.WorkerStopChannel}, + basePoller: basePoller{metricsHandler: params.MetricsHandler, stopC: params.WorkerStopChannel}, service: service, namespace: params.Namespace, taskQueueName: params.TaskQueue, @@ -324,7 +323,7 @@ func (wtp *workflowTaskPoller) processResetStickinessTask(rst *resetStickinessTa grpcCtx, cancel := newGRPCContext(context.Background()) defer cancel() // WorkflowType information is not available on reset sticky task. Emit using base scope. - wtp.metricsScope.Counter(metrics.StickyCacheTotalForcedEviction).Inc(1) + wtp.metricsHandler.Counter(metrics.StickyCacheTotalForcedEviction).Inc(1) if _, err := wtp.service.ResetStickyTaskQueue(grpcCtx, rst.task); err != nil { wtp.logger.Warn("ResetStickyTaskQueue failed", tagWorkflowID, rst.task.Execution.GetWorkflowId(), @@ -343,9 +342,9 @@ func (wtp *workflowTaskPoller) RespondTaskCompletedWithMetrics( startTime time.Time, ) (response *workflowservice.RespondWorkflowTaskCompletedResponse, err error) { - workflowMetricsScope := metrics.GetMetricsScopeForWorkflow(wtp.metricsScope, task.WorkflowType.GetName()) + metricsHandler := wtp.metricsHandler.WithTags(metrics.WorkflowTags(task.WorkflowType.GetName())) if taskErr != nil { - workflowMetricsScope.Counter(metrics.WorkflowTaskExecutionFailureCounter).Inc(1) + metricsHandler.Counter(metrics.WorkflowTaskExecutionFailureCounter).Inc(1) wtp.logger.Warn("Failed to process workflow task.", tagWorkflowType, task.WorkflowType.GetName(), tagWorkflowID, task.WorkflowExecution.GetWorkflowId(), @@ -356,7 +355,7 @@ func (wtp *workflowTaskPoller) RespondTaskCompletedWithMetrics( completedRequest = errorToFailWorkflowTask(task.TaskToken, taskErr, wtp.identity, wtp.dataConverter, wtp.namespace) } - workflowMetricsScope.Timer(metrics.WorkflowTaskExecutionLatency).Record(time.Since(startTime)) + metricsHandler.Timer(metrics.WorkflowTaskExecutionLatency).Record(time.Since(startTime)) response, err = wtp.RespondTaskCompleted(completedRequest, task) return @@ -365,9 +364,9 @@ func (wtp *workflowTaskPoller) RespondTaskCompletedWithMetrics( func (wtp *workflowTaskPoller) RespondTaskCompleted(completedRequest interface{}, task *workflowservice.PollWorkflowTaskQueueResponse) (response *workflowservice.RespondWorkflowTaskCompletedResponse, err error) { ctx := context.Background() // Respond task completion. - grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsScope( - metrics.GetMetricsScopeForRPC(wtp.metricsScope, task.GetWorkflowType().GetName(), - metrics.NoneTagValue, metrics.NoneTagValue)), + grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsHandler( + wtp.metricsHandler.WithTags(metrics.RPCTags(task.GetWorkflowType().GetName(), + metrics.NoneTagValue, metrics.NoneTagValue))), defaultGrpcRetryParameters(ctx)) defer cancel() switch request := completedRequest.(type) { @@ -419,14 +418,14 @@ func newLocalActivityPoller( ) *localActivityTaskPoller { handler := &localActivityTaskHandler{ userContext: params.UserContext, - metricsScope: params.MetricsScope, + metricsHandler: params.MetricsHandler, logger: params.Logger, dataConverter: params.DataConverter, contextPropagators: params.ContextPropagators, interceptors: interceptors, } return &localActivityTaskPoller{ - basePoller: basePoller{metricsScope: params.MetricsScope, stopC: params.WorkerStopChannel}, + basePoller: basePoller{metricsHandler: params.MetricsHandler, stopC: params.WorkerStopChannel}, handler: handler, logger: params.Logger, laTunnel: laTunnel, @@ -459,9 +458,9 @@ func (latp *localActivityTaskPoller) ProcessTask(task interface{}) error { func (lath *localActivityTaskHandler) executeLocalActivityTask(task *localActivityTask) (result *localActivityResult) { workflowType := task.params.WorkflowInfo.WorkflowType.Name activityType := task.params.ActivityType - activityMetricsScope := metrics.GetMetricsScopeForLocalActivity(lath.metricsScope, workflowType, activityType) + metricsHandler := lath.metricsHandler.WithTags(metrics.LocalActivityTags(workflowType, activityType)) - activityMetricsScope.Counter(metrics.LocalActivityTotalCounter).Inc(1) + metricsHandler.Counter(metrics.LocalActivityTotalCounter).Inc(1) ae := activityExecutor{name: activityType, fn: task.params.ActivityFn} traceLog(func() { @@ -472,7 +471,7 @@ func (lath *localActivityTaskHandler) executeLocalActivityTask(task *localActivi tagAttempt, task.attempt, ) }) - ctx, err := WithLocalActivityTask(lath.userContext, task, lath.logger, lath.metricsScope, + ctx, err := WithLocalActivityTask(lath.userContext, task, lath.logger, lath.metricsHandler, lath.dataConverter, lath.interceptors) if err != nil { return &localActivityResult{task: task, err: fmt.Errorf("failed building context: %w", err)} @@ -524,17 +523,17 @@ func (lath *localActivityTaskHandler) executeLocalActivityTask(task *localActivi tagAttempt, task.attempt, tagPanicError, fmt.Sprintf("%v", p), tagPanicStack, st) - activityMetricsScope.Counter(metrics.LocalActivityErrorCounter).Inc(1) + metricsHandler.Counter(metrics.LocalActivityErrorCounter).Inc(1) err = newPanicError(p, st) } if err != nil { - activityMetricsScope.Counter(metrics.LocalActivityFailedCounter).Inc(1) + metricsHandler.Counter(metrics.LocalActivityFailedCounter).Inc(1) } }() laResult, err = ae.ExecuteWithActualArgs(ctx, task.params.InputArgs) executionLatency := time.Since(laStartTime) - activityMetricsScope.Timer(metrics.LocalActivityExecutionLatency).Record(executionLatency) + metricsHandler.Timer(metrics.LocalActivityExecutionLatency).Record(executionLatency) if executionLatency > timeoutDuration { // If local activity takes longer than expected timeout, the context would already be DeadlineExceeded and // the result would be discarded. Print a warning in this case. @@ -558,7 +557,7 @@ WaitResult: // context is done if ctx.Err() == context.Canceled { - activityMetricsScope.Counter(metrics.LocalActivityCanceledCounter).Inc(1) + metricsHandler.Counter(metrics.LocalActivityCanceledCounter).Inc(1) return &localActivityResult{err: ErrCanceled, task: task} } else if ctx.Err() == context.DeadlineExceeded { return &localActivityResult{err: ErrDeadlineExceeded, task: task} @@ -571,7 +570,7 @@ WaitResult: } if err == nil { - activityMetricsScope. + metricsHandler. Timer(metrics.LocalActivitySucceedEndToEndLatency). Record(time.Since(task.params.ScheduledTime)) } @@ -653,7 +652,7 @@ func (wtp *workflowTaskPoller) poll(ctx context.Context) (interface{}, error) { if response == nil || len(response.TaskToken) == 0 { // Emit using base scope as no workflow type information is available in the case of empty poll - wtp.metricsScope.Counter(metrics.WorkflowTaskQueuePollEmptyCounter).Inc(1) + wtp.metricsHandler.Counter(metrics.WorkflowTaskQueuePollEmptyCounter).Inc(1) wtp.updateBacklog(request.TaskQueue.GetKind(), 0) return &workflowTask{}, nil } @@ -673,23 +672,23 @@ func (wtp *workflowTaskPoller) poll(ctx context.Context) (interface{}, error) { "IsQueryTask", response.Query != nil) }) - workflowMetricsScope := metrics.GetMetricsScopeForWorkflow(wtp.metricsScope, response.WorkflowType.GetName()) - workflowMetricsScope.Counter(metrics.WorkflowTaskQueuePollSucceedCounter).Inc(1) + metricsHandler := wtp.metricsHandler.WithTags(metrics.WorkflowTags(response.WorkflowType.GetName())) + metricsHandler.Counter(metrics.WorkflowTaskQueuePollSucceedCounter).Inc(1) scheduleToStartLatency := common.TimeValue(response.GetStartedTime()).Sub(common.TimeValue(response.GetScheduledTime())) - workflowMetricsScope.Timer(metrics.WorkflowTaskScheduleToStartLatency).Record(scheduleToStartLatency) + metricsHandler.Timer(metrics.WorkflowTaskScheduleToStartLatency).Record(scheduleToStartLatency) return task, nil } func (wtp *workflowTaskPoller) toWorkflowTask(response *workflowservice.PollWorkflowTaskQueueResponse) *workflowTask { historyIterator := &historyIteratorImpl{ - execution: response.WorkflowExecution, - nextPageToken: response.NextPageToken, - namespace: wtp.namespace, - service: wtp.service, - maxEventID: response.GetStartedEventId(), - metricsScope: wtp.metricsScope, - taskQueue: wtp.taskQueueName, + execution: response.WorkflowExecution, + nextPageToken: response.NextPageToken, + namespace: wtp.namespace, + service: wtp.service, + maxEventID: response.GetStartedEventId(), + metricsHandler: wtp.metricsHandler, + taskQueue: wtp.taskQueueName, } task := &workflowTask{ task: response, @@ -706,7 +705,7 @@ func (h *historyIteratorImpl) GetNextPage() (*historypb.History, error) { h.namespace, h.execution, h.maxEventID, - h.metricsScope, + h.metricsHandler, h.taskQueue, ) } @@ -733,13 +732,13 @@ func newGetHistoryPageFunc( namespace string, execution *commonpb.WorkflowExecution, atWorkflowTaskCompletedEventID int64, - metricsScope tally.Scope, + metricsHandler metrics.Handler, taskQueue string, ) func(nextPageToken []byte) (*historypb.History, []byte, error) { return func(nextPageToken []byte) (*historypb.History, []byte, error) { var resp *workflowservice.GetWorkflowExecutionHistoryResponse - grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsScope( - metrics.GetMetricsScopeForRPC(metricsScope, metrics.NoneTagValue, metrics.NoneTagValue, taskQueue)), + grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsHandler( + metricsHandler.WithTags(metrics.RPCTags(metrics.NoneTagValue, metrics.NoneTagValue, taskQueue))), defaultGrpcRetryParameters(ctx)) defer cancel() @@ -780,7 +779,7 @@ func newGetHistoryPageFunc( func newActivityTaskPoller(taskHandler ActivityTaskHandler, service workflowservice.WorkflowServiceClient, params workerExecutionParameters) *activityTaskPoller { return &activityTaskPoller{ - basePoller: basePoller{metricsScope: params.MetricsScope, stopC: params.WorkerStopChannel}, + basePoller: basePoller{metricsHandler: params.MetricsHandler, stopC: params.WorkerStopChannel}, taskHandler: taskHandler, service: service, namespace: params.Namespace, @@ -811,16 +810,16 @@ func (atp *activityTaskPoller) poll(ctx context.Context) (interface{}, error) { } if response == nil || len(response.TaskToken) == 0 { // No activity info is available on empty poll. Emit using base scope. - atp.metricsScope.Counter(metrics.ActivityPollNoTaskCounter).Inc(1) + atp.metricsHandler.Counter(metrics.ActivityPollNoTaskCounter).Inc(1) return &activityTask{}, nil } workflowType := response.WorkflowType.GetName() activityType := response.ActivityType.GetName() - activityMetricsScope := metrics.GetMetricsScopeForActivity(atp.metricsScope, workflowType, activityType, atp.taskQueueName) + metricsHandler := atp.metricsHandler.WithTags(metrics.ActivityTags(workflowType, activityType, atp.taskQueueName)) scheduleToStartLatency := common.TimeValue(response.GetStartedTime()).Sub(common.TimeValue(response.GetCurrentAttemptScheduledTime())) - activityMetricsScope.Timer(metrics.ActivityScheduleToStartLatency).Record(scheduleToStartLatency) + metricsHandler.Timer(metrics.ActivityScheduleToStartLatency).Record(scheduleToStartLatency) return &activityTask{task: response, pollStartTime: startTime}, nil } @@ -852,28 +851,28 @@ func (atp *activityTaskPoller) ProcessTask(task interface{}) error { workflowType := activityTask.task.WorkflowType.GetName() activityType := activityTask.task.ActivityType.GetName() - activityMetricsScope := metrics.GetMetricsScopeForActivity(atp.metricsScope, workflowType, activityType, atp.taskQueueName) + activityMetricsHandler := atp.metricsHandler.WithTags(metrics.ActivityTags(workflowType, activityType, atp.taskQueueName)) executionStartTime := time.Now() // Process the activity task. request, err := atp.taskHandler.Execute(atp.taskQueueName, activityTask.task) // err is returned in case of internal failure, such as unable to propagate context or context timeout. if err != nil { - activityMetricsScope.Counter(metrics.ActivityExecutionFailedCounter).Inc(1) + activityMetricsHandler.Counter(metrics.ActivityExecutionFailedCounter).Inc(1) return err } // in case if activity execution failed, request should be of type RespondActivityTaskFailedRequest if _, ok := request.(*workflowservice.RespondActivityTaskFailedRequest); ok { - activityMetricsScope.Counter(metrics.ActivityExecutionFailedCounter).Inc(1) + activityMetricsHandler.Counter(metrics.ActivityExecutionFailedCounter).Inc(1) } - activityMetricsScope.Timer(metrics.ActivityExecutionLatency).Record(time.Since(executionStartTime)) + activityMetricsHandler.Timer(metrics.ActivityExecutionLatency).Record(time.Since(executionStartTime)) if request == ErrActivityResultPending { return nil } - rpcScope := metrics.GetMetricsScopeForRPC(atp.metricsScope, workflowType, activityType, metrics.NoneTagValue) - reportErr := reportActivityComplete(context.Background(), atp.service, request, rpcScope) + rpcMetricsHandler := atp.metricsHandler.WithTags(metrics.RPCTags(workflowType, activityType, metrics.NoneTagValue)) + reportErr := reportActivityComplete(context.Background(), atp.service, request, rpcMetricsHandler) if reportErr != nil { traceLog(func() { atp.logger.Debug("reportActivityComplete failed", tagError, reportErr) @@ -881,13 +880,18 @@ func (atp *activityTaskPoller) ProcessTask(task interface{}) error { return reportErr } - activityMetricsScope. + activityMetricsHandler. Timer(metrics.ActivitySucceedEndToEndLatency). Record(time.Since(common.TimeValue(activityTask.task.GetScheduledTime()))) return nil } -func reportActivityComplete(ctx context.Context, service workflowservice.WorkflowServiceClient, request interface{}, rpcScope tally.Scope) error { +func reportActivityComplete( + ctx context.Context, + service workflowservice.WorkflowServiceClient, + request interface{}, + rpcMetricsHandler metrics.Handler, +) error { if request == nil { // nothing to report return nil @@ -896,18 +900,18 @@ func reportActivityComplete(ctx context.Context, service workflowservice.Workflo var reportErr error switch request := request.(type) { case *workflowservice.RespondActivityTaskCanceledRequest: - grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsScope(rpcScope), + grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsHandler(rpcMetricsHandler), defaultGrpcRetryParameters(ctx)) defer cancel() _, err := service.RespondActivityTaskCanceled(grpcCtx, request) reportErr = err case *workflowservice.RespondActivityTaskFailedRequest: - grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsScope(rpcScope), defaultGrpcRetryParameters(ctx)) + grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsHandler(rpcMetricsHandler), defaultGrpcRetryParameters(ctx)) defer cancel() _, err := service.RespondActivityTaskFailed(grpcCtx, request) reportErr = err case *workflowservice.RespondActivityTaskCompletedRequest: - grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsScope(rpcScope), + grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsHandler(rpcMetricsHandler), defaultGrpcRetryParameters(ctx)) defer cancel() _, err := service.RespondActivityTaskCompleted(grpcCtx, request) @@ -916,7 +920,12 @@ func reportActivityComplete(ctx context.Context, service workflowservice.Workflo return reportErr } -func reportActivityCompleteByID(ctx context.Context, service workflowservice.WorkflowServiceClient, request interface{}, rpcScope tally.Scope) error { +func reportActivityCompleteByID( + ctx context.Context, + service workflowservice.WorkflowServiceClient, + request interface{}, + rpcMetricsHandler metrics.Handler, +) error { if request == nil { // nothing to report return nil @@ -925,19 +934,19 @@ func reportActivityCompleteByID(ctx context.Context, service workflowservice.Wor var reportErr error switch request := request.(type) { case *workflowservice.RespondActivityTaskCanceledByIdRequest: - grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsScope(rpcScope), + grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsHandler(rpcMetricsHandler), defaultGrpcRetryParameters(ctx)) defer cancel() _, err := service.RespondActivityTaskCanceledById(grpcCtx, request) reportErr = err case *workflowservice.RespondActivityTaskFailedByIdRequest: - grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsScope(rpcScope), + grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsHandler(rpcMetricsHandler), defaultGrpcRetryParameters(ctx)) defer cancel() _, err := service.RespondActivityTaskFailedById(grpcCtx, request) reportErr = err case *workflowservice.RespondActivityTaskCompletedByIdRequest: - grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsScope(rpcScope), + grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsHandler(rpcMetricsHandler), defaultGrpcRetryParameters(ctx)) defer cancel() _, err := service.RespondActivityTaskCompletedById(grpcCtx, request) diff --git a/internal/internal_utils.go b/internal/internal_utils.go index 2a80236e6..15bff4857 100644 --- a/internal/internal_utils.go +++ b/internal/internal_utils.go @@ -35,11 +35,9 @@ import ( "syscall" "time" - "github.com/uber-go/tally/v4" + "go.temporal.io/sdk/internal/common/metrics" "go.temporal.io/sdk/internal/common/retry" "google.golang.org/grpc/metadata" - - "go.temporal.io/sdk/internal/common/metrics" ) const ( @@ -66,7 +64,7 @@ type grpcContextBuilder struct { // - context fields, accessible via `ctx.Value(key)` ParentContext context.Context - MetricsScope tally.Scope + MetricsHandler metrics.Handler Headers metadata.MD @@ -81,10 +79,10 @@ func (cb *grpcContextBuilder) Build() (context.Context, context.CancelFunc) { if cb.Headers != nil { ctx = metadata.NewOutgoingContext(ctx, cb.Headers) } - if cb.MetricsScope != nil { - ctx = context.WithValue(ctx, metrics.ScopeContextKey, cb.MetricsScope) + if cb.MetricsHandler != nil { + ctx = context.WithValue(ctx, metrics.HandlerContextKey{}, cb.MetricsHandler) } - ctx = context.WithValue(ctx, metrics.LongPollContextKey, cb.IsLongPoll) + ctx = context.WithValue(ctx, metrics.LongPollContextKey{}, cb.IsLongPoll) var cancel context.CancelFunc if cb.Timeout != time.Duration(0) { ctx, cancel = context.WithTimeout(ctx, cb.Timeout) @@ -99,9 +97,9 @@ func grpcTimeout(timeout time.Duration) func(builder *grpcContextBuilder) { } } -func grpcMetricsScope(metricsScope tally.Scope) func(builder *grpcContextBuilder) { +func grpcMetricsHandler(metricsHandler metrics.Handler) func(builder *grpcContextBuilder) { return func(b *grpcContextBuilder) { - b.MetricsScope = metricsScope + b.MetricsHandler = metricsHandler } } diff --git a/internal/internal_worker.go b/internal/internal_worker.go index 9cd445cea..8a27e8ebc 100644 --- a/internal/internal_worker.go +++ b/internal/internal_worker.go @@ -46,7 +46,6 @@ import ( "github.com/gogo/protobuf/proto" "github.com/golang/mock/gomock" "github.com/pborman/uuid" - "github.com/uber-go/tally/v4" commonpb "go.temporal.io/api/common/v1" enumspb "go.temporal.io/api/enums/v1" historypb "go.temporal.io/api/history/v1" @@ -54,6 +53,7 @@ import ( "go.temporal.io/api/workflowservicemock/v1" "go.temporal.io/sdk/converter" + "go.temporal.io/sdk/internal/common/metrics" "go.temporal.io/sdk/internal/common/serializer" "go.temporal.io/sdk/internal/common/util" ilog "go.temporal.io/sdk/internal/log" @@ -163,7 +163,7 @@ type ( // a default option. Identity string - MetricsScope tally.Scope + MetricsHandler metrics.Handler Logger log.Logger @@ -221,9 +221,9 @@ func ensureRequiredParams(params *workerExecutionParameters) { params.Logger = ilog.NewDefaultLogger() params.Logger.Info("No logger configured for temporal worker. Created default one.") } - if params.MetricsScope == nil { - params.MetricsScope = tally.NoopScope - params.Logger.Info("No metrics scope configured for temporal worker. Use NoopScope as default.") + if params.MetricsHandler == nil { + params.MetricsHandler = metrics.NopHandler + params.Logger.Info("No metrics handler configured for temporal worker. Use NopHandler as default.") } if params.DataConverter == nil { params.DataConverter = converter.GetDefaultDataConverter() @@ -232,12 +232,17 @@ func ensureRequiredParams(params *workerExecutionParameters) { } // verifyNamespaceExist does a DescribeNamespace operation on the specified namespace with backoff/retry -func verifyNamespaceExist(client workflowservice.WorkflowServiceClient, metricsScope tally.Scope, namespace string, logger log.Logger) error { +func verifyNamespaceExist( + client workflowservice.WorkflowServiceClient, + metricsHandler metrics.Handler, + namespace string, + logger log.Logger, +) error { ctx := context.Background() if namespace == "" { return errors.New("namespace cannot be empty") } - grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsScope(metricsScope), defaultGrpcRetryParameters(ctx)) + grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsHandler(metricsHandler), defaultGrpcRetryParameters(ctx)) defer cancel() _, err := client.DescribeNamespace(grpcCtx, &workflowservice.DescribeNamespaceRequest{Namespace: namespace}) return err @@ -276,7 +281,7 @@ func newWorkflowTaskWorkerInternal( workerType: "WorkflowWorker", stopTimeout: params.WorkerStopTimeout}, params.Logger, - params.MetricsScope, + params.MetricsHandler, nil, ) @@ -299,7 +304,7 @@ func newWorkflowTaskWorkerInternal( workerType: "LocalActivityWorker", stopTimeout: params.WorkerStopTimeout}, params.Logger, - params.MetricsScope, + params.MetricsHandler, nil, ) @@ -319,7 +324,7 @@ func newWorkflowTaskWorkerInternal( // Start the worker. func (ww *workflowWorker) Start() error { - err := verifyNamespaceExist(ww.workflowService, ww.executionParameters.MetricsScope, ww.executionParameters.Namespace, ww.worker.logger) + err := verifyNamespaceExist(ww.workflowService, ww.executionParameters.MetricsHandler, ww.executionParameters.Namespace, ww.worker.logger) if err != nil { return err } @@ -412,7 +417,7 @@ func newActivityTaskWorker(taskHandler ActivityTaskHandler, service workflowserv stopTimeout: workerParams.WorkerStopTimeout, userContextCancel: workerParams.UserContextCancel}, workerParams.Logger, - workerParams.MetricsScope, + workerParams.MetricsHandler, sessionTokenBucket, ) @@ -428,7 +433,7 @@ func newActivityTaskWorker(taskHandler ActivityTaskHandler, service workflowserv // Start the worker. func (aw *activityWorker) Start() error { - err := verifyNamespaceExist(aw.workflowService, aw.executionParameters.MetricsScope, aw.executionParameters.Namespace, aw.worker.logger) + err := verifyNamespaceExist(aw.workflowService, aw.executionParameters.MetricsHandler, aw.executionParameters.Namespace, aw.worker.logger) if err != nil { return err } @@ -1158,7 +1163,6 @@ func (aw *WorkflowReplayer) replayWorkflowHistory(logger log.Logger, service wor namespace: ReplayNamespace, service: service, maxEventID: task.GetStartedEventId(), - metricsScope: nil, taskQueue: taskQueue, } cache := NewWorkerCache() @@ -1265,7 +1269,7 @@ func NewAggregatedWorker(client *WorkflowClient, taskQueue string, options Worke ConcurrentWorkflowTaskExecutionSize: options.MaxConcurrentWorkflowTaskExecutionSize, MaxConcurrentWorkflowTaskQueuePollers: options.MaxConcurrentWorkflowTaskPollers, Identity: client.identity, - MetricsScope: client.metricsScope, + MetricsHandler: client.metricsHandler, Logger: client.logger, EnableLoggingInReplay: options.EnableLoggingInReplay, UserContext: backgroundActivityContext, @@ -1471,8 +1475,8 @@ func setClientDefaults(client *WorkflowClient) { if client.namespace == "" { client.namespace = DefaultNamespace } - if client.metricsScope == nil { - client.metricsScope = tally.NoopScope + if client.metricsHandler == nil { + client.metricsHandler = metrics.NopHandler } } diff --git a/internal/internal_worker_base.go b/internal/internal_worker_base.go index 920147b40..f40499857 100644 --- a/internal/internal_worker_base.go +++ b/internal/internal_worker_base.go @@ -35,7 +35,6 @@ import ( "sync/atomic" "time" - "github.com/uber-go/tally/v4" commonpb "go.temporal.io/api/common/v1" "go.temporal.io/api/serviceerror" "go.temporal.io/sdk/internal/common/retry" @@ -87,7 +86,7 @@ type ( RequestCancelExternalWorkflow(namespace, workflowID, runID string, callback ResultHandler) ExecuteChildWorkflow(params ExecuteWorkflowParams, callback ResultHandler, startedHandler func(r WorkflowExecution, e error)) GetLogger() log.Logger - GetMetricsScope() tally.Scope + GetMetricsHandler() metrics.Handler // Must be called before WorkflowDefinition.Execute returns RegisterSignalHandler(handler func(name string, input *commonpb.Payloads) error) SignalExternalWorkflow(namespace, workflowID, runID, signalName string, input *commonpb.Payloads, arg interface{}, childWorkflowOnly bool, callback ResultHandler) @@ -148,11 +147,11 @@ type ( limiterContextCancel func() retrier *backoff.ConcurrentRetrier // Service errors back off retrier logger log.Logger - metricsScope tally.Scope + metricsHandler metrics.Handler // Must be atomically accessed taskSlotsAvailable int32 - taskSlotsAvailableGauge tally.Gauge + taskSlotsAvailableGauge metrics.Gauge pollerRequestCh chan struct{} taskQueueCh chan interface{} @@ -176,7 +175,12 @@ func createPollRetryPolicy() backoff.RetryPolicy { return policy } -func newBaseWorker(options baseWorkerOptions, logger log.Logger, metricsScope tally.Scope, sessionTokenBucket *sessionTokenBucket) *baseWorker { +func newBaseWorker( + options baseWorkerOptions, + logger log.Logger, + metricsHandler metrics.Handler, + sessionTokenBucket *sessionTokenBucket, +) *baseWorker { ctx, cancel := context.WithCancel(context.Background()) bw := &baseWorker{ options: options, @@ -184,7 +188,7 @@ func newBaseWorker(options baseWorkerOptions, logger log.Logger, metricsScope ta taskLimiter: rate.NewLimiter(rate.Limit(options.maxTaskPerSecond), 1), retrier: backoff.NewConcurrentRetrier(pollOperationRetryPolicy), logger: log.With(logger, tagWorkerType, options.workerType), - metricsScope: metrics.GetWorkerScope(metricsScope, options.workerType), + metricsHandler: metricsHandler.WithTags(metrics.WorkerTags(options.workerType)), taskSlotsAvailable: int32(options.maxConcurrentTask), pollerRequestCh: make(chan struct{}, options.maxConcurrentTask), taskQueueCh: make(chan interface{}), // no buffer, so poller only able to poll new task after previous is dispatched. @@ -193,7 +197,7 @@ func newBaseWorker(options baseWorkerOptions, logger log.Logger, metricsScope ta limiterContextCancel: cancel, sessionTokenBucket: sessionTokenBucket, } - bw.taskSlotsAvailableGauge = bw.metricsScope.Gauge(metrics.WorkerTaskSlotsAvailable) + bw.taskSlotsAvailableGauge = bw.metricsHandler.Gauge(metrics.WorkerTaskSlotsAvailable) bw.taskSlotsAvailableGauge.Update(float64(bw.taskSlotsAvailable)) if options.pollerRate > 0 { bw.pollLimiter = rate.NewLimiter(rate.Limit(options.pollerRate), 1) @@ -208,7 +212,7 @@ func (bw *baseWorker) Start() { return } - bw.metricsScope.Counter(metrics.WorkerStartCounter).Inc(1) + bw.metricsHandler.Counter(metrics.WorkerStartCounter).Inc(1) for i := 0; i < bw.options.pollerCount; i++ { bw.stopWG.Add(1) @@ -239,7 +243,7 @@ func (bw *baseWorker) isStop() bool { func (bw *baseWorker) runPoller() { defer bw.stopWG.Done() - bw.metricsScope.Counter(metrics.PollerStartCounter).Inc(1) + bw.metricsHandler.Counter(metrics.PollerStartCounter).Inc(1) for { select { diff --git a/internal/internal_worker_test.go b/internal/internal_worker_test.go index 75694dc58..5fb31d85d 100644 --- a/internal/internal_worker_test.go +++ b/internal/internal_worker_test.go @@ -2452,7 +2452,7 @@ func TestWorkerOptionDefaults(t *testing.T) { workflowWorker := aggWorker.workflowWorker require.True(t, workflowWorker.executionParameters.Identity != "") require.NotNil(t, workflowWorker.executionParameters.Logger) - require.NotNil(t, workflowWorker.executionParameters.MetricsScope) + require.NotNil(t, workflowWorker.executionParameters.MetricsHandler) require.Nil(t, workflowWorker.executionParameters.ContextPropagators) expected := workerExecutionParameters{ @@ -2469,7 +2469,7 @@ func TestWorkerOptionDefaults(t *testing.T) { StickyScheduleToStartTimeout: stickyWorkflowTaskScheduleToStartTimeoutSeconds * time.Second, DataConverter: converter.GetDefaultDataConverter(), Logger: workflowWorker.executionParameters.Logger, - MetricsScope: workflowWorker.executionParameters.MetricsScope, + MetricsHandler: workflowWorker.executionParameters.MetricsHandler, Identity: workflowWorker.executionParameters.Identity, UserContext: workflowWorker.executionParameters.UserContext, } @@ -2479,7 +2479,7 @@ func TestWorkerOptionDefaults(t *testing.T) { activityWorker := aggWorker.activityWorker require.True(t, activityWorker.executionParameters.Identity != "") require.NotNil(t, activityWorker.executionParameters.Logger) - require.NotNil(t, activityWorker.executionParameters.MetricsScope) + require.NotNil(t, activityWorker.executionParameters.MetricsHandler) require.Nil(t, activityWorker.executionParameters.ContextPropagators) assertWorkerExecutionParamsEqual(t, expected, activityWorker.executionParameters) } @@ -2530,7 +2530,7 @@ func TestWorkerOptionNonDefaults(t *testing.T) { StickyScheduleToStartTimeout: options.StickyScheduleToStartTimeout, DataConverter: client.dataConverter, Logger: client.logger, - MetricsScope: client.metricsScope, + MetricsHandler: client.metricsHandler, Identity: client.identity, } @@ -2549,7 +2549,7 @@ func TestLocalActivityWorkerOnly(t *testing.T) { workflowWorker := aggWorker.workflowWorker require.True(t, workflowWorker.executionParameters.Identity != "") require.NotNil(t, workflowWorker.executionParameters.Logger) - require.NotNil(t, workflowWorker.executionParameters.MetricsScope) + require.NotNil(t, workflowWorker.executionParameters.MetricsHandler) require.Nil(t, workflowWorker.executionParameters.ContextPropagators) expected := workerExecutionParameters{ @@ -2566,7 +2566,7 @@ func TestLocalActivityWorkerOnly(t *testing.T) { StickyScheduleToStartTimeout: stickyWorkflowTaskScheduleToStartTimeoutSeconds * time.Second, DataConverter: converter.GetDefaultDataConverter(), Logger: workflowWorker.executionParameters.Logger, - MetricsScope: workflowWorker.executionParameters.MetricsScope, + MetricsHandler: workflowWorker.executionParameters.MetricsHandler, Identity: workflowWorker.executionParameters.Identity, UserContext: workflowWorker.executionParameters.UserContext, } diff --git a/internal/internal_workflow.go b/internal/internal_workflow.go index 16fc7d6ea..4b76f3197 100644 --- a/internal/internal_workflow.go +++ b/internal/internal_workflow.go @@ -829,7 +829,7 @@ func (c *channelImpl) assignValue(from interface{}, to interface{}) error { // add to metrics if err != nil { c.env.GetLogger().Error(fmt.Sprintf("Deserialization error. Corrupted signal received on channel %s.", c.name), tagError, err) - c.env.GetMetricsScope().Counter(metrics.CorruptedSignalsCounter).Inc(1) + c.env.GetMetricsHandler().Counter(metrics.CorruptedSignalsCounter).Inc(1) } return err } diff --git a/internal/internal_workflow_client.go b/internal/internal_workflow_client.go index 91d245374..1afb78e95 100644 --- a/internal/internal_workflow_client.go +++ b/internal/internal_workflow_client.go @@ -33,7 +33,6 @@ import ( "time" "github.com/pborman/uuid" - "github.com/uber-go/tally/v4" commonpb "go.temporal.io/api/common/v1" enumspb "go.temporal.io/api/enums/v1" historypb "go.temporal.io/api/history/v1" @@ -69,7 +68,7 @@ type ( namespace string registry *registry logger log.Logger - metricsScope tally.Scope + metricsHandler metrics.Handler identity string dataConverter converter.DataConverter contextPropagators []ContextPropagator @@ -81,7 +80,7 @@ type ( namespaceClient struct { workflowService workflowservice.WorkflowServiceClient connectionCloser io.Closer - metricsScope tally.Scope + metricsHandler metrics.Handler logger log.Logger identity string } @@ -302,7 +301,7 @@ func (wc *WorkflowClient) GetWorkflowHistory( isLongPoll bool, filterType enumspb.HistoryEventFilterType, ) HistoryEventIterator { - return wc.getWorkflowHistory(ctx, workflowID, runID, isLongPoll, filterType, wc.metricsScope) + return wc.getWorkflowHistory(ctx, workflowID, runID, isLongPoll, filterType, wc.metricsHandler) } func (wc *WorkflowClient) getWorkflowHistory( @@ -311,7 +310,7 @@ func (wc *WorkflowClient) getWorkflowHistory( runID string, isLongPoll bool, filterType enumspb.HistoryEventFilterType, - rpcMetricsScope tally.Scope, + rpcMetricsHandler metrics.Handler, ) HistoryEventIterator { namespace := wc.namespace paginate := func(nextToken []byte) (*workflowservice.GetWorkflowExecutionHistoryResponse, error) { @@ -331,7 +330,7 @@ func (wc *WorkflowClient) getWorkflowHistory( var err error Loop: for { - response, err = wc.getWorkflowExecutionHistory(ctx, rpcMetricsScope, isLongPoll, request, filterType) + response, err = wc.getWorkflowExecutionHistory(ctx, rpcMetricsHandler, isLongPoll, request, filterType) if err != nil { return nil, err } @@ -349,9 +348,9 @@ func (wc *WorkflowClient) getWorkflowHistory( } } -func (wc *WorkflowClient) getWorkflowExecutionHistory(ctx context.Context, rpcMetricsScope tally.Scope, isLongPoll bool, +func (wc *WorkflowClient) getWorkflowExecutionHistory(ctx context.Context, rpcMetricsHandler metrics.Handler, isLongPoll bool, request *workflowservice.GetWorkflowExecutionHistoryRequest, filterType enumspb.HistoryEventFilterType) (*workflowservice.GetWorkflowExecutionHistoryResponse, error) { - grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsScope(rpcMetricsScope), grpcLongPoll(isLongPoll), defaultGrpcRetryParameters(ctx), func(builder *grpcContextBuilder) { + grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsHandler(rpcMetricsHandler), grpcLongPoll(isLongPoll), defaultGrpcRetryParameters(ctx), func(builder *grpcContextBuilder) { if isLongPoll { builder.Timeout = defaultGetHistoryTimeout } @@ -394,7 +393,7 @@ func (wc *WorkflowClient) CompleteActivity(ctx context.Context, taskToken []byte } } request := convertActivityResultToRespondRequest(wc.identity, taskToken, data, err, wc.dataConverter, wc.namespace) - return reportActivityComplete(ctx, wc.workflowService, request, wc.metricsScope) + return reportActivityComplete(ctx, wc.workflowService, request, wc.metricsHandler) } // CompleteActivityByID reports activity completed. Similar to CompleteActivity @@ -417,7 +416,7 @@ func (wc *WorkflowClient) CompleteActivityByID(ctx context.Context, namespace, w } request := convertActivityResultToRespondRequestByID(wc.identity, namespace, workflowID, runID, activityID, data, err, wc.dataConverter) - return reportActivityCompleteByID(ctx, wc.workflowService, request, wc.metricsScope) + return reportActivityCompleteByID(ctx, wc.workflowService, request, wc.metricsHandler) } // RecordActivityHeartbeat records heartbeat for an activity. @@ -427,7 +426,7 @@ func (wc *WorkflowClient) RecordActivityHeartbeat(ctx context.Context, taskToken if err != nil { return err } - return recordActivityHeartbeat(ctx, wc.workflowService, wc.metricsScope, wc.identity, taskToken, data) + return recordActivityHeartbeat(ctx, wc.workflowService, wc.metricsHandler, wc.identity, taskToken, data) } // RecordActivityHeartbeatByID records heartbeat for an activity. @@ -438,7 +437,7 @@ func (wc *WorkflowClient) RecordActivityHeartbeatByID(ctx context.Context, if err != nil { return err } - return recordActivityHeartbeatByID(ctx, wc.workflowService, wc.metricsScope, wc.identity, namespace, workflowID, runID, activityID, data) + return recordActivityHeartbeatByID(ctx, wc.workflowService, wc.metricsHandler, wc.identity, namespace, workflowID, runID, activityID, data) } // ListClosedWorkflow gets closed workflow executions based on request filters @@ -1027,8 +1026,8 @@ func (w *workflowClientInterceptor) ExecuteWorkflow( var response *workflowservice.StartWorkflowExecutionResponse - grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsScope( - metrics.GetMetricsScopeForRPC(w.client.metricsScope, in.WorkflowType, metrics.NoneTagValue, in.Options.TaskQueue)), + grpcCtx, cancel := newGRPCContext(ctx, grpcMetricsHandler( + w.client.metricsHandler.WithTags(metrics.RPCTags(in.WorkflowType, metrics.NoneTagValue, in.Options.TaskQueue))), defaultGrpcRetryParameters(ctx)) defer cancel() @@ -1045,10 +1044,10 @@ func (w *workflowClientInterceptor) ExecuteWorkflow( } iterFn := func(fnCtx context.Context, fnRunID string) HistoryEventIterator { - rpcScope := metrics.GetMetricsScopeForRPC(w.client.metricsScope, in.WorkflowType, - metrics.NoneTagValue, in.Options.TaskQueue) + metricsHandler := w.client.metricsHandler.WithTags(metrics.RPCTags(in.WorkflowType, + metrics.NoneTagValue, in.Options.TaskQueue)) return w.client.getWorkflowHistory(fnCtx, workflowID, fnRunID, true, - enumspb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT, rpcScope) + enumspb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT, metricsHandler) } curRunIDCell := util.PopulatedOnceCell(runID) @@ -1158,10 +1157,10 @@ func (w *workflowClientInterceptor) SignalWithStartWorkflow( } iterFn := func(fnCtx context.Context, fnRunID string) HistoryEventIterator { - rpcScope := metrics.GetMetricsScopeForRPC(w.client.metricsScope, in.WorkflowType, - metrics.NoneTagValue, in.Options.TaskQueue) + metricsHandler := w.client.metricsHandler.WithTags(metrics.RPCTags(in.WorkflowType, + metrics.NoneTagValue, in.Options.TaskQueue)) return w.client.getWorkflowHistory(fnCtx, in.Options.ID, fnRunID, true, - enumspb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT, rpcScope) + enumspb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT, metricsHandler) } curRunIDCell := util.PopulatedOnceCell(response.GetRunId()) diff --git a/internal/internal_workflow_client_test.go b/internal/internal_workflow_client_test.go index 25059bda3..d2c759ec1 100644 --- a/internal/internal_workflow_client_test.go +++ b/internal/internal_workflow_client_test.go @@ -38,7 +38,6 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" - "github.com/uber-go/tally/v4" commonpb "go.temporal.io/api/common/v1" enumspb "go.temporal.io/api/enums/v1" historypb "go.temporal.io/api/history/v1" @@ -47,6 +46,7 @@ import ( "go.temporal.io/api/workflowservicemock/v1" "go.temporal.io/sdk/converter" + "go.temporal.io/sdk/internal/common/metrics" "go.temporal.io/sdk/internal/common/serializer" iconverter "go.temporal.io/sdk/internal/converter" ) @@ -336,11 +336,10 @@ func (s *workflowRunSuite) SetupTest() { s.mockCtrl = gomock.NewController(s.T()) s.workflowServiceClient = workflowservicemock.NewMockWorkflowServiceClient(s.mockCtrl) - metricsScope := tally.NoopScope options := ClientOptions{ - MetricsScope: metricsScope, - Identity: identity, - Logger: ilog.NewNopLogger(), + MetricsHandler: metrics.NopHandler, + Identity: identity, + Logger: ilog.NewNopLogger(), } s.workflowClient = NewServiceClient(s.workflowServiceClient, nil, options) s.dataConverter = converter.GetDefaultDataConverter() diff --git a/internal/internal_workflow_test.go b/internal/internal_workflow_test.go index 4045867ed..47f139098 100644 --- a/internal/internal_workflow_test.go +++ b/internal/internal_workflow_test.go @@ -765,8 +765,8 @@ func receiveAsyncCorruptSignalWorkflowTest(ctx Context) ([]message, error) { } func (s *WorkflowUnitTest) Test_CorruptedSignalWorkflow_ShouldLogMetricsAndNotPanic() { - scope, closer, reporter := metrics.NewTaggedMetricsScope() - s.SetMetricsScope(scope) + metricsHandler := metrics.NewCapturingHandler() + s.SetMetricsHandler(metricsHandler) env := s.NewTestWorkflowEnvironment() // Setup signals. @@ -790,16 +790,15 @@ func (s *WorkflowUnitTest) Test_CorruptedSignalWorkflow_ShouldLogMetricsAndNotPa s.EqualValues(1, len(result)) s.EqualValues("the right interface", result[0].Value) - _ = closer.Close() - counts := reporter.Counts() - s.EqualValues(1, len(counts)) - s.EqualValues(metrics.CorruptedSignalsCounter, counts[0].Name()) - s.EqualValues(1, counts[0].Value()) + counters := metricsHandler.Counters() + s.EqualValues(1, len(counters)) + s.EqualValues(metrics.CorruptedSignalsCounter, counters[0].Name) + s.EqualValues(1, counters[0].Value()) } func (s *WorkflowUnitTest) Test_CorruptedSignalWorkflow_OnSelectorRead_ShouldLogMetricsAndNotPanic() { - scope, closer, reporter := metrics.NewTaggedMetricsScope() - s.SetMetricsScope(scope) + metricsHandler := metrics.NewCapturingHandler() + s.SetMetricsHandler(metricsHandler) env := s.NewTestWorkflowEnvironment() // Setup signals. @@ -823,16 +822,15 @@ func (s *WorkflowUnitTest) Test_CorruptedSignalWorkflow_OnSelectorRead_ShouldLog s.EqualValues(1, len(result)) s.EqualValues("the right interface", result[0].Value) - _ = closer.Close() - counts := reporter.Counts() - s.EqualValues(1, len(counts)) - s.EqualValues(metrics.CorruptedSignalsCounter, counts[0].Name()) - s.EqualValues(1, counts[0].Value()) + counters := metricsHandler.Counters() + s.EqualValues(1, len(counters)) + s.EqualValues(metrics.CorruptedSignalsCounter, counters[0].Name) + s.EqualValues(1, counters[0].Value()) } func (s *WorkflowUnitTest) Test_CorruptedSignalWorkflow_ReceiveAsync_ShouldLogMetricsAndNotPanic() { - scope, closer, reporter := metrics.NewTaggedMetricsScope() - s.SetMetricsScope(scope) + metricsHandler := metrics.NewCapturingHandler() + s.SetMetricsHandler(metricsHandler) env := s.NewTestWorkflowEnvironment() env.ExecuteWorkflow(receiveAsyncCorruptSignalWorkflowTest) @@ -844,11 +842,10 @@ func (s *WorkflowUnitTest) Test_CorruptedSignalWorkflow_ReceiveAsync_ShouldLogMe s.EqualValues(1, len(result)) s.EqualValues("the right interface", result[0].Value) - _ = closer.Close() - counts := reporter.Counts() - s.EqualValues(1, len(counts)) - s.EqualValues(metrics.CorruptedSignalsCounter, counts[0].Name()) - s.EqualValues(2, counts[0].Value()) + counters := metricsHandler.Counters() + s.EqualValues(1, len(counters)) + s.EqualValues(metrics.CorruptedSignalsCounter, counters[0].Name) + s.EqualValues(2, counters[0].Value()) } func (s *WorkflowUnitTest) Test_CorruptedSignalOnClosedChannelWorkflow_ReceiveAsync_ShouldComplete() { diff --git a/internal/internal_workflow_testsuite.go b/internal/internal_workflow_testsuite.go index 02b8fe843..293309190 100644 --- a/internal/internal_workflow_testsuite.go +++ b/internal/internal_workflow_testsuite.go @@ -38,7 +38,6 @@ import ( "github.com/golang/mock/gomock" "github.com/robfig/cron" "github.com/stretchr/testify/mock" - "github.com/uber-go/tally/v4" commandpb "go.temporal.io/api/command/v1" commonpb "go.temporal.io/api/common/v1" enumspb "go.temporal.io/api/enums/v1" @@ -50,6 +49,7 @@ import ( "go.temporal.io/sdk/converter" "go.temporal.io/sdk/internal/common" + "go.temporal.io/sdk/internal/common/metrics" ilog "go.temporal.io/sdk/internal/log" "go.temporal.io/sdk/log" ) @@ -135,7 +135,7 @@ type ( mock *mock.Mock service workflowservice.WorkflowServiceClient logger log.Logger - metricsScope tally.Scope + metricsHandler metrics.Handler contextPropagators []ContextPropagator identity string detachedChildWaitDisabled bool @@ -222,7 +222,7 @@ func newTestWorkflowEnvironmentImpl(s *WorkflowTestSuite, parentRegistry *regist taskQueueSpecificActivities: make(map[string]*taskQueueSpecificActivity), logger: s.logger, - metricsScope: s.scope, + metricsHandler: s.metricsHandler, mockClock: clock.NewMock(), wallClock: clock.New(), timers: make(map[string]*testTimerHandle), @@ -272,8 +272,8 @@ func newTestWorkflowEnvironmentImpl(s *WorkflowTestSuite, parentRegistry *regist if env.logger == nil { env.logger = ilog.NewDefaultLogger() } - if env.metricsScope == nil { - env.metricsScope = tally.NoopScope + if env.metricsHandler == nil { + env.metricsHandler = metrics.NopHandler } env.contextPropagators = s.contextPropagators env.header = s.header @@ -617,10 +617,10 @@ func (env *testWorkflowEnvironmentImpl) executeLocalActivity( attempt: 1, } taskHandler := localActivityTaskHandler{ - userContext: env.workerOptions.BackgroundActivityContext, - metricsScope: env.metricsScope, - logger: env.logger, - interceptors: env.registry.interceptors, + userContext: env.workerOptions.BackgroundActivityContext, + metricsHandler: env.metricsHandler, + logger: env.logger, + interceptors: env.registry.interceptors, } result := taskHandler.executeLocalActivityTask(task) @@ -1019,8 +1019,8 @@ func (env *testWorkflowEnvironmentImpl) GetLogger() log.Logger { return env.logger } -func (env *testWorkflowEnvironmentImpl) GetMetricsScope() tally.Scope { - return env.metricsScope +func (env *testWorkflowEnvironmentImpl) GetMetricsHandler() metrics.Handler { + return env.metricsHandler } func (env *testWorkflowEnvironmentImpl) GetDataConverter() converter.DataConverter { @@ -1382,7 +1382,7 @@ func (env *testWorkflowEnvironmentImpl) ExecuteLocalActivity(params ExecuteLocal task := newLocalActivityTask(params, callback, activityID) taskHandler := localActivityTaskHandler{ userContext: env.workerOptions.BackgroundActivityContext, - metricsScope: env.metricsScope, + metricsHandler: env.metricsHandler, logger: env.logger, dataConverter: env.dataConverter, contextPropagators: env.contextPropagators, @@ -1841,7 +1841,7 @@ func (env *testWorkflowEnvironmentImpl) newTestActivityTaskHandler(taskQueue str params := workerExecutionParameters{ TaskQueue: taskQueue, Identity: env.identity, - MetricsScope: env.metricsScope, + MetricsHandler: env.metricsHandler, Logger: env.logger, UserContext: env.workerOptions.BackgroundActivityContext, DataConverter: dataConverter, diff --git a/internal/workflow.go b/internal/workflow.go index 6166abb1d..35b050f27 100644 --- a/internal/workflow.go +++ b/internal/workflow.go @@ -30,12 +30,12 @@ import ( "strings" "time" - "github.com/uber-go/tally/v4" commonpb "go.temporal.io/api/common/v1" enumspb "go.temporal.io/api/enums/v1" failurepb "go.temporal.io/api/failure/v1" "go.temporal.io/sdk/converter" + "go.temporal.io/sdk/internal/common/metrics" "go.temporal.io/sdk/log" ) @@ -890,14 +890,14 @@ func (wc *workflowEnvironmentInterceptor) GetLogger(ctx Context) log.Logger { return wc.env.GetLogger() } -// GetMetricsScope returns a metrics scope to be used in workflow's context -func GetMetricsScope(ctx Context) tally.Scope { +// GetMetricsHandler returns a metrics handler to be used in workflow's context +func GetMetricsHandler(ctx Context) metrics.Handler { i := getWorkflowOutboundInterceptor(ctx) - return i.GetMetricsScope(ctx) + return i.GetMetricsHandler(ctx) } -func (wc *workflowEnvironmentInterceptor) GetMetricsScope(ctx Context) tally.Scope { - return wc.env.GetMetricsScope() +func (wc *workflowEnvironmentInterceptor) GetMetricsHandler(ctx Context) metrics.Handler { + return wc.env.GetMetricsHandler() } // Now returns the current time in UTC. It corresponds to the time when the workflow task is started or replayed. @@ -1453,8 +1453,9 @@ func (wc *workflowEnvironmentInterceptor) SetQueryHandler(ctx Context, queryType // this flag as it is going to break workflow determinism requirement. // The only reasonable use case for this flag is to avoid some external actions during replay, like custom logging or // metric reporting. Please note that Temporal already provide standard logging/metric via workflow.GetLogger(ctx) and -// workflow.GetMetricsScope(ctx), and those standard mechanism are replay-aware and it will automatically suppress during -// replay. Only use this flag if you need custom logging/metrics reporting, for example if you want to log to kafka. +// workflow.GetMetricsHandler(ctx), and those standard mechanism are replay-aware and it will automatically suppress +// during replay. Only use this flag if you need custom logging/metrics reporting, for example if you want to log to +// kafka. // // Warning! Any action protected by this flag should not fail or if it does fail should ignore that failure or panic // on the failure. If workflow don't want to be blocked on those failure, it should ignore those failure; if workflow do diff --git a/internal/workflow_testsuite.go b/internal/workflow_testsuite.go index ec231abbf..d5258d968 100644 --- a/internal/workflow_testsuite.go +++ b/internal/workflow_testsuite.go @@ -32,12 +32,12 @@ import ( "time" "github.com/stretchr/testify/mock" - "github.com/uber-go/tally/v4" commonpb "go.temporal.io/api/common/v1" enumspb "go.temporal.io/api/enums/v1" "go.temporal.io/api/serviceerror" "go.temporal.io/sdk/converter" + "go.temporal.io/sdk/internal/common/metrics" "go.temporal.io/sdk/log" ) @@ -54,7 +54,7 @@ type ( // WorkflowTestSuite is the test suite to run unit tests for workflow/activity. WorkflowTestSuite struct { logger log.Logger - scope tally.Scope + metricsHandler metrics.Handler contextPropagators []ContextPropagator header *commonpb.Header } @@ -142,10 +142,10 @@ func (s *WorkflowTestSuite) GetLogger() log.Logger { return s.logger } -// SetMetricsScope sets the metrics scope for this WorkflowTestSuite. If you don't set scope, test suite will use -// tally.NoopScope -func (s *WorkflowTestSuite) SetMetricsScope(scope tally.Scope) { - s.scope = scope +// SetMetricsHandler sets the metrics handler for this WorkflowTestSuite. If you don't set handler, test suite will use +// a noop handler. +func (s *WorkflowTestSuite) SetMetricsHandler(metricsHandler metrics.Handler) { + s.metricsHandler = metricsHandler } // SetContextPropagators sets the context propagators for this WorkflowTestSuite. If you don't set context propagators, diff --git a/test/activity_test.go b/test/activity_test.go index 7625d0a08..84a2bcd08 100644 --- a/test/activity_test.go +++ b/test/activity_test.go @@ -283,7 +283,7 @@ func (a *Activities) InterceptorCalls(ctx context.Context, someVal string) (stri // Make some calls activity.GetInfo(ctx) activity.GetLogger(ctx) - activity.GetMetricsScope(ctx) + activity.GetMetricsHandler(ctx) activity.RecordHeartbeat(ctx, "details") activity.HasHeartbeatDetails(ctx) _ = activity.GetHeartbeatDetails(ctx) diff --git a/test/go.mod b/test/go.mod new file mode 100644 index 000000000..63f977ae0 --- /dev/null +++ b/test/go.mod @@ -0,0 +1,18 @@ +module go.temporal.io/sdk/test + +go 1.16 + +require ( + github.com/golang/mock v1.6.0 + github.com/pborman/uuid v1.2.1 + github.com/stretchr/testify v1.7.0 + github.com/uber-go/tally/v4 v4.1.1 + go.temporal.io/api v1.5.0 + go.temporal.io/sdk v1.11.1 + go.temporal.io/sdk/contrib/tally v0.1.0 + go.uber.org/goleak v1.1.11 +) + +replace go.temporal.io/sdk => ../ + +replace go.temporal.io/sdk/contrib/tally => ../contrib/tally diff --git a/test/go.sum b/test/go.sum new file mode 100644 index 000000000..a0421078d --- /dev/null +++ b/test/go.sum @@ -0,0 +1,310 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cactus/go-statsd-client/statsd v0.0.0-20200423205355-cb0885a1018c/go.mod h1:l/bIBLeOl9eX+wxJAzxS4TveKRtAqlyDpHjhkfO0MEI= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a h1:yDWHCSQ40h88yih2JAcL6Ls/kVkSE8GFACTGVnMPruw= +github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a/go.mod h1:7Ga40egUymuWXxAe151lTNnCv97MddSOVsjpPPkityA= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= +github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/gogo/status v1.1.0 h1:+eIkrewn5q6b30y+g/BJINVVdi2xH7je5MPJ3ZPK3JA= +github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw= +github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ= +github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As= +github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/twmb/murmur3 v1.1.5 h1:i9OLS9fkuLzBXjt6dptlAEyk58fJsSTXbRg3SgVyqgk= +github.com/twmb/murmur3 v1.1.5/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= +github.com/uber-go/tally/v4 v4.1.1 h1:jhy6WOZp4nHyCqeV43x3Wz370LXUGBhgW2JmzOIHCWI= +github.com/uber-go/tally/v4 v4.1.1/go.mod h1:aXeSTDMl4tNosyf6rdU8jlgScHyjEGGtfJ/uwCIf/vM= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.temporal.io/api v1.5.0 h1:o+I1ZK9jASakMyIMRN03rMaExKNicWebBSTrCSj55hs= +go.temporal.io/api v1.5.0/go.mod h1:BqKxEJJYdxb5dqf0ODfzfMxh8UEQ5L3zKS51FiIYYkA= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= +go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210913180222-943fd674d43e h1:+b/22bPvDYt4NPDcy4xAGCmON713ONAWFeY3Z7I3tR8= +golang.org/x/net v0.0.0-20210913180222-943fd674d43e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0 h1:xrCZDmdtoloIiooiA9q0OQb9r8HejIHYoHGhGCe1pGg= +golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af h1:aLMMXFYqw01RA6XJim5uaN+afqNNjc9P8HPAbnpnc5s= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/validator.v2 v2.0.0-20200605151824-2b28d334fa05/go.mod h1:o4V0GXN9/CAmCsvJ0oXYZvrZOe7syiDZSN1GWGZTGzc= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/test/integration_test.go b/test/integration_test.go index f8653c321..b3c572b88 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -28,7 +28,6 @@ import ( "context" "errors" "fmt" - "io" "os" "strings" "sync" @@ -51,6 +50,7 @@ import ( historypb "go.temporal.io/api/history/v1" "go.temporal.io/sdk/activity" "go.temporal.io/sdk/client" + contribtally "go.temporal.io/sdk/contrib/tally" "go.temporal.io/sdk/interceptor" "go.temporal.io/sdk/internal/common" "go.temporal.io/sdk/internal/common/metrics" @@ -84,8 +84,8 @@ type IntegrationTestSuite struct { tracer *tracingInterceptor inboundSignalInterceptor *signalInterceptor trafficController *test.SimpleTrafficController - metricsScopeCloser io.Closer - metricsReporter *metrics.CapturingStatsReporter + metricsHandler *metrics.CapturingHandler + tallyScope tally.TestScope interceptorCallRecorder *interceptortest.CallRecordingInvoker } @@ -130,8 +130,13 @@ func (ts *IntegrationTestSuite) TearDownSuite() { } func (ts *IntegrationTestSuite) SetupTest() { - var metricsScope tally.Scope - metricsScope, ts.metricsScopeCloser, ts.metricsReporter = metrics.NewTaggedMetricsScope() + ts.metricsHandler = metrics.NewCapturingHandler() + var metricsHandler client.MetricsHandler = ts.metricsHandler + // Use Tally handler for Tally test + if strings.HasPrefix(ts.T().Name(), "TestIntegrationSuite/TestTallyScopeAccess") { + ts.tallyScope = tally.NewTestScope("", nil) + metricsHandler = contribtally.NewMetricsHandler(ts.tallyScope) + } var clientInterceptors []interceptor.ClientInterceptor // Record calls for interceptor test @@ -150,7 +155,7 @@ func (ts *IntegrationTestSuite) SetupTest() { NewKeysPropagator([]string{testContextKey1}), NewKeysPropagator([]string{testContextKey2}), }, - MetricsScope: metricsScope, + MetricsHandler: metricsHandler, TrafficController: trafficController, Interceptors: clientInterceptors, }) @@ -193,7 +198,6 @@ func (ts *IntegrationTestSuite) SetupTest() { } func (ts *IntegrationTestSuite) TearDownTest() { - _ = ts.metricsScopeCloser.Close() ts.client.Close() if !ts.workerStopped { ts.worker.Stop() @@ -1217,12 +1221,12 @@ func (ts *IntegrationTestSuite) TestResetWorkflowExecution() { func (ts *IntegrationTestSuite) TestEndToEndLatencyMetrics() { fetchMetrics := func() (localMetric, nonLocalMetric *metrics.CapturedTimer) { - for _, timer := range ts.metricsReporter.Timers() { + for _, timer := range ts.metricsHandler.Timers() { timer := timer - if timer.Name() == "temporal_activity_succeed_endtoend_latency" { - nonLocalMetric = &timer - } else if timer.Name() == "temporal_local_activity_succeed_endtoend_latency" { - localMetric = &timer + if timer.Name == "temporal_activity_succeed_endtoend_latency" { + nonLocalMetric = timer + } else if timer.Name == "temporal_local_activity_succeed_endtoend_latency" { + localMetric = timer } } return @@ -1386,7 +1390,7 @@ func (ts *IntegrationTestSuite) TestInterceptorCalls() { }), }, "WorkflowOutboundInterceptor.GetLogger": {}, - "WorkflowOutboundInterceptor.GetMetricsScope": {}, + "WorkflowOutboundInterceptor.GetMetricsHandler": {}, "WorkflowOutboundInterceptor.Now": {}, "WorkflowOutboundInterceptor.NewTimer": {}, "WorkflowOutboundInterceptor.Sleep": {}, @@ -1420,7 +1424,7 @@ func (ts *IntegrationTestSuite) TestInterceptorCalls() { }), }, "ActivityOutboundInterceptor.GetLogger": {}, - "ActivityOutboundInterceptor.GetMetricsScope": {}, + "ActivityOutboundInterceptor.GetMetricsHandler": {}, "ActivityOutboundInterceptor.RecordHeartbeat": {}, "ActivityOutboundInterceptor.HasHeartbeatDetails": {}, "ActivityOutboundInterceptor.GetHeartbeatDetails": {}, @@ -1608,6 +1612,41 @@ func (ts *IntegrationTestSuite) TestTooFewParams() { ts.Equal(ParamsValue{Param1: "first param", Child: &ParamsValue{Param1: "first param"}}, res) } +func (ts *IntegrationTestSuite) TestTallyScopeAccess() { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + tallyScopeAccessWorkflow := func(ctx workflow.Context) error { + hist := contribtally.ScopeFromHandler(workflow.GetMetricsHandler(ctx)).Histogram("some_histogram", nil) + // This records even during replay + hist.RecordDuration(5 * time.Second) + return workflow.SetQueryHandler(ctx, "some-query", func() (string, error) { return "ok", nil }) + } + + ts.worker.RegisterWorkflow(tallyScopeAccessWorkflow) + run, err := ts.client.ExecuteWorkflow(context.TODO(), + ts.startWorkflowOptions("tally-scope-access-"+uuid.New()), tallyScopeAccessWorkflow) + ts.NoError(err) + ts.NoError(run.Get(context.TODO(), nil)) + + assertHistDuration := func(name string, d time.Duration, expected int64) { + for _, hist := range ts.tallyScope.Snapshot().Histograms() { + if hist.Name() == name { + ts.Equal(expected, hist.Durations()[d]) + return + } + } + ts.Fail("no histogram") + } + // Confirm hit once + assertHistDuration("some_histogram", 5*time.Second, 1) + + // Query the workflow and confirm hit during replay + _, err = ts.client.QueryWorkflow(ctx, run.GetID(), run.GetRunID(), "some-query") + ts.NoError(err) + assertHistDuration("some_histogram", 5*time.Second, 2) +} + func (ts *IntegrationTestSuite) registerNamespace() { client, err := client.NewNamespaceClient(client.Options{HostPort: ts.config.ServiceAddr}) ts.NoError(err) @@ -1806,14 +1845,14 @@ func (t *signalInterceptor) InterceptWorkflow(ctx workflow.Context, next interce } func (ts *IntegrationTestSuite) metricCount(name string, tagFilterKeyValue ...string) (total int64) { - for _, counter := range ts.metricsReporter.Counts() { - if counter.Name() != name { + for _, counter := range ts.metricsHandler.Counters() { + if counter.Name != name { continue } // Check that it matches tag filter validCounter := true for i := 0; i < len(tagFilterKeyValue); i += 2 { - if counter.Tags()[tagFilterKeyValue[i]] != tagFilterKeyValue[i+1] { + if counter.Tags[tagFilterKeyValue[i]] != tagFilterKeyValue[i+1] { validCounter = false break } @@ -1826,14 +1865,14 @@ func (ts *IntegrationTestSuite) metricCount(name string, tagFilterKeyValue ...st } func (ts *IntegrationTestSuite) metricGauge(name string, tagFilterKeyValue ...string) (final float64) { - for _, gauge := range ts.metricsReporter.Gauges() { - if gauge.Name() != name { + for _, gauge := range ts.metricsHandler.Gauges() { + if gauge.Name != name { continue } // Check that it matches tag filter validCounter := true for i := 0; i < len(tagFilterKeyValue); i += 2 { - if gauge.Tags()[tagFilterKeyValue[i]] != tagFilterKeyValue[i+1] { + if gauge.Tags[tagFilterKeyValue[i]] != tagFilterKeyValue[i+1] { validCounter = false break } @@ -1860,11 +1899,11 @@ func (ts *IntegrationTestSuite) assertReportedOperationCount(metricName string, func (ts *IntegrationTestSuite) getReportedOperationCount(metricName string, operation string) int64 { count := int64(0) - for _, counter := range ts.metricsReporter.Counts() { - if counter.Name() != metricName { + for _, counter := range ts.metricsHandler.Counters() { + if counter.Name != metricName { continue } - if op, ok := counter.Tags()[metrics.OperationTagName]; ok && op == operation { + if op, ok := counter.Tags[metrics.OperationTagName]; ok && op == operation { count += counter.Value() } } diff --git a/test/traffic_controller.go b/test/traffic_controller.go index 042c7520c..c30821687 100644 --- a/test/traffic_controller.go +++ b/test/traffic_controller.go @@ -26,9 +26,9 @@ package test import ( "context" + "strings" "sync" - "go.temporal.io/sdk/internal/common/metrics" ilog "go.temporal.io/sdk/internal/log" "go.temporal.io/sdk/log" ) @@ -55,7 +55,7 @@ func NewSimpleTrafficController() *SimpleTrafficController { func (tc *SimpleTrafficController) CheckCallAllowed(_ context.Context, method string, _, _ interface{}) error { // Name of the API being called - operation := metrics.ConvertMethodToScope(method) + operation := method[strings.LastIndex(method, "/")+1:] tc.lock.Lock() defer tc.lock.Unlock() var err error diff --git a/test/workflow_test.go b/test/workflow_test.go index 5765662d7..42ad19432 100644 --- a/test/workflow_test.go +++ b/test/workflow_test.go @@ -1403,7 +1403,7 @@ func (w *Workflows) InterceptorCalls(ctx workflow.Context, someVal string) (stri workflow.ExecuteChildWorkflow(ctx, "badworkflow") workflow.GetInfo(ctx) workflow.GetLogger(ctx) - workflow.GetMetricsScope(ctx) + workflow.GetMetricsHandler(ctx) workflow.Now(ctx) workflow.NewTimer(ctx, 1*time.Millisecond) _ = workflow.Sleep(ctx, 1*time.Millisecond) diff --git a/workflow/workflow.go b/workflow/workflow.go index 74771325c..c0586df9e 100644 --- a/workflow/workflow.go +++ b/workflow/workflow.go @@ -27,10 +27,9 @@ package workflow import ( "errors" - "github.com/uber-go/tally/v4" - "go.temporal.io/sdk/converter" "go.temporal.io/sdk/internal" + "go.temporal.io/sdk/internal/common/metrics" "go.temporal.io/sdk/log" ) @@ -192,9 +191,10 @@ func GetLogger(ctx Context) log.Logger { return internal.GetLogger(ctx) } -// GetMetricsScope returns a metrics scope to be used in workflow's context -func GetMetricsScope(ctx Context) tally.Scope { - return internal.GetMetricsScope(ctx) +// GetMetricsHandler returns a metrics handler to be used in workflow's context. +// This handler does not record metrics during replay. +func GetMetricsHandler(ctx Context) metrics.Handler { + return internal.GetMetricsHandler(ctx) } // RequestCancelExternalWorkflow can be used to request cancellation of an external workflow. @@ -397,8 +397,9 @@ func SetQueryHandler(ctx Context, queryType string, handler interface{}) error { // this flag as it is going to break workflow determinism requirement. // The only reasonable use case for this flag is to avoid some external actions during replay, like custom logging or // metric reporting. Please note that Temporal already provide standard logging/metric via workflow.GetLogger(ctx) and -// workflow.GetMetricsScope(ctx), and those standard mechanism are replay-aware and it will automatically suppress during -// replay. Only use this flag if you need custom logging/metrics reporting, for example if you want to log to kafka. +// workflow.GetMetricsHandler(ctx), and those standard mechanism are replay-aware and it will automatically suppress +// during replay. Only use this flag if you need custom logging/metrics reporting, for example if you want to log to +// kafka. // // Warning! Any action protected by this flag should not fail or if it does fail should ignore that failure or panic // on the failure. If workflow don't want to be blocked on those failure, it should ignore those failure; if workflow do