diff --git a/Gopkg.lock b/Gopkg.lock
index f35732327e8..a3bd2ebc1d3 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -380,6 +380,14 @@
pruneopts = "UT"
revision = "9cad4c3443a7200dd6400aef47183728de563a38"
+[[projects]]
+ digest = "1:1168584a5881d371e96cb0e66ef6db71d7cef0856cc7f311490bc856627f8328"
+ name = "github.com/grpc-ecosystem/go-grpc-middleware"
+ packages = ["."]
+ pruneopts = "UT"
+ revision = "c250d6563d4d4c20252cd865923440e829844f4e"
+ version = "v1.0.0"
+
[[projects]]
digest = "1:47d5a48673e054e5d8a172abf17b88675bea87ca48b7acebe85e4e0dfd153a7b"
name = "github.com/grpc-ecosystem/grpc-gateway"
@@ -392,14 +400,6 @@
revision = "07f5e79768022f9a3265235f0db4ac8c3f675fec"
version = "v1.3.1"
-[[projects]]
- branch = "master"
- digest = "1:1a1206efd03a54d336dce7bb8719e74f2f8932f661cb9f57d5813a1d99c083d8"
- name = "github.com/grpc-ecosystem/grpc-opentracing"
- packages = ["go/otgrpc"]
- pruneopts = "UT"
- revision = "8e809c8a86450a29b90dcc9efbf062d0fe6d9746"
-
[[projects]]
branch = "master"
digest = "1:364b908b9b27b97ab838f2f6f1b1f46281fa29b978a037d72a9b1d4f6d940190"
@@ -605,14 +605,6 @@
pruneopts = "UT"
revision = "cc309e4a22231782e8893f3c35ced0967807a33e"
-[[projects]]
- branch = "master"
- digest = "1:7cfb9b66e4b58631f4fe31a854fed5536a9169204dbe188f063d47109cb3acba"
- name = "github.com/mwitkow/go-grpc-middleware"
- packages = ["."]
- pruneopts = "UT"
- revision = "164c5fae744b141cd3e4a182b40d66fd4655c822"
-
[[projects]]
branch = "master"
digest = "1:16886567e49201f2bb97fc738dfe8097494764135a83b533fc020fcefe37d8fe"
@@ -637,6 +629,14 @@
revision = "d311cb43c92434ec4072dfbbda3400741d0a6337"
version = "v0.3.0"
+[[projects]]
+ branch = "master"
+ digest = "1:3173a0e98abdc5021301c4d34e6ac5ff8e6c792f3d22849c879ace70d5828978"
+ name = "github.com/opentracing-contrib/go-grpc"
+ packages = ["."]
+ pruneopts = "UT"
+ revision = "4b5a12d3ff02ba61ae861b7797e17a0c4f0ecea9"
+
[[projects]]
branch = "master"
digest = "1:55a4c23a5ff747a3436588879dc6ff4ea36d2e42dad8c67449f3df4ecb4b41a7"
@@ -936,7 +936,7 @@
[[projects]]
branch = "master"
- digest = "1:6e4a66a9a768fc71e492bec9fafc4c387698a559af45087c731b25b1599497d3"
+ digest = "1:0b1e3d99a4914c79245fb7d8992db23596ed79848c078307db97a099a1899e62"
name = "github.com/weaveworks/common"
packages = [
"aws",
@@ -956,7 +956,7 @@
"user",
]
pruneopts = "UT"
- revision = "e017e7c69cfdc53d5d3bbd4115eb84aa8a180a82"
+ revision = "c1808abf9c462ba088ef5c764053a316a58cde24"
[[projects]]
digest = "1:efac30de93ca1ff38050f46dc34f1338ebc8778de488f919f79ad9e6188719d3"
@@ -1362,7 +1362,7 @@
"github.com/golang/protobuf/proto",
"github.com/golang/snappy",
"github.com/gorilla/mux",
- "github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc",
+ "github.com/grpc-ecosystem/go-grpc-middleware",
"github.com/hashicorp/consul/api",
"github.com/hashicorp/go-cleanhttp",
"github.com/jonboulle/clockwork",
@@ -1371,7 +1371,7 @@
"github.com/mattes/migrate/driver/postgres",
"github.com/mattes/migrate/migrate",
"github.com/mgutz/ansi",
- "github.com/mwitkow/go-grpc-middleware",
+ "github.com/opentracing-contrib/go-grpc",
"github.com/opentracing-contrib/go-stdlib/nethttp",
"github.com/opentracing/opentracing-go",
"github.com/opentracing/opentracing-go/log",
diff --git a/pkg/chunk/gcp/instrumentation.go b/pkg/chunk/gcp/instrumentation.go
index 53701fc912b..62b7b9e050c 100644
--- a/pkg/chunk/gcp/instrumentation.go
+++ b/pkg/chunk/gcp/instrumentation.go
@@ -1,8 +1,8 @@
package gcp
import (
- "github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc"
- "github.com/mwitkow/go-grpc-middleware"
+ "github.com/grpc-ecosystem/go-grpc-middleware"
+ otgrpc "github.com/opentracing-contrib/go-grpc"
"github.com/opentracing/opentracing-go"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
diff --git a/pkg/ingester/client/client.go b/pkg/ingester/client/client.go
index e21106f5802..509e0fd5345 100644
--- a/pkg/ingester/client/client.go
+++ b/pkg/ingester/client/client.go
@@ -3,8 +3,8 @@ package client
import (
"flag"
- "github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc"
- "github.com/mwitkow/go-grpc-middleware"
+ "github.com/grpc-ecosystem/go-grpc-middleware"
+ otgrpc "github.com/opentracing-contrib/go-grpc"
"github.com/opentracing/opentracing-go"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
diff --git a/pkg/querier/frontend/frontend_test.go b/pkg/querier/frontend/frontend_test.go
index aee1fd5397d..c2c1088b16d 100644
--- a/pkg/querier/frontend/frontend_test.go
+++ b/pkg/querier/frontend/frontend_test.go
@@ -10,7 +10,7 @@ import (
"testing"
"github.com/go-kit/kit/log"
- "github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc"
+ otgrpc "github.com/opentracing-contrib/go-grpc"
"github.com/opentracing-contrib/go-stdlib/nethttp"
opentracing "github.com/opentracing/opentracing-go"
"github.com/stretchr/testify/assert"
diff --git a/pkg/querier/frontend/worker.go b/pkg/querier/frontend/worker.go
index b676d9fbad0..a2f9fa0ba8a 100644
--- a/pkg/querier/frontend/worker.go
+++ b/pkg/querier/frontend/worker.go
@@ -9,7 +9,7 @@ import (
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
- "github.com/mwitkow/go-grpc-middleware"
+ "github.com/grpc-ecosystem/go-grpc-middleware"
"google.golang.org/grpc"
"google.golang.org/grpc/naming"
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/.gitignore b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/.gitignore
similarity index 99%
rename from vendor/github.com/mwitkow/go-grpc-middleware/.gitignore
rename to vendor/github.com/grpc-ecosystem/go-grpc-middleware/.gitignore
index a95d7263532..c198e6a4c7c 100644
--- a/vendor/github.com/mwitkow/go-grpc-middleware/.gitignore
+++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/.gitignore
@@ -197,3 +197,6 @@ local.properties
coverage.txt
+
+#vendor
+vendor/
diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/.travis.yml b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/.travis.yml
new file mode 100644
index 00000000000..2fc21dd6f65
--- /dev/null
+++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/.travis.yml
@@ -0,0 +1,22 @@
+sudo: false
+language: go
+go:
+ - 1.8.x
+env:
+ - DEP_VERSION="0.3.2"
+
+before_install:
+ # Download the binary to bin folder in $GOPATH
+ - curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep
+ # Make the binary executable
+ - chmod +x $GOPATH/bin/dep
+
+install:
+ - dep ensure
+
+script:
+ - make checkdocs
+ - make test
+
+after_success:
+ - bash <(curl -s https://codecov.io/bash)
diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/CONTRIBUTING.md b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/CONTRIBUTING.md
new file mode 100644
index 00000000000..dd52ab8938e
--- /dev/null
+++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/CONTRIBUTING.md
@@ -0,0 +1,20 @@
+# Contributing
+
+We would love to have people submit pull requests and help make `grpc-ecosystem/go-grpc-middleware` even better 👍.
+
+Fork, then clone the repo:
+
+```bash
+git clone git@github.com:your-username/go-grpc-middleware.git
+```
+
+Before checking in please run the following:
+
+```bash
+make all
+```
+
+This will `vet`, `fmt`, regenerate documentation and run all tests.
+
+
+Push to your fork and open a pull request.
\ No newline at end of file
diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/DOC.md b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/DOC.md
new file mode 100644
index 00000000000..511d953a8e2
--- /dev/null
+++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/DOC.md
@@ -0,0 +1,166 @@
+# grpc_middleware
+`import "github.com/grpc-ecosystem/go-grpc-middleware"`
+
+* [Overview](#pkg-overview)
+* [Imported Packages](#pkg-imports)
+* [Index](#pkg-index)
+
+## Overview
+`grpc_middleware` is a collection of gRPC middleware packages: interceptors, helpers and tools.
+
+### Middleware
+gRPC is a fantastic RPC middleware, which sees a lot of adoption in the Golang world. However, the
+upstream gRPC codebase is relatively bare bones.
+
+This package, and most of its child packages provides commonly needed middleware for gRPC:
+client-side interceptors for retires, server-side interceptors for input validation and auth,
+functions for chaining said interceptors, metadata convenience methods and more.
+
+### Chaining
+By default, gRPC doesn't allow one to have more than one interceptor either on the client nor on
+the server side. `grpc_middleware` provides convenient chaining methods
+
+Simple way of turning a multiple interceptors into a single interceptor. Here's an example for
+server chaining:
+
+ myServer := grpc.NewServer(
+ grpc.StreamInterceptor(grpc_middleware.ChainStreamServer(loggingStream, monitoringStream, authStream)),
+ grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(loggingUnary, monitoringUnary, authUnary),
+ )
+
+These interceptors will be executed from left to right: logging, monitoring and auth.
+
+Here's an example for client side chaining:
+
+ clientConn, err = grpc.Dial(
+ address,
+ grpc.WithUnaryInterceptor(grpc_middleware.ChainUnaryClient(monitoringClientUnary, retryUnary)),
+ grpc.WithStreamInterceptor(grpc_middleware.ChainStreamClient(monitoringClientStream, retryStream)),
+ )
+ client = pb_testproto.NewTestServiceClient(clientConn)
+ resp, err := client.PingEmpty(s.ctx, &myservice.Request{Msg: "hello"})
+
+These interceptors will be executed from left to right: monitoring and then retry logic.
+
+The retry interceptor will call every interceptor that follows it whenever when a retry happens.
+
+### Writing Your Own
+Implementing your own interceptor is pretty trivial: there are interfaces for that. But the interesting
+bit exposing common data to handlers (and other middleware), similarly to HTTP Middleware design.
+For example, you may want to pass the identity of the caller from the auth interceptor all the way
+to the handling function.
+
+For example, a client side interceptor example for auth looks like:
+
+ func FakeAuthUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
+ newCtx := context.WithValue(ctx, "user_id", "john@example.com")
+ return handler(newCtx, req)
+ }
+
+Unfortunately, it's not as easy for streaming RPCs. These have the `context.Context` embedded within
+the `grpc.ServerStream` object. To pass values through context, a wrapper (`WrappedServerStream`) is
+needed. For example:
+
+ func FakeAuthStreamingInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
+ newStream := grpc_middleware.WrapServerStream(stream)
+ newStream.WrappedContext = context.WithValue(ctx, "user_id", "john@example.com")
+ return handler(srv, stream)
+ }
+
+## Imported Packages
+
+- [golang.org/x/net/context](https://godoc.org/golang.org/x/net/context)
+- [google.golang.org/grpc](https://godoc.org/google.golang.org/grpc)
+
+## Index
+* [func ChainStreamClient(interceptors ...grpc.StreamClientInterceptor) grpc.StreamClientInterceptor](#ChainStreamClient)
+* [func ChainStreamServer(interceptors ...grpc.StreamServerInterceptor) grpc.StreamServerInterceptor](#ChainStreamServer)
+* [func ChainUnaryClient(interceptors ...grpc.UnaryClientInterceptor) grpc.UnaryClientInterceptor](#ChainUnaryClient)
+* [func ChainUnaryServer(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor](#ChainUnaryServer)
+* [func WithStreamServerChain(interceptors ...grpc.StreamServerInterceptor) grpc.ServerOption](#WithStreamServerChain)
+* [func WithUnaryServerChain(interceptors ...grpc.UnaryServerInterceptor) grpc.ServerOption](#WithUnaryServerChain)
+* [type WrappedServerStream](#WrappedServerStream)
+ * [func WrapServerStream(stream grpc.ServerStream) \*WrappedServerStream](#WrapServerStream)
+ * [func (w \*WrappedServerStream) Context() context.Context](#WrappedServerStream.Context)
+
+#### Package files
+[chain.go](./chain.go) [doc.go](./doc.go) [wrappers.go](./wrappers.go)
+
+## func [ChainStreamClient](./chain.go#L136)
+``` go
+func ChainStreamClient(interceptors ...grpc.StreamClientInterceptor) grpc.StreamClientInterceptor
+```
+ChainStreamClient creates a single interceptor out of a chain of many interceptors.
+
+Execution is done in left-to-right order, including passing of context.
+For example ChainStreamClient(one, two, three) will execute one before two before three.
+
+## func [ChainStreamServer](./chain.go#L58)
+``` go
+func ChainStreamServer(interceptors ...grpc.StreamServerInterceptor) grpc.StreamServerInterceptor
+```
+ChainStreamServer creates a single interceptor out of a chain of many interceptors.
+
+Execution is done in left-to-right order, including passing of context.
+For example ChainUnaryServer(one, two, three) will execute one before two before three.
+If you want to pass context between interceptors, use WrapServerStream.
+
+## func [ChainUnaryClient](./chain.go#L97)
+``` go
+func ChainUnaryClient(interceptors ...grpc.UnaryClientInterceptor) grpc.UnaryClientInterceptor
+```
+ChainUnaryClient creates a single interceptor out of a chain of many interceptors.
+
+Execution is done in left-to-right order, including passing of context.
+For example ChainUnaryClient(one, two, three) will execute one before two before three.
+
+## func [ChainUnaryServer](./chain.go#L18)
+``` go
+func ChainUnaryServer(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
+```
+ChainUnaryServer creates a single interceptor out of a chain of many interceptors.
+
+Execution is done in left-to-right order, including passing of context.
+For example ChainUnaryServer(one, two, three) will execute one before two before three, and three
+will see context changes of one and two.
+
+## func [WithStreamServerChain](./chain.go#L181)
+``` go
+func WithStreamServerChain(interceptors ...grpc.StreamServerInterceptor) grpc.ServerOption
+```
+WithStreamServerChain is a grpc.Server config option that accepts multiple stream interceptors.
+Basically syntactic sugar.
+
+## func [WithUnaryServerChain](./chain.go#L175)
+``` go
+func WithUnaryServerChain(interceptors ...grpc.UnaryServerInterceptor) grpc.ServerOption
+```
+Chain creates a single interceptor out of a chain of many interceptors.
+
+WithUnaryServerChain is a grpc.Server config option that accepts multiple unary interceptors.
+Basically syntactic sugar.
+
+## type [WrappedServerStream](./wrappers.go#L12-L16)
+``` go
+type WrappedServerStream struct {
+ grpc.ServerStream
+ // WrappedContext is the wrapper's own Context. You can assign it.
+ WrappedContext context.Context
+}
+```
+WrappedServerStream is a thin wrapper around grpc.ServerStream that allows modifying context.
+
+### func [WrapServerStream](./wrappers.go#L24)
+``` go
+func WrapServerStream(stream grpc.ServerStream) *WrappedServerStream
+```
+WrapServerStream returns a ServerStream that has the ability to overwrite context.
+
+### func (\*WrappedServerStream) [Context](./wrappers.go#L19)
+``` go
+func (w *WrappedServerStream) Context() context.Context
+```
+Context returns the wrapper's WrappedContext, overwriting the nested grpc.ServerStream.Context()
+
+- - -
+Generated by [godoc2ghmd](https://github.com/GandalfUK/godoc2ghmd)
\ No newline at end of file
diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/Gopkg.lock b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/Gopkg.lock
new file mode 100644
index 00000000000..ebdcb75a878
--- /dev/null
+++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/Gopkg.lock
@@ -0,0 +1,123 @@
+# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
+
+
+[[projects]]
+ name = "cloud.google.com/go"
+ packages = ["compute/metadata"]
+ revision = "2d3a6656c17a60b0815b7e06ab0be04eacb6e613"
+ version = "v0.16.0"
+
+[[projects]]
+ name = "github.com/davecgh/go-spew"
+ packages = ["spew"]
+ revision = "346938d642f2ec3594ed81d874461961cd0faa76"
+ version = "v1.1.0"
+
+[[projects]]
+ name = "github.com/gogo/protobuf"
+ packages = ["gogoproto","proto","protoc-gen-gogo/descriptor"]
+ revision = "342cbe0a04158f6dcb03ca0079991a51a4248c02"
+ version = "v0.5"
+
+[[projects]]
+ branch = "master"
+ name = "github.com/golang/protobuf"
+ packages = ["jsonpb","proto","ptypes","ptypes/any","ptypes/duration","ptypes/struct","ptypes/timestamp"]
+ revision = "1e59b77b52bf8e4b449a57e6f79f21226d571845"
+
+[[projects]]
+ name = "github.com/opentracing/opentracing-go"
+ packages = [".","ext","log","mocktracer"]
+ revision = "1949ddbfd147afd4d964a9f00b24eb291e0e7c38"
+ version = "v1.0.2"
+
+[[projects]]
+ name = "github.com/pmezard/go-difflib"
+ packages = ["difflib"]
+ revision = "792786c7400a136282c1664665ae0a8db921c6c2"
+ version = "v1.0.0"
+
+[[projects]]
+ name = "github.com/sirupsen/logrus"
+ packages = ["."]
+ revision = "f006c2ac4710855cf0f916dd6b77acf6b048dc6e"
+ version = "v1.0.3"
+
+[[projects]]
+ name = "github.com/stretchr/testify"
+ packages = ["assert","require","suite"]
+ revision = "69483b4bd14f5845b5a1e55bca19e954e827f1d0"
+ version = "v1.1.4"
+
+[[projects]]
+ name = "go.uber.org/atomic"
+ packages = ["."]
+ revision = "8474b86a5a6f79c443ce4b2992817ff32cf208b8"
+ version = "v1.3.1"
+
+[[projects]]
+ name = "go.uber.org/multierr"
+ packages = ["."]
+ revision = "3c4937480c32f4c13a875a1829af76c98ca3d40a"
+ version = "v1.1.0"
+
+[[projects]]
+ name = "go.uber.org/zap"
+ packages = [".","buffer","internal/bufferpool","internal/color","internal/exit","zapcore"]
+ revision = "35aad584952c3e7020db7b839f6b102de6271f89"
+ version = "v1.7.1"
+
+[[projects]]
+ branch = "master"
+ name = "golang.org/x/crypto"
+ packages = ["ssh/terminal"]
+ revision = "94eea52f7b742c7cbe0b03b22f0c4c8631ece122"
+
+[[projects]]
+ branch = "master"
+ name = "golang.org/x/net"
+ packages = ["context","context/ctxhttp","http2","http2/hpack","idna","internal/timeseries","lex/httplex","trace"]
+ revision = "a8b9294777976932365dabb6640cf1468d95c70f"
+
+[[projects]]
+ branch = "master"
+ name = "golang.org/x/oauth2"
+ packages = [".","google","internal","jws","jwt"]
+ revision = "f95fa95eaa936d9d87489b15d1d18b97c1ba9c28"
+
+[[projects]]
+ branch = "master"
+ name = "golang.org/x/sys"
+ packages = ["unix","windows"]
+ revision = "13fcbd661c8ececa8807a29b48407d674b1d8ed8"
+
+[[projects]]
+ branch = "master"
+ name = "golang.org/x/text"
+ packages = ["collate","collate/build","internal/colltab","internal/gen","internal/tag","internal/triegen","internal/ucd","language","secure/bidirule","transform","unicode/bidi","unicode/cldr","unicode/norm","unicode/rangetable"]
+ revision = "75cc3cad82b5f47d3fb229ddda8c5167da14f294"
+
+[[projects]]
+ name = "google.golang.org/appengine"
+ packages = [".","internal","internal/app_identity","internal/base","internal/datastore","internal/log","internal/modules","internal/remote_api","internal/urlfetch","urlfetch"]
+ revision = "150dc57a1b433e64154302bdc40b6bb8aefa313a"
+ version = "v1.0.0"
+
+[[projects]]
+ branch = "master"
+ name = "google.golang.org/genproto"
+ packages = ["googleapis/rpc/status"]
+ revision = "7f0da29060c682909f650ad8ed4e515bd74fa12a"
+
+[[projects]]
+ name = "google.golang.org/grpc"
+ packages = [".","balancer","balancer/roundrobin","codes","connectivity","credentials","credentials/oauth","encoding","grpclb/grpc_lb_v1/messages","grpclog","internal","keepalive","metadata","naming","peer","resolver","resolver/dns","resolver/passthrough","stats","status","tap","transport"]
+ revision = "5a9f7b402fe85096d2e1d0383435ee1876e863d0"
+ version = "v1.8.0"
+
+[solve-meta]
+ analyzer-name = "dep"
+ analyzer-version = 1
+ inputs-digest = "b24c6670412eb0bc44ed1db77fecc52333f8725f3e3272bdc568f5683a63031f"
+ solver-name = "gps-cdcl"
+ solver-version = 1
diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/Gopkg.toml b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/Gopkg.toml
new file mode 100644
index 00000000000..0a7d4c1cd84
--- /dev/null
+++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/Gopkg.toml
@@ -0,0 +1,35 @@
+[[constraint]]
+ name = "github.com/gogo/protobuf"
+ version = "0.5.0"
+
+[[constraint]]
+ branch = "master"
+ name = "github.com/golang/protobuf"
+
+[[constraint]]
+ name = "github.com/opentracing/opentracing-go"
+ version = "1.0.2"
+
+[[constraint]]
+ name = "github.com/sirupsen/logrus"
+ version = "1.0.3"
+
+[[constraint]]
+ name = "github.com/stretchr/testify"
+ version = "1.1.4"
+
+[[constraint]]
+ name = "go.uber.org/zap"
+ version = "1.7.1"
+
+[[constraint]]
+ branch = "master"
+ name = "golang.org/x/net"
+
+[[constraint]]
+ branch = "master"
+ name = "golang.org/x/oauth2"
+
+[[constraint]]
+ name = "google.golang.org/grpc"
+ version = "1.8.0"
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/LICENSE b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/LICENSE
similarity index 100%
rename from vendor/github.com/mwitkow/go-grpc-middleware/LICENSE
rename to vendor/github.com/grpc-ecosystem/go-grpc-middleware/LICENSE
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/README.md b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/README.md
similarity index 83%
rename from vendor/github.com/mwitkow/go-grpc-middleware/README.md
rename to vendor/github.com/grpc-ecosystem/go-grpc-middleware/README.md
index be538932ad2..52e53733c90 100644
--- a/vendor/github.com/mwitkow/go-grpc-middleware/README.md
+++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/README.md
@@ -7,24 +7,24 @@
[](https://codecov.io/gh/grpc-ecosystem/go-grpc-middleware)
[](LICENSE)
[](#status)
-
+[](https://join.slack.com/t/improbable-eng/shared_invite/enQtMzQ1ODcyMzQ5MjM4LWY5ZWZmNGM2ODc5MmViNmQ3ZTA3ZTY3NzQwOTBlMTkzZmIxZTIxODk0OWU3YjZhNWVlNDU3MDlkZGViZjhkMjc)
[gRPC Go](https://github.com/grpc/grpc-go) Middleware: interceptors, helpers, utilities.
-**Important** The repo recently moved from `github.com/grpc-ecosystem/go-grpc-middleware`, please update your import paths.
+**Important** The repo recently moved to `github.com/grpc-ecosystem/go-grpc-middleware`, please update your import paths.
## Middleware
[gRPC Go](https://github.com/grpc/grpc-go) recently acquired support for
Interceptors, i.e. [middleware](https://medium.com/@matryer/writing-middleware-in-golang-and-how-go-makes-it-so-much-fun-4375c1246e81#.gv7tdlghs)
that is executed either on the gRPC Server before the request is passed onto the user's application logic, or on the gRPC client either around the user call. It is a perfect way to implement
-common patters: auth, logging, message, validation, retries or monitoring.
+common patterns: auth, logging, message, validation, retries or monitoring.
These are generic building blocks that make it easy to build multiple microservices easily.
The purpose of this repository is to act as a go-to point for such reusable functionality. It contains
some of them itself, but also will link to useful external repos.
-`grpc_middleware` itself provides support for chaining interceptors. Se [Documentation](DOC.md), but here's an example:
+`grpc_middleware` itself provides support for chaining interceptors. See [Documentation](DOC.md), but here's an example:
```go
import "github.com/grpc-ecosystem/go-grpc-middleware"
@@ -36,6 +36,7 @@ myServer := grpc.NewServer(
grpc_prometheus.StreamServerInterceptor,
grpc_zap.StreamServerInterceptor(zapLogger),
grpc_auth.StreamServerInterceptor(myAuthFunction),
+ grpc_recovery.StreamServerInterceptor(),
)),
grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(
grpc_ctxtags.UnaryServerInterceptor(),
@@ -43,6 +44,7 @@ myServer := grpc.NewServer(
grpc_prometheus.UnaryServerInterceptor,
grpc_zap.UnaryServerInterceptor(zapLogger),
grpc_auth.UnaryServerInterceptor(myAuthFunction),
+ grpc_recovery.UnaryServerInterceptor(),
)),
)
```
@@ -52,12 +54,12 @@ myServer := grpc.NewServer(
*Please send a PR to add new interceptors or middleware to this list*
#### Auth
- * [`grpc_auth`](auth) - a customizable (via `AuthFunc) piece of auth middleware
+ * [`grpc_auth`](auth) - a customizable (via `AuthFunc`) piece of auth middleware
#### Logging
* [`grpc_ctxtags`](tags/) - a library that adds a `Tag` map to context, with data populated from request body
* [`grpc_zap`](logging/zap/) - integration of [zap](https://github.com/uber-go/zap) logging library into gRPC handlers.
- * [`grpc_logrus`](logging/logrus/) - integration of [logrus](https://github.com/Sirupsen/logrus) logging library into gRPC handlers.
+ * [`grpc_logrus`](logging/logrus/) - integration of [logrus](https://github.com/sirupsen/logrus) logging library into gRPC handlers.
#### Monitoring
@@ -69,7 +71,8 @@ myServer := grpc.NewServer(
* [`grpc_retry`](retry/) - a generic gRPC response code retry mechanism, client-side middleware
#### Server
- * [`grpc_validator`](validator/) - codegen inbound message validation from `.proto` options
+ * [`grpc_validator`](validator/) - codegen inbound message validation from `.proto` options
+ * [`grpc_recovery`](recovery/) - turn panics into gRPC errors
## Status
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/auth/README.md b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/auth/README.md
similarity index 100%
rename from vendor/github.com/mwitkow/go-grpc-middleware/auth/README.md
rename to vendor/github.com/grpc-ecosystem/go-grpc-middleware/auth/README.md
diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go
new file mode 100644
index 00000000000..45a2f5f49a7
--- /dev/null
+++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go
@@ -0,0 +1,183 @@
+// Copyright 2016 Michal Witkowski. All Rights Reserved.
+// See LICENSE for licensing terms.
+
+// gRPC Server Interceptor chaining middleware.
+
+package grpc_middleware
+
+import (
+ "golang.org/x/net/context"
+ "google.golang.org/grpc"
+)
+
+// ChainUnaryServer creates a single interceptor out of a chain of many interceptors.
+//
+// Execution is done in left-to-right order, including passing of context.
+// For example ChainUnaryServer(one, two, three) will execute one before two before three, and three
+// will see context changes of one and two.
+func ChainUnaryServer(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor {
+ n := len(interceptors)
+
+ if n > 1 {
+ lastI := n - 1
+ return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
+ var (
+ chainHandler grpc.UnaryHandler
+ curI int
+ )
+
+ chainHandler = func(currentCtx context.Context, currentReq interface{}) (interface{}, error) {
+ if curI == lastI {
+ return handler(currentCtx, currentReq)
+ }
+ curI++
+ resp, err := interceptors[curI](currentCtx, currentReq, info, chainHandler)
+ curI--
+ return resp, err
+ }
+
+ return interceptors[0](ctx, req, info, chainHandler)
+ }
+ }
+
+ if n == 1 {
+ return interceptors[0]
+ }
+
+ // n == 0; Dummy interceptor maintained for backward compatibility to avoid returning nil.
+ return func(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
+ return handler(ctx, req)
+ }
+}
+
+// ChainStreamServer creates a single interceptor out of a chain of many interceptors.
+//
+// Execution is done in left-to-right order, including passing of context.
+// For example ChainUnaryServer(one, two, three) will execute one before two before three.
+// If you want to pass context between interceptors, use WrapServerStream.
+func ChainStreamServer(interceptors ...grpc.StreamServerInterceptor) grpc.StreamServerInterceptor {
+ n := len(interceptors)
+
+ if n > 1 {
+ lastI := n - 1
+ return func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
+ var (
+ chainHandler grpc.StreamHandler
+ curI int
+ )
+
+ chainHandler = func(currentSrv interface{}, currentStream grpc.ServerStream) error {
+ if curI == lastI {
+ return handler(currentSrv, currentStream)
+ }
+ curI++
+ err := interceptors[curI](currentSrv, currentStream, info, chainHandler)
+ curI--
+ return err
+ }
+
+ return interceptors[0](srv, stream, info, chainHandler)
+ }
+ }
+
+ if n == 1 {
+ return interceptors[0]
+ }
+
+ // n == 0; Dummy interceptor maintained for backward compatibility to avoid returning nil.
+ return func(srv interface{}, stream grpc.ServerStream, _ *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
+ return handler(srv, stream)
+ }
+}
+
+// ChainUnaryClient creates a single interceptor out of a chain of many interceptors.
+//
+// Execution is done in left-to-right order, including passing of context.
+// For example ChainUnaryClient(one, two, three) will execute one before two before three.
+func ChainUnaryClient(interceptors ...grpc.UnaryClientInterceptor) grpc.UnaryClientInterceptor {
+ n := len(interceptors)
+
+ if n > 1 {
+ lastI := n - 1
+ return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
+ var (
+ chainHandler grpc.UnaryInvoker
+ curI int
+ )
+
+ chainHandler = func(currentCtx context.Context, currentMethod string, currentReq, currentRepl interface{}, currentConn *grpc.ClientConn, currentOpts ...grpc.CallOption) error {
+ if curI == lastI {
+ return invoker(currentCtx, currentMethod, currentReq, currentRepl, currentConn, currentOpts...)
+ }
+ curI++
+ err := interceptors[curI](currentCtx, currentMethod, currentReq, currentRepl, currentConn, chainHandler, currentOpts...)
+ curI--
+ return err
+ }
+
+ return interceptors[0](ctx, method, req, reply, cc, chainHandler, opts...)
+ }
+ }
+
+ if n == 1 {
+ return interceptors[0]
+ }
+
+ // n == 0; Dummy interceptor maintained for backward compatibility to avoid returning nil.
+ return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
+ return invoker(ctx, method, req, reply, cc, opts...)
+ }
+}
+
+// ChainStreamClient creates a single interceptor out of a chain of many interceptors.
+//
+// Execution is done in left-to-right order, including passing of context.
+// For example ChainStreamClient(one, two, three) will execute one before two before three.
+func ChainStreamClient(interceptors ...grpc.StreamClientInterceptor) grpc.StreamClientInterceptor {
+ n := len(interceptors)
+
+ if n > 1 {
+ lastI := n - 1
+ return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {
+ var (
+ chainHandler grpc.Streamer
+ curI int
+ )
+
+ chainHandler = func(currentCtx context.Context, currentDesc *grpc.StreamDesc, currentConn *grpc.ClientConn, currentMethod string, currentOpts ...grpc.CallOption) (grpc.ClientStream, error) {
+ if curI == lastI {
+ return streamer(currentCtx, currentDesc, currentConn, currentMethod, currentOpts...)
+ }
+ curI++
+ stream, err := interceptors[curI](currentCtx, currentDesc, currentConn, currentMethod, chainHandler, currentOpts...)
+ curI--
+ return stream, err
+ }
+
+ return interceptors[0](ctx, desc, cc, method, chainHandler, opts...)
+ }
+ }
+
+ if n == 1 {
+ return interceptors[0]
+ }
+
+ // n == 0; Dummy interceptor maintained for backward compatibility to avoid returning nil.
+ return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {
+ return streamer(ctx, desc, cc, method, opts...)
+ }
+}
+
+// Chain creates a single interceptor out of a chain of many interceptors.
+//
+// WithUnaryServerChain is a grpc.Server config option that accepts multiple unary interceptors.
+// Basically syntactic sugar.
+func WithUnaryServerChain(interceptors ...grpc.UnaryServerInterceptor) grpc.ServerOption {
+ return grpc.UnaryInterceptor(ChainUnaryServer(interceptors...))
+}
+
+// WithStreamServerChain is a grpc.Server config option that accepts multiple stream interceptors.
+// Basically syntactic sugar.
+func WithStreamServerChain(interceptors ...grpc.StreamServerInterceptor) grpc.ServerOption {
+ return grpc.StreamInterceptor(ChainStreamServer(interceptors...))
+}
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/doc.go b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/doc.go
similarity index 96%
rename from vendor/github.com/mwitkow/go-grpc-middleware/doc.go
rename to vendor/github.com/grpc-ecosystem/go-grpc-middleware/doc.go
index bd6b41477c1..71689503642 100644
--- a/vendor/github.com/mwitkow/go-grpc-middleware/doc.go
+++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/doc.go
@@ -40,6 +40,8 @@ Here's an example for client side chaining:
These interceptors will be executed from left to right: monitoring and then retry logic.
+The retry interceptor will call every interceptor that follows it whenever when a retry happens.
+
Writing Your Own
Implementing your own interceptor is pretty trivial: there are interfaces for that. But the interesting
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/logging/README.md b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/logging/README.md
similarity index 100%
rename from vendor/github.com/mwitkow/go-grpc-middleware/logging/README.md
rename to vendor/github.com/grpc-ecosystem/go-grpc-middleware/logging/README.md
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/logging/logrus/README.md b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/README.md
similarity index 100%
rename from vendor/github.com/mwitkow/go-grpc-middleware/logging/logrus/README.md
rename to vendor/github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/README.md
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/logging/zap/README.md b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/README.md
similarity index 100%
rename from vendor/github.com/mwitkow/go-grpc-middleware/logging/zap/README.md
rename to vendor/github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/README.md
diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/makefile b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/makefile
new file mode 100644
index 00000000000..3e0f296b64d
--- /dev/null
+++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/makefile
@@ -0,0 +1,22 @@
+SHELL="/bin/bash"
+
+GOFILES_NOVENDOR = $(shell go list ./... | grep -v /vendor/)
+
+all: vet fmt docs test
+
+docs:
+ ./scripts/docs.sh generate
+
+checkdocs:
+ ./scripts/docs.sh check
+
+fmt:
+ go fmt $(GOFILES_NOVENDOR)
+
+vet:
+ go vet $(GOFILES_NOVENDOR)
+
+test: vet
+ ./scripts/test_all.sh
+
+.PHONY: all docs validate test
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/retry/README.md b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/recovery/README.md
similarity index 100%
rename from vendor/github.com/mwitkow/go-grpc-middleware/retry/README.md
rename to vendor/github.com/grpc-ecosystem/go-grpc-middleware/recovery/README.md
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/tags/README.md b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/retry/README.md
similarity index 100%
rename from vendor/github.com/mwitkow/go-grpc-middleware/tags/README.md
rename to vendor/github.com/grpc-ecosystem/go-grpc-middleware/retry/README.md
diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/slack.png b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/slack.png
new file mode 100644
index 00000000000..cc8f9a68a93
Binary files /dev/null and b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/slack.png differ
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/tracing/opentracing/README.md b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/tags/README.md
similarity index 100%
rename from vendor/github.com/mwitkow/go-grpc-middleware/tracing/opentracing/README.md
rename to vendor/github.com/grpc-ecosystem/go-grpc-middleware/tags/README.md
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/util/metautils/README.md b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing/README.md
similarity index 100%
rename from vendor/github.com/mwitkow/go-grpc-middleware/util/metautils/README.md
rename to vendor/github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing/README.md
diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/util/metautils/README.md b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/util/metautils/README.md
new file mode 120000
index 00000000000..71bfc07c90b
--- /dev/null
+++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/util/metautils/README.md
@@ -0,0 +1 @@
+DOC.md
\ No newline at end of file
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/wrappers.go b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/wrappers.go
similarity index 100%
rename from vendor/github.com/mwitkow/go-grpc-middleware/wrappers.go
rename to vendor/github.com/grpc-ecosystem/go-grpc-middleware/wrappers.go
diff --git a/vendor/github.com/grpc-ecosystem/grpc-opentracing/LICENSE b/vendor/github.com/grpc-ecosystem/grpc-opentracing/LICENSE
deleted file mode 100644
index abe5fe170bd..00000000000
--- a/vendor/github.com/grpc-ecosystem/grpc-opentracing/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2016, gRPC Ecosystem
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* Neither the name of grpc-opentracing nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/grpc-ecosystem/grpc-opentracing/PATENTS b/vendor/github.com/grpc-ecosystem/grpc-opentracing/PATENTS
deleted file mode 100644
index 5cfe0175ee0..00000000000
--- a/vendor/github.com/grpc-ecosystem/grpc-opentracing/PATENTS
+++ /dev/null
@@ -1,23 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the GRPC project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of GRPC, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of GRPC. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of GRPC or any code incorporated within this
-implementation of GRPC constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of GRPC
-shall terminate as of the date such litigation is filed.
-Status API Training Shop Blog About
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/.travis.yml b/vendor/github.com/mwitkow/go-grpc-middleware/.travis.yml
deleted file mode 100644
index 0d7f5bcfcc1..00000000000
--- a/vendor/github.com/mwitkow/go-grpc-middleware/.travis.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-sudo: false
-language: go
-go:
- - 1.8.x
-
-install:
- - go get google.golang.org/grpc
- - go get golang.org/x/net/context
- - go get github.com/stretchr/testify
- # for auth
- - go get golang.org/x/oauth2
- - go get cloud.google.com/go/compute/metadata
- # for logs/zap
- - go get go.uber.org/zap
- # for logs/logrus
- - go get github.com/Sirupsen/logrus
- # for field testing
- - go get github.com/gogo/protobuf/proto
- # for tracing/opentracing
- - go get github.com/opentracing/opentracing-go
-
-script:
- - ./test_all.sh
-
-after_success:
- - bash <(curl -s https://codecov.io/bash)
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/DOC.md b/vendor/github.com/mwitkow/go-grpc-middleware/DOC.md
deleted file mode 100644
index 75b6557ea0b..00000000000
--- a/vendor/github.com/mwitkow/go-grpc-middleware/DOC.md
+++ /dev/null
@@ -1,171 +0,0 @@
-# grpc_middleware
---
- import "github.com/grpc-ecosystem/go-grpc-middleware"
-
-`grpc_middleware` is a collection of gRPC middleware packages: interceptors,
-helpers and tools.
-
-
-### Middleware
-
-gRPC is a fantastic RPC middleware, which sees a lot of adoption in the Golang
-world. However, the upstream gRPC codebase is relatively bare bones.
-
-This package, and most of its child packages provides commonly needed middleware
-for gRPC: client-side interceptors for retires, server-side interceptors for
-input validation and auth, functions for chaining said interceptors, metadata
-convenience methods and more.
-
-
-### Chaining
-
-By default, gRPC doesn't allow one to have more than one interceptor either on
-the client nor on the server side. `grpc_middleware` provides convenient
-### chaining methods
-
-Simple way of turning a multiple interceptors into a single interceptor. Here's
-an example for server chaining:
-
- myServer := grpc.NewServer(
- grpc.StreamInterceptor(grpc_middleware.ChainStreamServer(loggingStream, monitoringStream, authStream)),
- grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(loggingUnary, monitoringUnary, authUnary),
- )
-
-These interceptors will be executed from left to right: logging, monitoring and
-auth.
-
-Here's an example for client side chaining:
-
- clientConn, err = grpc.Dial(
- address,
- grpc.WithUnaryInterceptor(grpc_middleware.ChainUnaryClient(monitoringClientUnary, retryUnary)),
- grpc.WithStreamInterceptor(grpc_middleware.ChainStreamClient(monitoringClientStream, retryStream)),
- )
- client = pb_testproto.NewTestServiceClient(clientConn)
- resp, err := client.PingEmpty(s.ctx, &myservice.Request{Msg: "hello"})
-
-These interceptors will be executed from left to right: monitoring and then
-retry logic.
-
-
-### Writing Your Own
-
-Implementing your own interceptor is pretty trivial: there are interfaces for
-that. But the interesting bit exposing common data to handlers (and other
-middleware), similarly to HTTP Middleware design. For example, you may want to
-### pass the identity of the caller from the auth interceptor all the way to the
-handling function.
-
-For example, a client side interceptor example for auth looks like:
-
- func FakeAuthUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
- newCtx := context.WithValue(ctx, "user_id", "john@example.com")
- return handler(newCtx, req)
- }
-
-Unfortunately, it's not as easy for streaming RPCs. These have the
-`context.Context` embedded within the `grpc.ServerStream` object. To pass values
-through context, a wrapper (`WrappedServerStream`) is needed. For example:
-
- func FakeAuthStreamingInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
- newStream := grpc_middleware.WrapServerStream(stream)
- newStream.WrappedContext = context.WithValue(ctx, "user_id", "john@example.com")
- return handler(srv, stream)
- }
-
-## Usage
-
-#### func ChainStreamClient
-
-```go
-func ChainStreamClient(interceptors ...grpc.StreamClientInterceptor) grpc.StreamClientInterceptor
-```
-ChainStreamClient creates a single interceptor out of a chain of many
-interceptors.
-
-Execution is done in left-to-right order, including passing of context. For
-example ChainStreamClient(one, two, three) will execute one before two before
-three.
-
-#### func ChainStreamServer
-
-```go
-func ChainStreamServer(interceptors ...grpc.StreamServerInterceptor) grpc.StreamServerInterceptor
-```
-ChainStreamServer creates a single interceptor out of a chain of many
-interceptors.
-
-Execution is done in left-to-right order, including passing of context. For
-example ChainUnaryServer(one, two, three) will execute one before two before
-three. If you want to pass context between interceptors, use WrapServerStream.
-
-#### func ChainUnaryClient
-
-```go
-func ChainUnaryClient(interceptors ...grpc.UnaryClientInterceptor) grpc.UnaryClientInterceptor
-```
-ChainUnaryClient creates a single interceptor out of a chain of many
-interceptors.
-
-Execution is done in left-to-right order, including passing of context. For
-example ChainUnaryClient(one, two, three) will execute one before two before
-three.
-
-#### func ChainUnaryServer
-
-```go
-func ChainUnaryServer(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
-```
-ChainUnaryServer creates a single interceptor out of a chain of many
-interceptors.
-
-Execution is done in left-to-right order, including passing of context. For
-example ChainUnaryServer(one, two, three) will execute one before two before
-three, and three will see context changes of one and two.
-
-#### func WithStreamServerChain
-
-```go
-func WithStreamServerChain(interceptors ...grpc.StreamServerInterceptor) grpc.ServerOption
-```
-WithStreamServerChain is a grpc.Server config option that accepts multiple
-stream interceptors. Basically syntactic sugar.
-
-#### func WithUnaryServerChain
-
-```go
-func WithUnaryServerChain(interceptors ...grpc.UnaryServerInterceptor) grpc.ServerOption
-```
-Chain creates a single interceptor out of a chain of many interceptors.
-
-WithUnaryServerChain is a grpc.Server config option that accepts multiple unary
-interceptors. Basically syntactic sugar.
-
-#### type WrappedServerStream
-
-```go
-type WrappedServerStream struct {
- grpc.ServerStream
- // WrappedContext is the wrapper's own Context. You can assign it.
- WrappedContext context.Context
-}
-```
-
-WrappedServerStream is a thin wrapper around grpc.ServerStream that allows
-modifying context.
-
-#### func WrapServerStream
-
-```go
-func WrapServerStream(stream grpc.ServerStream) *WrappedServerStream
-```
-WrapServerStream returns a ServerStream that has the ability to overwrite
-context.
-
-#### func (*WrappedServerStream) Context
-
-```go
-func (w *WrappedServerStream) Context() context.Context
-```
-Context returns the wrapper's WrappedContext, overwriting the nested
-grpc.ServerStream.Context()
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/chain.go b/vendor/github.com/mwitkow/go-grpc-middleware/chain.go
deleted file mode 100644
index 3252bf8ff4e..00000000000
--- a/vendor/github.com/mwitkow/go-grpc-middleware/chain.go
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2016 Michal Witkowski. All Rights Reserved.
-// See LICENSE for licensing terms.
-
-// gRPC Server Interceptor chaining middleware.
-
-package grpc_middleware
-
-import (
- "golang.org/x/net/context"
- "google.golang.org/grpc"
-)
-
-// ChainUnaryServer creates a single interceptor out of a chain of many interceptors.
-//
-// Execution is done in left-to-right order, including passing of context.
-// For example ChainUnaryServer(one, two, three) will execute one before two before three, and three
-// will see context changes of one and two.
-func ChainUnaryServer(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor {
- return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
- buildChain := func(current grpc.UnaryServerInterceptor, next grpc.UnaryHandler) grpc.UnaryHandler {
- return func(currentCtx context.Context, currentReq interface{}) (interface{}, error) {
- return current(currentCtx, currentReq, info, next)
- }
- }
- chain := handler
- for i := len(interceptors) - 1; i >= 0; i-- {
- chain = buildChain(interceptors[i], chain)
- }
- return chain(ctx, req)
- }
-}
-
-// ChainStreamServer creates a single interceptor out of a chain of many interceptors.
-//
-// Execution is done in left-to-right order, including passing of context.
-// For example ChainUnaryServer(one, two, three) will execute one before two before three.
-// If you want to pass context between interceptors, use WrapServerStream.
-func ChainStreamServer(interceptors ...grpc.StreamServerInterceptor) grpc.StreamServerInterceptor {
- return func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
- buildChain := func(current grpc.StreamServerInterceptor, next grpc.StreamHandler) grpc.StreamHandler {
- return func(currentSrv interface{}, currentStream grpc.ServerStream) error {
- return current(currentSrv, currentStream, info, next)
- }
- }
- chain := handler
- for i := len(interceptors) - 1; i >= 0; i-- {
- chain = buildChain(interceptors[i], chain)
- }
- return chain(srv, stream)
- }
-}
-
-// ChainUnaryClient creates a single interceptor out of a chain of many interceptors.
-//
-// Execution is done in left-to-right order, including passing of context.
-// For example ChainUnaryClient(one, two, three) will execute one before two before three.
-func ChainUnaryClient(interceptors ...grpc.UnaryClientInterceptor) grpc.UnaryClientInterceptor {
- return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
- buildChain := func(current grpc.UnaryClientInterceptor, next grpc.UnaryInvoker) grpc.UnaryInvoker {
- return func(currentCtx context.Context, currentMethod string, currentReq, currentRepl interface{}, currentConn *grpc.ClientConn, currentOpts ...grpc.CallOption) error {
- return current(currentCtx, currentMethod, currentReq, currentRepl, currentConn, next, currentOpts...)
- }
- }
- chain := invoker
- for i := len(interceptors) - 1; i >= 0; i-- {
- chain = buildChain(interceptors[i], chain)
- }
- return chain(ctx, method, req, reply, cc, opts...)
- }
-}
-
-// ChainStreamClient creates a single interceptor out of a chain of many interceptors.
-//
-// Execution is done in left-to-right order, including passing of context.
-// For example ChainStreamClient(one, two, three) will execute one before two before three.
-func ChainStreamClient(interceptors ...grpc.StreamClientInterceptor) grpc.StreamClientInterceptor {
- return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {
- buildChain := func(current grpc.StreamClientInterceptor, next grpc.Streamer) grpc.Streamer {
- return func(currentCtx context.Context, currentDesc *grpc.StreamDesc, currentConn *grpc.ClientConn, currentMethod string, currentOpts ...grpc.CallOption) (grpc.ClientStream, error) {
- return current(currentCtx, currentDesc, currentConn, currentMethod, next, currentOpts...)
- }
- }
- chain := streamer
- for i := len(interceptors) - 1; i >= 0; i-- {
- chain = buildChain(interceptors[i], chain)
- }
- return chain(ctx, desc, cc, method, opts...)
- }
-}
-
-// Chain creates a single interceptor out of a chain of many interceptors.
-//
-// WithUnaryServerChain is a grpc.Server config option that accepts multiple unary interceptors.
-// Basically syntactic sugar.
-func WithUnaryServerChain(interceptors ...grpc.UnaryServerInterceptor) grpc.ServerOption {
- return grpc.UnaryInterceptor(ChainUnaryServer(interceptors...))
-}
-
-// WithStreamServerChain is a grpc.Server config option that accepts multiple stream interceptors.
-// Basically syntactic sugar.
-func WithStreamServerChain(interceptors ...grpc.StreamServerInterceptor) grpc.ServerOption {
- return grpc.StreamInterceptor(ChainStreamServer(interceptors...))
-}
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/checkup.sh b/vendor/github.com/mwitkow/go-grpc-middleware/checkup.sh
deleted file mode 100755
index 37e9aac6eb5..00000000000
--- a/vendor/github.com/mwitkow/go-grpc-middleware/checkup.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-# Script that checks up code (govet).
-
-SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
-
-function print_real_go_files {
- grep --files-without-match 'DO NOT EDIT!' $(find . -iname '*.go')
-}
-
-function govet_all {
- ret=0
- for i in $(print_real_go_files); do
- output=$(go tool vet -all=true -tests=false ${i})
- ret=$(($ret | $?))
- echo -n ${output}
- done;
- return ${ret}
-}
-
-govet_all
-echo "returning $?"
\ No newline at end of file
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/fixup.sh b/vendor/github.com/mwitkow/go-grpc-middleware/fixup.sh
deleted file mode 100755
index 5b4a66ade7a..00000000000
--- a/vendor/github.com/mwitkow/go-grpc-middleware/fixup.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-# Script that checks the code for errors.
-
-SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
-
-function print_real_go_files {
- grep --files-without-match 'DO NOT EDIT!' $(find . -iname '*.go')
-}
-
-function generate_markdown {
- echo "Generating markdown"
- oldpwd=$(pwd)
- for i in $(find . -iname 'doc.go'); do
- dir=${i%/*}
- echo "$dir"
- cd ${dir}
- ${GOPATH}/bin/godocdown -heading=Title -o DOC.md
- ln -s DOC.md README.md 2> /dev/null # can fail
- cd ${oldpwd}
- done;
-}
-
-function goimports_all {
- echo "Running goimports"
- goimports -l -w $(print_real_go_files)
- return $?
-}
-
-generate_markdown
-goimports_all
-echo "returning $?"
\ No newline at end of file
diff --git a/vendor/github.com/mwitkow/go-grpc-middleware/test_all.sh b/vendor/github.com/mwitkow/go-grpc-middleware/test_all.sh
deleted file mode 100755
index e1e78008062..00000000000
--- a/vendor/github.com/mwitkow/go-grpc-middleware/test_all.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-echo "" > coverage.txt
-
-for d in $(go list ./... | grep -v vendor); do
- echo -e "TESTS FOR: for \033[0;35m${d}\033[0m"
- go test -race -v -coverprofile=profile.coverage.out -covermode=atomic $d
- if [ -f profile.coverage.out ]; then
- cat profile.coverage.out >> coverage.txt
- rm profile.coverage.out
- fi
- echo ""
-done
diff --git a/vendor/github.com/opentracing-contrib/go-grpc/.gitignore b/vendor/github.com/opentracing-contrib/go-grpc/.gitignore
new file mode 100644
index 00000000000..f1c181ec9c5
--- /dev/null
+++ b/vendor/github.com/opentracing-contrib/go-grpc/.gitignore
@@ -0,0 +1,12 @@
+# Binaries for programs and plugins
+*.exe
+*.exe~
+*.dll
+*.so
+*.dylib
+
+# Test binary, build with `go test -c`
+*.test
+
+# Output of the go coverage tool, specifically when used with LiteIDE
+*.out
diff --git a/vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/README.md b/vendor/github.com/opentracing-contrib/go-grpc/README.md
similarity index 89%
rename from vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/README.md
rename to vendor/github.com/opentracing-contrib/go-grpc/README.md
index 78c49dbbeaa..e6b10658081 100644
--- a/vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/README.md
+++ b/vendor/github.com/opentracing-contrib/go-grpc/README.md
@@ -6,13 +6,13 @@ systems in Go.
## Installation
```
-go get github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc
+go get github.com/opentracing-contrib/go-grpc
```
## Documentation
See the basic usage examples below and the [package documentation on
-godoc.org](https://godoc.org/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc).
+godoc.org](https://godoc.org/github.com/opentracing-contrib/go-grpc).
## Client-side usage example
diff --git a/vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/client.go b/vendor/github.com/opentracing-contrib/go-grpc/client.go
similarity index 100%
rename from vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/client.go
rename to vendor/github.com/opentracing-contrib/go-grpc/client.go
diff --git a/vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/errors.go b/vendor/github.com/opentracing-contrib/go-grpc/errors.go
similarity index 97%
rename from vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/errors.go
rename to vendor/github.com/opentracing-contrib/go-grpc/errors.go
index 41a6346f250..2f202af726b 100644
--- a/vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/errors.go
+++ b/vendor/github.com/opentracing-contrib/go-grpc/errors.go
@@ -63,7 +63,7 @@ func SetSpanTags(span opentracing.Span, err error, client bool) {
if err == nil {
return
}
- if client || c == ServerError {
+ if c != Success && (client || c == ServerError) {
ext.Error.Set(span, true)
}
}
diff --git a/vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/options.go b/vendor/github.com/opentracing-contrib/go-grpc/options.go
similarity index 100%
rename from vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/options.go
rename to vendor/github.com/opentracing-contrib/go-grpc/options.go
diff --git a/vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/package.go b/vendor/github.com/opentracing-contrib/go-grpc/package.go
similarity index 62%
rename from vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/package.go
rename to vendor/github.com/opentracing-contrib/go-grpc/package.go
index 4ff3d199783..8953a55c43c 100644
--- a/vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/package.go
+++ b/vendor/github.com/opentracing-contrib/go-grpc/package.go
@@ -1,5 +1,5 @@
// Package otgrpc provides OpenTracing support for any gRPC client or server.
//
// See the README for simple usage examples:
-// https://github.com/grpc-ecosystem/grpc-opentracing/blob/master/go/otgrpc/README.md
+// https://github.com/opentracing-contrib/go-grpc/README.md
package otgrpc
diff --git a/vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/server.go b/vendor/github.com/opentracing-contrib/go-grpc/server.go
similarity index 100%
rename from vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/server.go
rename to vendor/github.com/opentracing-contrib/go-grpc/server.go
diff --git a/vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/shared.go b/vendor/github.com/opentracing-contrib/go-grpc/shared.go
similarity index 100%
rename from vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/shared.go
rename to vendor/github.com/opentracing-contrib/go-grpc/shared.go
diff --git a/vendor/github.com/weaveworks/common/httpgrpc/server/server.go b/vendor/github.com/weaveworks/common/httpgrpc/server/server.go
index 8f556c3abb6..b2676016a4e 100644
--- a/vendor/github.com/weaveworks/common/httpgrpc/server/server.go
+++ b/vendor/github.com/weaveworks/common/httpgrpc/server/server.go
@@ -11,8 +11,8 @@ import (
"strings"
"sync"
- "github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc"
- "github.com/mwitkow/go-grpc-middleware"
+ "github.com/grpc-ecosystem/go-grpc-middleware"
+ otgrpc "github.com/opentracing-contrib/go-grpc"
"github.com/opentracing/opentracing-go"
"github.com/sercand/kuberesolver"
"golang.org/x/net/context"
@@ -91,13 +91,17 @@ func ParseURL(unparsed string) (string, []grpc.DialOption, error) {
if err != nil {
return "", nil, err
}
- parts := strings.SplitN(host, ".", 2)
- service, namespace := parts[0], "default"
- if len(parts) == 2 {
+ parts := strings.SplitN(host, ".", 3)
+ service, namespace, domain := parts[0], "default", ""
+ if len(parts) > 1 {
namespace = parts[1]
+ domain = "." + namespace
+ }
+ if len(parts) > 2 {
+ domain = domain + "." + parts[2]
}
balancer := kuberesolver.NewWithNamespace(namespace)
- address := fmt.Sprintf("kubernetes://%s:%s", service, port)
+ address := fmt.Sprintf("kubernetes://%s%s:%s", service, domain, port)
dialOptions := []grpc.DialOption{balancer.DialOption()}
return address, dialOptions, nil
diff --git a/vendor/github.com/weaveworks/common/server/server.go b/vendor/github.com/weaveworks/common/server/server.go
index e252f81ca36..5d882afb2fa 100644
--- a/vendor/github.com/weaveworks/common/server/server.go
+++ b/vendor/github.com/weaveworks/common/server/server.go
@@ -9,8 +9,8 @@ import (
"time"
"github.com/gorilla/mux"
- "github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc"
- "github.com/mwitkow/go-grpc-middleware"
+ "github.com/grpc-ecosystem/go-grpc-middleware"
+ otgrpc "github.com/opentracing-contrib/go-grpc"
"github.com/opentracing/opentracing-go"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/net/context"