From 7f28edf9c72e7c0a80ee2d1b323342b706db0b5c Mon Sep 17 00:00:00 2001 From: radekg Date: Sat, 28 Sep 2019 21:21:10 +0200 Subject: [PATCH 01/10] Add bearer token forward to the GRPC storage plugin Signed-off-by: radekg --- plugin/storage/grpc/config/config.go | 7 +- plugin/storage/grpc/options.go | 3 + plugin/storage/grpc/proto/storage.proto | 8 +- plugin/storage/grpc/shared/grpc_client.go | 30 +- plugin/storage/grpc/shared/grpc_server.go | 26 +- plugin/storage/grpc/shared/interface.go | 22 +- proto-gen/storage_v1/storage.pb.go | 368 ++++++++++++++++++---- 7 files changed, 383 insertions(+), 81 deletions(-) diff --git a/plugin/storage/grpc/config/config.go b/plugin/storage/grpc/config/config.go index e8890d360a5..4a30af7eb76 100644 --- a/plugin/storage/grpc/config/config.go +++ b/plugin/storage/grpc/config/config.go @@ -19,8 +19,8 @@ import ( "os/exec" "runtime" - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" + hclog "github.com/hashicorp/go-hclog" + plugin "github.com/hashicorp/go-plugin" "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" ) @@ -29,6 +29,7 @@ import ( type Configuration struct { PluginBinary string `yaml:"binary"` PluginConfigurationFile string `yaml:"configuration-file"` + AllowTokenFromContext bool `yaml:"allow-token-from-context"` } // Build instantiates a StoragePlugin @@ -39,7 +40,7 @@ func (c *Configuration) Build() (shared.StoragePlugin, error) { client := plugin.NewClient(&plugin.ClientConfig{ HandshakeConfig: shared.Handshake, VersionedPlugins: map[int]plugin.PluginSet{ - 1: shared.PluginMap, + 1: shared.GetPluginMap(c.AllowTokenFromContext), }, Cmd: cmd, AllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC}, diff --git a/plugin/storage/grpc/options.go b/plugin/storage/grpc/options.go index 82cac8d9311..24b56594e7f 100644 --- a/plugin/storage/grpc/options.go +++ b/plugin/storage/grpc/options.go @@ -17,6 +17,7 @@ package grpc import ( "flag" + "github.com/jaegertracing/jaeger/storage/spanstore" "github.com/spf13/viper" "github.com/jaegertracing/jaeger/plugin/storage/grpc/config" @@ -41,4 +42,6 @@ func (opt *Options) AddFlags(flagSet *flag.FlagSet) { func (opt *Options) InitFromViper(v *viper.Viper) { opt.Configuration.PluginBinary = v.GetString(pluginBinary) opt.Configuration.PluginConfigurationFile = v.GetString(pluginConfigurationFile) + // TODO: Need to figure out a better way for do this. (same as ElasticSearch storage) + opt.Configuration.AllowTokenFromContext = v.GetBool(spanstore.StoragePropagationKey) } diff --git a/plugin/storage/grpc/proto/storage.proto b/plugin/storage/grpc/proto/storage.proto index 0c347883dcf..9cfe3102965 100644 --- a/plugin/storage/grpc/proto/storage.proto +++ b/plugin/storage/grpc/proto/storage.proto @@ -66,9 +66,12 @@ message GetTraceRequest { (gogoproto.customtype) = "github.com/jaegertracing/jaeger/model.TraceID", (gogoproto.customname) = "TraceID" ]; + string bearerToken = 2; } -message GetServicesRequest {} +message GetServicesRequest { + string bearerToken = 1; +} message GetServicesResponse { repeated string services = 1; @@ -76,6 +79,7 @@ message GetServicesResponse { message GetOperationsRequest { string service = 1; + string bearerToken = 2; } message GetOperationsResponse { @@ -107,6 +111,7 @@ message TraceQueryParameters { message FindTracesRequest { TraceQueryParameters query = 1; + string bearerToken = 2; } message SpansResponseChunk { @@ -117,6 +122,7 @@ message SpansResponseChunk { message FindTraceIDsRequest { TraceQueryParameters query = 1; + string bearerToken = 2; } message FindTraceIDsResponse { diff --git a/plugin/storage/grpc/shared/grpc_client.go b/plugin/storage/grpc/shared/grpc_client.go index 8cf0f6edfa2..68094d580a0 100644 --- a/plugin/storage/grpc/shared/grpc_client.go +++ b/plugin/storage/grpc/shared/grpc_client.go @@ -29,9 +29,20 @@ import ( // grpcClient implements shared.StoragePlugin and reads/writes spans and dependencies type grpcClient struct { - readerClient storage_v1.SpanReaderPluginClient - writerClient storage_v1.SpanWriterPluginClient - depsReaderClient storage_v1.DependenciesReaderPluginClient + allowTokenFromContext bool + readerClient storage_v1.SpanReaderPluginClient + writerClient storage_v1.SpanWriterPluginClient + depsReaderClient storage_v1.DependenciesReaderPluginClient +} + +// getBearerTokenToForward determines is there is a bearer token to forward +// and returns it only when it, only when bearer token forward is allowed. +func (c *grpcClient) getBearerTokenToForward(ctx context.Context) string { + ctxBearerToken, hasToken := spanstore.GetBearerToken(ctx) + if hasToken && c.allowTokenFromContext { + return ctxBearerToken + } + return "" } // DependencyReader implements shared.StoragePlugin. @@ -51,8 +62,10 @@ func (c *grpcClient) SpanWriter() spanstore.Writer { // GetTrace takes a traceID and returns a Trace associated with that traceID func (c *grpcClient) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { + stream, err := c.readerClient.GetTrace(ctx, &storage_v1.GetTraceRequest{ - TraceID: traceID, + TraceID: traceID, + BearerToken: c.getBearerTokenToForward(ctx), }) if err != nil { return nil, errors.Wrap(err, "plugin error") @@ -74,7 +87,9 @@ func (c *grpcClient) GetTrace(ctx context.Context, traceID model.TraceID) (*mode // GetServices returns a list of all known services func (c *grpcClient) GetServices(ctx context.Context) ([]string, error) { - resp, err := c.readerClient.GetServices(ctx, &storage_v1.GetServicesRequest{}) + resp, err := c.readerClient.GetServices(ctx, &storage_v1.GetServicesRequest{ + BearerToken: c.getBearerTokenToForward(ctx), + }) if err != nil { return nil, errors.Wrap(err, "plugin error") } @@ -85,7 +100,8 @@ func (c *grpcClient) GetServices(ctx context.Context) ([]string, error) { // GetOperations returns the operations of a given service func (c *grpcClient) GetOperations(ctx context.Context, service string) ([]string, error) { resp, err := c.readerClient.GetOperations(ctx, &storage_v1.GetOperationsRequest{ - Service: service, + Service: service, + BearerToken: c.getBearerTokenToForward(ctx), }) if err != nil { return nil, errors.Wrap(err, "plugin error") @@ -107,6 +123,7 @@ func (c *grpcClient) FindTraces(ctx context.Context, query *spanstore.TraceQuery DurationMax: query.DurationMax, NumTraces: int32(query.NumTraces), }, + BearerToken: c.getBearerTokenToForward(ctx), }) if err != nil { return nil, errors.Wrap(err, "plugin error") @@ -145,6 +162,7 @@ func (c *grpcClient) FindTraceIDs(ctx context.Context, query *spanstore.TraceQue DurationMax: query.DurationMax, NumTraces: int32(query.NumTraces), }, + BearerToken: c.getBearerTokenToForward(ctx), }) if err != nil { return nil, errors.Wrap(err, "plugin error") diff --git a/plugin/storage/grpc/shared/grpc_server.go b/plugin/storage/grpc/shared/grpc_server.go index 1db0ee1aa28..1e0d403686c 100644 --- a/plugin/storage/grpc/shared/grpc_server.go +++ b/plugin/storage/grpc/shared/grpc_server.go @@ -31,6 +31,17 @@ type grpcServer struct { Impl StoragePlugin } +// getMaybeBearerTokenContext returns a context with bearer token, if token string is not empty +// the assumption is that if the token has arrived on the wire, the grpcClient +// verified that bearer token forward was enabled. +// If token is empty, returns original context. +func (s *grpcServer) getMaybeBearerTokenContext(ctx context.Context, token string) context.Context { + if token != "" { + return spanstore.ContextWithBearerToken(ctx, token) + } + return ctx +} + // GetDependencies returns all interservice dependencies func (s *grpcServer) GetDependencies(ctx context.Context, r *storage_v1.GetDependenciesRequest) (*storage_v1.GetDependenciesResponse, error) { deps, err := s.Impl.DependencyReader().GetDependencies(r.EndTime, r.EndTime.Sub(r.StartTime)) @@ -53,7 +64,8 @@ func (s *grpcServer) WriteSpan(ctx context.Context, r *storage_v1.WriteSpanReque // GetTrace takes a traceID and streams a Trace associated with that traceID func (s *grpcServer) GetTrace(r *storage_v1.GetTraceRequest, stream storage_v1.SpanReaderPlugin_GetTraceServer) error { - trace, err := s.Impl.SpanReader().GetTrace(stream.Context(), r.TraceID) + opCtx := s.getMaybeBearerTokenContext(stream.Context(), r.BearerToken) + trace, err := s.Impl.SpanReader().GetTrace(opCtx, r.TraceID) if err != nil { return err } @@ -68,7 +80,8 @@ func (s *grpcServer) GetTrace(r *storage_v1.GetTraceRequest, stream storage_v1.S // GetServices returns a list of all known services func (s *grpcServer) GetServices(ctx context.Context, r *storage_v1.GetServicesRequest) (*storage_v1.GetServicesResponse, error) { - services, err := s.Impl.SpanReader().GetServices(ctx) + opCtx := s.getMaybeBearerTokenContext(ctx, r.BearerToken) + services, err := s.Impl.SpanReader().GetServices(opCtx) if err != nil { return nil, err } @@ -79,7 +92,8 @@ func (s *grpcServer) GetServices(ctx context.Context, r *storage_v1.GetServicesR // GetOperations returns the operations of a given service func (s *grpcServer) GetOperations(ctx context.Context, r *storage_v1.GetOperationsRequest) (*storage_v1.GetOperationsResponse, error) { - operations, err := s.Impl.SpanReader().GetOperations(ctx, r.Service) + opCtx := s.getMaybeBearerTokenContext(ctx, r.BearerToken) + operations, err := s.Impl.SpanReader().GetOperations(opCtx, r.Service) if err != nil { return nil, err } @@ -90,7 +104,8 @@ func (s *grpcServer) GetOperations(ctx context.Context, r *storage_v1.GetOperati // FindTraces streams traces that match the traceQuery func (s *grpcServer) FindTraces(r *storage_v1.FindTracesRequest, stream storage_v1.SpanReaderPlugin_FindTracesServer) error { - traces, err := s.Impl.SpanReader().FindTraces(stream.Context(), &spanstore.TraceQueryParameters{ + opCtx := s.getMaybeBearerTokenContext(stream.Context(), r.BearerToken) + traces, err := s.Impl.SpanReader().FindTraces(opCtx, &spanstore.TraceQueryParameters{ ServiceName: r.Query.ServiceName, OperationName: r.Query.OperationName, Tags: r.Query.Tags, @@ -116,7 +131,8 @@ func (s *grpcServer) FindTraces(r *storage_v1.FindTracesRequest, stream storage_ // FindTraceIDs retrieves traceIDs that match the traceQuery func (s *grpcServer) FindTraceIDs(ctx context.Context, r *storage_v1.FindTraceIDsRequest) (*storage_v1.FindTraceIDsResponse, error) { - traceIDs, err := s.Impl.SpanReader().FindTraceIDs(ctx, &spanstore.TraceQueryParameters{ + opCtx := s.getMaybeBearerTokenContext(ctx, r.BearerToken) + traceIDs, err := s.Impl.SpanReader().FindTraceIDs(opCtx, &spanstore.TraceQueryParameters{ ServiceName: r.Query.ServiceName, OperationName: r.Query.OperationName, Tags: r.Query.Tags, diff --git a/plugin/storage/grpc/shared/interface.go b/plugin/storage/grpc/shared/interface.go index 24d62854151..58139fc67d3 100644 --- a/plugin/storage/grpc/shared/interface.go +++ b/plugin/storage/grpc/shared/interface.go @@ -17,7 +17,7 @@ package shared import ( "context" - "github.com/hashicorp/go-plugin" + plugin "github.com/hashicorp/go-plugin" "google.golang.org/grpc" "github.com/jaegertracing/jaeger/proto-gen/storage_v1" @@ -34,9 +34,13 @@ var Handshake = plugin.HandshakeConfig{ MagicCookieValue: "jaeger", } -// PluginMap is the map of plugins we can dispense. -var PluginMap = map[string]plugin.Plugin{ - StoragePluginIdentifier: &StorageGRPCPlugin{}, +// GetPluginMap returns a plugin map. +func GetPluginMap(allowTokenFromContext bool) map[string]plugin.Plugin { + return map[string]plugin.Plugin{ + StoragePluginIdentifier: &StorageGRPCPlugin{ + allowTokenFromContext: allowTokenFromContext, + }, + } } // StoragePlugin is the interface we're exposing as a plugin. @@ -48,6 +52,7 @@ type StoragePlugin interface { // StorageGRPCPlugin is the implementation of plugin.GRPCPlugin so we can serve/consume this. type StorageGRPCPlugin struct { + allowTokenFromContext bool plugin.Plugin // Concrete implementation, written in Go. This is only used for plugins // that are written in Go. @@ -64,10 +69,11 @@ func (p *StorageGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server } // GRPCClient is used by go-plugin to create a grpc plugin client -func (*StorageGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) { +func (p *StorageGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) { return &grpcClient{ - readerClient: storage_v1.NewSpanReaderPluginClient(c), - writerClient: storage_v1.NewSpanWriterPluginClient(c), - depsReaderClient: storage_v1.NewDependenciesReaderPluginClient(c), + allowTokenFromContext: p.allowTokenFromContext, + readerClient: storage_v1.NewSpanReaderPluginClient(c), + writerClient: storage_v1.NewSpanWriterPluginClient(c), + depsReaderClient: storage_v1.NewDependenciesReaderPluginClient(c), }, nil } diff --git a/proto-gen/storage_v1/storage.pb.go b/proto-gen/storage_v1/storage.pb.go index 4452ef3c715..6c928d9fc3d 100644 --- a/proto-gen/storage_v1/storage.pb.go +++ b/proto-gen/storage_v1/storage.pb.go @@ -223,6 +223,7 @@ var xxx_messageInfo_WriteSpanResponse proto.InternalMessageInfo type GetTraceRequest struct { TraceID github_com_jaegertracing_jaeger_model.TraceID `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3,customtype=github.com/jaegertracing/jaeger/model.TraceID" json:"trace_id"` + BearerToken string `protobuf:"bytes,2,opt,name=bearerToken,proto3" json:"bearerToken,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -261,7 +262,15 @@ func (m *GetTraceRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetTraceRequest proto.InternalMessageInfo +func (m *GetTraceRequest) GetBearerToken() string { + if m != nil { + return m.BearerToken + } + return "" +} + type GetServicesRequest struct { + BearerToken string `protobuf:"bytes,1,opt,name=bearerToken,proto3" json:"bearerToken,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -300,6 +309,13 @@ func (m *GetServicesRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetServicesRequest proto.InternalMessageInfo +func (m *GetServicesRequest) GetBearerToken() string { + if m != nil { + return m.BearerToken + } + return "" +} + type GetServicesResponse struct { Services []string `protobuf:"bytes,1,rep,name=services,proto3" json:"services,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -349,6 +365,7 @@ func (m *GetServicesResponse) GetServices() []string { type GetOperationsRequest struct { Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` + BearerToken string `protobuf:"bytes,2,opt,name=bearerToken,proto3" json:"bearerToken,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -394,6 +411,13 @@ func (m *GetOperationsRequest) GetService() string { return "" } +func (m *GetOperationsRequest) GetBearerToken() string { + if m != nil { + return m.BearerToken + } + return "" +} + type GetOperationsResponse struct { Operations []string `protobuf:"bytes,1,rep,name=operations,proto3" json:"operations,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -546,6 +570,7 @@ func (m *TraceQueryParameters) GetNumTraces() int32 { type FindTracesRequest struct { Query *TraceQueryParameters `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + BearerToken string `protobuf:"bytes,2,opt,name=bearerToken,proto3" json:"bearerToken,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -591,6 +616,13 @@ func (m *FindTracesRequest) GetQuery() *TraceQueryParameters { return nil } +func (m *FindTracesRequest) GetBearerToken() string { + if m != nil { + return m.BearerToken + } + return "" +} + type SpansResponseChunk struct { Spans []model.Span `protobuf:"bytes,1,rep,name=spans,proto3" json:"spans"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -640,6 +672,7 @@ func (m *SpansResponseChunk) GetSpans() []model.Span { type FindTraceIDsRequest struct { Query *TraceQueryParameters `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + BearerToken string `protobuf:"bytes,2,opt,name=bearerToken,proto3" json:"bearerToken,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -685,6 +718,13 @@ func (m *FindTraceIDsRequest) GetQuery() *TraceQueryParameters { return nil } +func (m *FindTraceIDsRequest) GetBearerToken() string { + if m != nil { + return m.BearerToken + } + return "" +} + type FindTraceIDsResponse struct { TraceIDs []github_com_jaegertracing_jaeger_model.TraceID `protobuf:"bytes,1,rep,name=trace_ids,json=traceIds,proto3,customtype=github.com/jaegertracing/jaeger/model.TraceID" json:"trace_ids"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -762,64 +802,66 @@ func init() { proto.RegisterFile("storage.proto", fileDescriptor_0d2c4ccf1453ffd func init() { golang_proto.RegisterFile("storage.proto", fileDescriptor_0d2c4ccf1453ffdb) } var fileDescriptor_0d2c4ccf1453ffdb = []byte{ - // 905 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0xc7, 0x6d, 0xb2, 0x71, 0x5e, 0xd2, 0xa5, 0x9d, 0x06, 0x30, 0x16, 0x9b, 0x14, 0x43, 0xb7, - 0x05, 0x09, 0x67, 0x1b, 0x0e, 0x8b, 0x40, 0x08, 0xc8, 0xa6, 0x1b, 0x15, 0xf1, 0x67, 0xf1, 0x46, - 0xac, 0xc4, 0x22, 0xac, 0x49, 0x3c, 0xb8, 0xde, 0xc6, 0x63, 0xaf, 0x3d, 0x8e, 0x92, 0x3b, 0x1f, - 0x80, 0x23, 0x27, 0xae, 0x7c, 0x0d, 0x8e, 0x7b, 0xe4, 0xcc, 0xa1, 0xa0, 0x70, 0xe4, 0x4b, 0x20, - 0xcf, 0x8c, 0xdd, 0xfc, 0xb1, 0xb6, 0xdd, 0x8a, 0x9b, 0xe7, 0xcd, 0xef, 0xfd, 0xde, 0x9b, 0xf7, - 0xe7, 0x97, 0xc0, 0x56, 0xcc, 0x82, 0x08, 0xbb, 0xc4, 0x0c, 0xa3, 0x80, 0x05, 0x68, 0xe7, 0x09, - 0x26, 0x2e, 0x89, 0xcc, 0xcc, 0x3a, 0x39, 0xd2, 0x1b, 0x6e, 0xe0, 0x06, 0xfc, 0xb6, 0x9d, 0x7e, - 0x09, 0xa0, 0xde, 0x72, 0x83, 0xc0, 0x1d, 0x93, 0x36, 0x3f, 0x0d, 0x93, 0x1f, 0xdb, 0xcc, 0xf3, - 0x49, 0xcc, 0xb0, 0x1f, 0x4a, 0x40, 0x73, 0x15, 0xe0, 0x24, 0x11, 0x66, 0x5e, 0x40, 0x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 0x95, 0xee, 0xfd, 0xff, 0x02, 0x00, 0x00, 0xff, - 0xff, 0x7d, 0x2c, 0x50, 0x42, 0x9b, 0x09, 0x00, 0x00, + // 930 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x73, 0xdb, 0x44, + 0x14, 0x47, 0x8d, 0x5d, 0xdb, 0xcf, 0x4e, 0x49, 0x36, 0x06, 0x84, 0x86, 0xda, 0x41, 0x90, 0x26, + 0x30, 0x83, 0x4c, 0xcc, 0x0c, 0x65, 0x60, 0x18, 0xc0, 0x4d, 0xea, 0x09, 0xc3, 0x9f, 0xa2, 0x66, + 0xe8, 0x0c, 0x65, 0xf0, 0xac, 0xa3, 0x87, 0xa2, 0x26, 0x5a, 0xb9, 0xd2, 0xca, 0x93, 0xdc, 0xf9, + 0x00, 0x3d, 0x72, 0xe2, 0xca, 0xd7, 0xe0, 0xd8, 0x23, 0x67, 0x0e, 0x81, 0x09, 0x47, 0xbe, 0x04, + 0xa3, 0xdd, 0x95, 0x22, 0xcb, 0x9a, 0xc6, 0xcd, 0xa1, 0x37, 0xed, 0xdb, 0xdf, 0xfb, 0xbd, 0xb7, + 0xef, 0xcf, 0xcf, 0x86, 0xe5, 0x88, 0x07, 0x21, 0x75, 0xd1, 0x9a, 0x84, 0x01, 0x0f, 0xc8, 0xea, + 0x23, 0x8a, 0x2e, 0x86, 0x56, 0x6a, 0x9d, 0x6e, 0x1b, 0x6d, 0x37, 0x70, 0x03, 0x71, 0xdb, 0x4b, + 0xbe, 0x24, 0xd0, 0xe8, 0xba, 0x41, 0xe0, 0x1e, 0x63, 0x4f, 0x9c, 0xc6, 0xf1, 0xcf, 0x3d, 0xee, + 0xf9, 0x18, 0x71, 0xea, 0x4f, 0x14, 0xa0, 0x53, 0x04, 0x38, 0x71, 0x48, 0xb9, 0x17, 0x30, 0x75, + 0xdf, 0xf4, 0x03, 0x07,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 0x9e, 0x77, 0xb4, 0x3f, 0xcf, 0x3b, + 0xda, 0x3f, 0xe7, 0x1d, 0xed, 0x8f, 0x7f, 0x3b, 0xda, 0x0f, 0xa0, 0xbc, 0x46, 0xd3, 0xed, 0xf1, + 0x75, 0xa1, 0x96, 0x1f, 0xfc, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x49, 0x09, 0xb9, 0x65, 0x46, 0x0a, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1360,6 +1402,12 @@ func (m *GetTraceRequest) MarshalTo(dAtA []byte) (int, error) { return 0, err } i += n4 + if len(m.BearerToken) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintStorage(dAtA, i, uint64(len(m.BearerToken))) + i += copy(dAtA[i:], m.BearerToken) + } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -1381,6 +1429,12 @@ func (m *GetServicesRequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.BearerToken) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(len(m.BearerToken))) + i += copy(dAtA[i:], m.BearerToken) + } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -1444,6 +1498,12 @@ func (m *GetOperationsRequest) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintStorage(dAtA, i, uint64(len(m.Service))) i += copy(dAtA[i:], m.Service) } + if len(m.BearerToken) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintStorage(dAtA, i, uint64(len(m.BearerToken))) + i += copy(dAtA[i:], m.BearerToken) + } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -1598,6 +1658,12 @@ func (m *FindTracesRequest) MarshalTo(dAtA []byte) (int, error) { } i += n9 } + if len(m.BearerToken) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintStorage(dAtA, i, uint64(len(m.BearerToken))) + i += copy(dAtA[i:], m.BearerToken) + } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -1662,6 +1728,12 @@ func (m *FindTraceIDsRequest) MarshalTo(dAtA []byte) (int, error) { } i += n10 } + if len(m.BearerToken) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintStorage(dAtA, i, uint64(len(m.BearerToken))) + i += copy(dAtA[i:], m.BearerToken) + } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -1780,6 +1852,10 @@ func (m *GetTraceRequest) Size() (n int) { _ = l l = m.TraceID.Size() n += 1 + l + sovStorage(uint64(l)) + l = len(m.BearerToken) + if l > 0 { + n += 1 + l + sovStorage(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1792,6 +1868,10 @@ func (m *GetServicesRequest) Size() (n int) { } var l int _ = l + l = len(m.BearerToken) + if l > 0 { + n += 1 + l + sovStorage(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1826,6 +1906,10 @@ func (m *GetOperationsRequest) Size() (n int) { if l > 0 { n += 1 + l + sovStorage(uint64(l)) } + l = len(m.BearerToken) + if l > 0 { + n += 1 + l + sovStorage(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1899,6 +1983,10 @@ func (m *FindTracesRequest) Size() (n int) { l = m.Query.Size() n += 1 + l + sovStorage(uint64(l)) } + l = len(m.BearerToken) + if l > 0 { + n += 1 + l + sovStorage(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1933,6 +2021,10 @@ func (m *FindTraceIDsRequest) Size() (n int) { l = m.Query.Size() n += 1 + l + sovStorage(uint64(l)) } + l = len(m.BearerToken) + if l > 0 { + n += 1 + l + sovStorage(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2384,6 +2476,38 @@ func (m *GetTraceRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BearerToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStorage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BearerToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipStorage(dAtA[iNdEx:]) @@ -2438,6 +2562,38 @@ func (m *GetServicesRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: GetServicesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BearerToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStorage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BearerToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipStorage(dAtA[iNdEx:]) @@ -2610,6 +2766,38 @@ func (m *GetOperationsRequest) Unmarshal(dAtA []byte) error { } m.Service = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BearerToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStorage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BearerToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipStorage(dAtA[iNdEx:]) @@ -3182,6 +3370,38 @@ func (m *FindTracesRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BearerToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStorage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BearerToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipStorage(dAtA[iNdEx:]) @@ -3360,6 +3580,38 @@ func (m *FindTraceIDsRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BearerToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStorage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BearerToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipStorage(dAtA[iNdEx:]) From 69d25d5efbcf2f4c371667158ebf1de53a152d29 Mon Sep 17 00:00:00 2001 From: radekg Date: Mon, 30 Sep 2019 11:29:36 +0200 Subject: [PATCH 02/10] Apply the changes suggested by @yurishkuro in the review Signed-off-by: radekg --- plugin/storage/grpc/config/config.go | 7 +- plugin/storage/grpc/options.go | 3 - plugin/storage/grpc/proto/storage.proto | 8 +- plugin/storage/grpc/shared/grpc_client.go | 45 ++- plugin/storage/grpc/shared/grpc_server.go | 26 +- plugin/storage/grpc/shared/interface.go | 22 +- proto-gen/storage_v1/storage.pb.go | 368 ++++------------------ 7 files changed, 95 insertions(+), 384 deletions(-) diff --git a/plugin/storage/grpc/config/config.go b/plugin/storage/grpc/config/config.go index 4a30af7eb76..e8890d360a5 100644 --- a/plugin/storage/grpc/config/config.go +++ b/plugin/storage/grpc/config/config.go @@ -19,8 +19,8 @@ import ( "os/exec" "runtime" - hclog "github.com/hashicorp/go-hclog" - plugin "github.com/hashicorp/go-plugin" + "github.com/hashicorp/go-hclog" + "github.com/hashicorp/go-plugin" "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" ) @@ -29,7 +29,6 @@ import ( type Configuration struct { PluginBinary string `yaml:"binary"` PluginConfigurationFile string `yaml:"configuration-file"` - AllowTokenFromContext bool `yaml:"allow-token-from-context"` } // Build instantiates a StoragePlugin @@ -40,7 +39,7 @@ func (c *Configuration) Build() (shared.StoragePlugin, error) { client := plugin.NewClient(&plugin.ClientConfig{ HandshakeConfig: shared.Handshake, VersionedPlugins: map[int]plugin.PluginSet{ - 1: shared.GetPluginMap(c.AllowTokenFromContext), + 1: shared.PluginMap, }, Cmd: cmd, AllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC}, diff --git a/plugin/storage/grpc/options.go b/plugin/storage/grpc/options.go index 24b56594e7f..82cac8d9311 100644 --- a/plugin/storage/grpc/options.go +++ b/plugin/storage/grpc/options.go @@ -17,7 +17,6 @@ package grpc import ( "flag" - "github.com/jaegertracing/jaeger/storage/spanstore" "github.com/spf13/viper" "github.com/jaegertracing/jaeger/plugin/storage/grpc/config" @@ -42,6 +41,4 @@ func (opt *Options) AddFlags(flagSet *flag.FlagSet) { func (opt *Options) InitFromViper(v *viper.Viper) { opt.Configuration.PluginBinary = v.GetString(pluginBinary) opt.Configuration.PluginConfigurationFile = v.GetString(pluginConfigurationFile) - // TODO: Need to figure out a better way for do this. (same as ElasticSearch storage) - opt.Configuration.AllowTokenFromContext = v.GetBool(spanstore.StoragePropagationKey) } diff --git a/plugin/storage/grpc/proto/storage.proto b/plugin/storage/grpc/proto/storage.proto index 9cfe3102965..0c347883dcf 100644 --- a/plugin/storage/grpc/proto/storage.proto +++ b/plugin/storage/grpc/proto/storage.proto @@ -66,12 +66,9 @@ message GetTraceRequest { (gogoproto.customtype) = "github.com/jaegertracing/jaeger/model.TraceID", (gogoproto.customname) = "TraceID" ]; - string bearerToken = 2; } -message GetServicesRequest { - string bearerToken = 1; -} +message GetServicesRequest {} message GetServicesResponse { repeated string services = 1; @@ -79,7 +76,6 @@ message GetServicesResponse { message GetOperationsRequest { string service = 1; - string bearerToken = 2; } message GetOperationsResponse { @@ -111,7 +107,6 @@ message TraceQueryParameters { message FindTracesRequest { TraceQueryParameters query = 1; - string bearerToken = 2; } message SpansResponseChunk { @@ -122,7 +117,6 @@ message SpansResponseChunk { message FindTraceIDsRequest { TraceQueryParameters query = 1; - string bearerToken = 2; } message FindTraceIDsResponse { diff --git a/plugin/storage/grpc/shared/grpc_client.go b/plugin/storage/grpc/shared/grpc_client.go index 68094d580a0..ce264d42ae7 100644 --- a/plugin/storage/grpc/shared/grpc_client.go +++ b/plugin/storage/grpc/shared/grpc_client.go @@ -25,24 +25,26 @@ import ( "github.com/jaegertracing/jaeger/proto-gen/storage_v1" "github.com/jaegertracing/jaeger/storage/dependencystore" "github.com/jaegertracing/jaeger/storage/spanstore" + "google.golang.org/grpc/metadata" ) // grpcClient implements shared.StoragePlugin and reads/writes spans and dependencies type grpcClient struct { - allowTokenFromContext bool - readerClient storage_v1.SpanReaderPluginClient - writerClient storage_v1.SpanWriterPluginClient - depsReaderClient storage_v1.DependenciesReaderPluginClient + readerClient storage_v1.SpanReaderPluginClient + writerClient storage_v1.SpanWriterPluginClient + depsReaderClient storage_v1.DependenciesReaderPluginClient } -// getBearerTokenToForward determines is there is a bearer token to forward -// and returns it only when it, only when bearer token forward is allowed. -func (c *grpcClient) getBearerTokenToForward(ctx context.Context) string { - ctxBearerToken, hasToken := spanstore.GetBearerToken(ctx) - if hasToken && c.allowTokenFromContext { - return ctxBearerToken +// updateContextWithBearerToken updates the outgoing context with a bearer token extracted from the source +func (c *grpcClient) updateContextWithBearerToken(outgoing context.Context, source context.Context) context.Context { + bearerToken, hasToken := spanstore.GetBearerToken(source) + if hasToken { + requestMetadata := metadata.New(map[string]string{ + "bearerToken": bearerToken, + }) + return metadata.NewOutgoingContext(outgoing, requestMetadata) } - return "" + return outgoing } // DependencyReader implements shared.StoragePlugin. @@ -62,10 +64,8 @@ func (c *grpcClient) SpanWriter() spanstore.Writer { // GetTrace takes a traceID and returns a Trace associated with that traceID func (c *grpcClient) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { - - stream, err := c.readerClient.GetTrace(ctx, &storage_v1.GetTraceRequest{ - TraceID: traceID, - BearerToken: c.getBearerTokenToForward(ctx), + stream, err := c.readerClient.GetTrace(c.updateContextWithBearerToken(ctx, ctx), &storage_v1.GetTraceRequest{ + TraceID: traceID, }) if err != nil { return nil, errors.Wrap(err, "plugin error") @@ -87,9 +87,7 @@ func (c *grpcClient) GetTrace(ctx context.Context, traceID model.TraceID) (*mode // GetServices returns a list of all known services func (c *grpcClient) GetServices(ctx context.Context) ([]string, error) { - resp, err := c.readerClient.GetServices(ctx, &storage_v1.GetServicesRequest{ - BearerToken: c.getBearerTokenToForward(ctx), - }) + resp, err := c.readerClient.GetServices(c.updateContextWithBearerToken(ctx, ctx), &storage_v1.GetServicesRequest{}) if err != nil { return nil, errors.Wrap(err, "plugin error") } @@ -99,9 +97,8 @@ func (c *grpcClient) GetServices(ctx context.Context) ([]string, error) { // GetOperations returns the operations of a given service func (c *grpcClient) GetOperations(ctx context.Context, service string) ([]string, error) { - resp, err := c.readerClient.GetOperations(ctx, &storage_v1.GetOperationsRequest{ - Service: service, - BearerToken: c.getBearerTokenToForward(ctx), + resp, err := c.readerClient.GetOperations(c.updateContextWithBearerToken(ctx, ctx), &storage_v1.GetOperationsRequest{ + Service: service, }) if err != nil { return nil, errors.Wrap(err, "plugin error") @@ -112,7 +109,7 @@ func (c *grpcClient) GetOperations(ctx context.Context, service string) ([]strin // FindTraces retrieves traces that match the traceQuery func (c *grpcClient) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error) { - stream, err := c.readerClient.FindTraces(context.Background(), &storage_v1.FindTracesRequest{ + stream, err := c.readerClient.FindTraces(c.updateContextWithBearerToken(context.Background(), ctx), &storage_v1.FindTracesRequest{ Query: &storage_v1.TraceQueryParameters{ ServiceName: query.ServiceName, OperationName: query.OperationName, @@ -123,7 +120,6 @@ func (c *grpcClient) FindTraces(ctx context.Context, query *spanstore.TraceQuery DurationMax: query.DurationMax, NumTraces: int32(query.NumTraces), }, - BearerToken: c.getBearerTokenToForward(ctx), }) if err != nil { return nil, errors.Wrap(err, "plugin error") @@ -151,7 +147,7 @@ func (c *grpcClient) FindTraces(ctx context.Context, query *spanstore.TraceQuery // FindTraceIDs retrieves traceIDs that match the traceQuery func (c *grpcClient) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error) { - resp, err := c.readerClient.FindTraceIDs(context.Background(), &storage_v1.FindTraceIDsRequest{ + resp, err := c.readerClient.FindTraceIDs(c.updateContextWithBearerToken(context.Background(), ctx), &storage_v1.FindTraceIDsRequest{ Query: &storage_v1.TraceQueryParameters{ ServiceName: query.ServiceName, OperationName: query.OperationName, @@ -162,7 +158,6 @@ func (c *grpcClient) FindTraceIDs(ctx context.Context, query *spanstore.TraceQue DurationMax: query.DurationMax, NumTraces: int32(query.NumTraces), }, - BearerToken: c.getBearerTokenToForward(ctx), }) if err != nil { return nil, errors.Wrap(err, "plugin error") diff --git a/plugin/storage/grpc/shared/grpc_server.go b/plugin/storage/grpc/shared/grpc_server.go index 1e0d403686c..1db0ee1aa28 100644 --- a/plugin/storage/grpc/shared/grpc_server.go +++ b/plugin/storage/grpc/shared/grpc_server.go @@ -31,17 +31,6 @@ type grpcServer struct { Impl StoragePlugin } -// getMaybeBearerTokenContext returns a context with bearer token, if token string is not empty -// the assumption is that if the token has arrived on the wire, the grpcClient -// verified that bearer token forward was enabled. -// If token is empty, returns original context. -func (s *grpcServer) getMaybeBearerTokenContext(ctx context.Context, token string) context.Context { - if token != "" { - return spanstore.ContextWithBearerToken(ctx, token) - } - return ctx -} - // GetDependencies returns all interservice dependencies func (s *grpcServer) GetDependencies(ctx context.Context, r *storage_v1.GetDependenciesRequest) (*storage_v1.GetDependenciesResponse, error) { deps, err := s.Impl.DependencyReader().GetDependencies(r.EndTime, r.EndTime.Sub(r.StartTime)) @@ -64,8 +53,7 @@ func (s *grpcServer) WriteSpan(ctx context.Context, r *storage_v1.WriteSpanReque // GetTrace takes a traceID and streams a Trace associated with that traceID func (s *grpcServer) GetTrace(r *storage_v1.GetTraceRequest, stream storage_v1.SpanReaderPlugin_GetTraceServer) error { - opCtx := s.getMaybeBearerTokenContext(stream.Context(), r.BearerToken) - trace, err := s.Impl.SpanReader().GetTrace(opCtx, r.TraceID) + trace, err := s.Impl.SpanReader().GetTrace(stream.Context(), r.TraceID) if err != nil { return err } @@ -80,8 +68,7 @@ func (s *grpcServer) GetTrace(r *storage_v1.GetTraceRequest, stream storage_v1.S // GetServices returns a list of all known services func (s *grpcServer) GetServices(ctx context.Context, r *storage_v1.GetServicesRequest) (*storage_v1.GetServicesResponse, error) { - opCtx := s.getMaybeBearerTokenContext(ctx, r.BearerToken) - services, err := s.Impl.SpanReader().GetServices(opCtx) + services, err := s.Impl.SpanReader().GetServices(ctx) if err != nil { return nil, err } @@ -92,8 +79,7 @@ func (s *grpcServer) GetServices(ctx context.Context, r *storage_v1.GetServicesR // GetOperations returns the operations of a given service func (s *grpcServer) GetOperations(ctx context.Context, r *storage_v1.GetOperationsRequest) (*storage_v1.GetOperationsResponse, error) { - opCtx := s.getMaybeBearerTokenContext(ctx, r.BearerToken) - operations, err := s.Impl.SpanReader().GetOperations(opCtx, r.Service) + operations, err := s.Impl.SpanReader().GetOperations(ctx, r.Service) if err != nil { return nil, err } @@ -104,8 +90,7 @@ func (s *grpcServer) GetOperations(ctx context.Context, r *storage_v1.GetOperati // FindTraces streams traces that match the traceQuery func (s *grpcServer) FindTraces(r *storage_v1.FindTracesRequest, stream storage_v1.SpanReaderPlugin_FindTracesServer) error { - opCtx := s.getMaybeBearerTokenContext(stream.Context(), r.BearerToken) - traces, err := s.Impl.SpanReader().FindTraces(opCtx, &spanstore.TraceQueryParameters{ + traces, err := s.Impl.SpanReader().FindTraces(stream.Context(), &spanstore.TraceQueryParameters{ ServiceName: r.Query.ServiceName, OperationName: r.Query.OperationName, Tags: r.Query.Tags, @@ -131,8 +116,7 @@ func (s *grpcServer) FindTraces(r *storage_v1.FindTracesRequest, stream storage_ // FindTraceIDs retrieves traceIDs that match the traceQuery func (s *grpcServer) FindTraceIDs(ctx context.Context, r *storage_v1.FindTraceIDsRequest) (*storage_v1.FindTraceIDsResponse, error) { - opCtx := s.getMaybeBearerTokenContext(ctx, r.BearerToken) - traceIDs, err := s.Impl.SpanReader().FindTraceIDs(opCtx, &spanstore.TraceQueryParameters{ + traceIDs, err := s.Impl.SpanReader().FindTraceIDs(ctx, &spanstore.TraceQueryParameters{ ServiceName: r.Query.ServiceName, OperationName: r.Query.OperationName, Tags: r.Query.Tags, diff --git a/plugin/storage/grpc/shared/interface.go b/plugin/storage/grpc/shared/interface.go index 58139fc67d3..24d62854151 100644 --- a/plugin/storage/grpc/shared/interface.go +++ b/plugin/storage/grpc/shared/interface.go @@ -17,7 +17,7 @@ package shared import ( "context" - plugin "github.com/hashicorp/go-plugin" + "github.com/hashicorp/go-plugin" "google.golang.org/grpc" "github.com/jaegertracing/jaeger/proto-gen/storage_v1" @@ -34,13 +34,9 @@ var Handshake = plugin.HandshakeConfig{ MagicCookieValue: "jaeger", } -// GetPluginMap returns a plugin map. -func GetPluginMap(allowTokenFromContext bool) map[string]plugin.Plugin { - return map[string]plugin.Plugin{ - StoragePluginIdentifier: &StorageGRPCPlugin{ - allowTokenFromContext: allowTokenFromContext, - }, - } +// PluginMap is the map of plugins we can dispense. +var PluginMap = map[string]plugin.Plugin{ + StoragePluginIdentifier: &StorageGRPCPlugin{}, } // StoragePlugin is the interface we're exposing as a plugin. @@ -52,7 +48,6 @@ type StoragePlugin interface { // StorageGRPCPlugin is the implementation of plugin.GRPCPlugin so we can serve/consume this. type StorageGRPCPlugin struct { - allowTokenFromContext bool plugin.Plugin // Concrete implementation, written in Go. This is only used for plugins // that are written in Go. @@ -69,11 +64,10 @@ func (p *StorageGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server } // GRPCClient is used by go-plugin to create a grpc plugin client -func (p *StorageGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) { +func (*StorageGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) { return &grpcClient{ - allowTokenFromContext: p.allowTokenFromContext, - readerClient: storage_v1.NewSpanReaderPluginClient(c), - writerClient: storage_v1.NewSpanWriterPluginClient(c), - depsReaderClient: storage_v1.NewDependenciesReaderPluginClient(c), + readerClient: storage_v1.NewSpanReaderPluginClient(c), + writerClient: storage_v1.NewSpanWriterPluginClient(c), + depsReaderClient: storage_v1.NewDependenciesReaderPluginClient(c), }, nil } diff --git a/proto-gen/storage_v1/storage.pb.go b/proto-gen/storage_v1/storage.pb.go index 6c928d9fc3d..4452ef3c715 100644 --- a/proto-gen/storage_v1/storage.pb.go +++ b/proto-gen/storage_v1/storage.pb.go @@ -223,7 +223,6 @@ var xxx_messageInfo_WriteSpanResponse proto.InternalMessageInfo type GetTraceRequest struct { TraceID github_com_jaegertracing_jaeger_model.TraceID `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3,customtype=github.com/jaegertracing/jaeger/model.TraceID" json:"trace_id"` - BearerToken string `protobuf:"bytes,2,opt,name=bearerToken,proto3" json:"bearerToken,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -262,15 +261,7 @@ func (m *GetTraceRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetTraceRequest proto.InternalMessageInfo -func (m *GetTraceRequest) GetBearerToken() string { - if m != nil { - return m.BearerToken - } - return "" -} - type GetServicesRequest struct { - BearerToken string `protobuf:"bytes,1,opt,name=bearerToken,proto3" json:"bearerToken,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -309,13 +300,6 @@ func (m *GetServicesRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetServicesRequest proto.InternalMessageInfo -func (m *GetServicesRequest) GetBearerToken() string { - if m != nil { - return m.BearerToken - } - return "" -} - type GetServicesResponse struct { Services []string `protobuf:"bytes,1,rep,name=services,proto3" json:"services,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -365,7 +349,6 @@ func (m *GetServicesResponse) GetServices() []string { type GetOperationsRequest struct { Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` - BearerToken string `protobuf:"bytes,2,opt,name=bearerToken,proto3" json:"bearerToken,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -411,13 +394,6 @@ func (m *GetOperationsRequest) GetService() string { return "" } -func (m *GetOperationsRequest) GetBearerToken() string { - if m != nil { - return m.BearerToken - } - return "" -} - type GetOperationsResponse struct { Operations []string `protobuf:"bytes,1,rep,name=operations,proto3" json:"operations,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -570,7 +546,6 @@ func (m *TraceQueryParameters) GetNumTraces() int32 { type FindTracesRequest struct { Query *TraceQueryParameters `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` - BearerToken string `protobuf:"bytes,2,opt,name=bearerToken,proto3" json:"bearerToken,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -616,13 +591,6 @@ func (m *FindTracesRequest) GetQuery() *TraceQueryParameters { return nil } -func (m *FindTracesRequest) GetBearerToken() string { - if m != nil { - return m.BearerToken - } - return "" -} - type SpansResponseChunk struct { Spans []model.Span `protobuf:"bytes,1,rep,name=spans,proto3" json:"spans"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -672,7 +640,6 @@ func (m *SpansResponseChunk) GetSpans() []model.Span { type FindTraceIDsRequest struct { Query *TraceQueryParameters `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` - BearerToken string `protobuf:"bytes,2,opt,name=bearerToken,proto3" json:"bearerToken,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -718,13 +685,6 @@ func (m *FindTraceIDsRequest) GetQuery() *TraceQueryParameters { return nil } -func (m *FindTraceIDsRequest) GetBearerToken() string { - if m != nil { - return m.BearerToken - } - return "" -} - type FindTraceIDsResponse struct { TraceIDs []github_com_jaegertracing_jaeger_model.TraceID `protobuf:"bytes,1,rep,name=trace_ids,json=traceIds,proto3,customtype=github.com/jaegertracing/jaeger/model.TraceID" json:"trace_ids"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -802,66 +762,64 @@ func init() { proto.RegisterFile("storage.proto", fileDescriptor_0d2c4ccf1453ffd func init() { golang_proto.RegisterFile("storage.proto", fileDescriptor_0d2c4ccf1453ffdb) } var fileDescriptor_0d2c4ccf1453ffdb = []byte{ - // 930 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x73, 0xdb, 0x44, - 0x14, 0x47, 0x8d, 0x5d, 0xdb, 0xcf, 0x4e, 0x49, 0x36, 0x06, 0x84, 0x86, 0xda, 0x41, 0x90, 0x26, - 0x30, 0x83, 0x4c, 0xcc, 0x0c, 0x65, 0x60, 0x18, 0xc0, 0x4d, 0xea, 0x09, 0xc3, 0x9f, 0xa2, 0x66, - 0xe8, 0x0c, 0x65, 0xf0, 0xac, 0xa3, 0x87, 0xa2, 0x26, 0x5a, 0xb9, 0xd2, 0xca, 0x93, 0xdc, 0xf9, - 0x00, 0x3d, 0x72, 0xe2, 0xca, 0xd7, 0xe0, 0xd8, 0x23, 0x67, 0x0e, 0x81, 0x09, 0x47, 0xbe, 0x04, - 0xa3, 0xdd, 0x95, 0x22, 0xcb, 0x9a, 0xc6, 0xcd, 0xa1, 0x37, 0xed, 0xdb, 0xdf, 0xfb, 0xbd, 0xb7, - 0xef, 0xcf, 0xcf, 0x86, 0xe5, 0x88, 0x07, 0x21, 0x75, 0xd1, 0x9a, 0x84, 0x01, 0x0f, 0xc8, 0xea, - 0x23, 0x8a, 0x2e, 0x86, 0x56, 0x6a, 0x9d, 0x6e, 0x1b, 0x6d, 0x37, 0x70, 0x03, 0x71, 0xdb, 0x4b, - 0xbe, 0x24, 0xd0,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, 0xba, 0xfd, 0x8b, 0x06, 0xfa, 0xec, - 0xff, 0x8d, 0x5c, 0xd7, 0x0f, 0xc5, 0xef, 0x7a, 0xfe, 0x9a, 0xbc, 0x53, 0x5e, 0x97, 0x92, 0xbf, - 0x54, 0xc6, 0xbb, 0x8b, 0x40, 0x65, 0x1a, 0x83, 0x37, 0x9e, 0x9e, 0x77, 0xb4, 0x3f, 0xcf, 0x3b, - 0xda, 0x3f, 0xe7, 0x1d, 0xed, 0x8f, 0x7f, 0x3b, 0xda, 0x0f, 0xa0, 0xbc, 0x46, 0xd3, 0xed, 0xf1, - 0x75, 0xa1, 0x96, 0x1f, 0xfc, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x49, 0x09, 0xb9, 0x65, 0x46, 0x0a, - 0x00, 0x00, + // 905 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x6f, 0xe3, 0x44, + 0x14, 0xc7, 0x6d, 0xb2, 0x71, 0x5e, 0xd2, 0xa5, 0x9d, 0x06, 0x30, 0x16, 0x9b, 0x14, 0x43, 0xb7, + 0x05, 0x09, 0x67, 0x1b, 0x0e, 0x8b, 0x40, 0x08, 0xc8, 0xa6, 0x1b, 0x15, 0xf1, 0x67, 0xf1, 0x46, + 0xac, 0xc4, 0x22, 0xac, 0x49, 0x3c, 0xb8, 0xde, 0xc6, 0x63, 0xaf, 0x3d, 0x8e, 0x92, 0x3b, 0x1f, + 0x80, 0x23, 0x27, 0xae, 0x7c, 0x0d, 0x8e, 0x7b, 0xe4, 0xcc, 0xa1, 0xa0, 0x70, 0xe4, 0x4b, 0x20, + 0xcf, 0x8c, 0xdd, 0xfc, 0xb1, 0xb6, 0xdd, 0x8a, 0x9b, 0xe7, 0xcd, 0xef, 0xfd, 0xde, 0x9b, 0xf7, + 0xe7, 0x97, 0xc0, 0x56, 0xcc, 0x82, 0x08, 0xbb, 0xc4, 0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0x49, 0x01, 0x6d, 0xf9, 0x47, 0x7c, 0xa1, 0xeb, 0xa7, 0xfc, 0xd7, 0x72, 0xf1, + 0x1a, 0xbd, 0x53, 0x5c, 0x97, 0x82, 0xff, 0x29, 0xfa, 0xbb, 0x57, 0x81, 0x8a, 0x34, 0xba, 0x6f, + 0x3c, 0x9b, 0x37, 0x95, 0x3f, 0xe6, 0x4d, 0xe5, 0xef, 0x79, 0x53, 0xf9, 0xfd, 0x9f, 0xa6, 0xf2, + 0x1d, 0x48, 0x2f, 0x7b, 0x72, 0x34, 0xbc, 0xc1, 0x95, 0xee, 0xfd, 0xff, 0x02, 0x00, 0x00, 0xff, + 0xff, 0x7d, 0x2c, 0x50, 0x42, 0x9b, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1402,12 +1360,6 @@ func (m *GetTraceRequest) MarshalTo(dAtA []byte) (int, error) { return 0, err } i += n4 - if len(m.BearerToken) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintStorage(dAtA, i, uint64(len(m.BearerToken))) - i += copy(dAtA[i:], m.BearerToken) - } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -1429,12 +1381,6 @@ func (m *GetServicesRequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.BearerToken) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(len(m.BearerToken))) - i += copy(dAtA[i:], m.BearerToken) - } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -1498,12 +1444,6 @@ func (m *GetOperationsRequest) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintStorage(dAtA, i, uint64(len(m.Service))) i += copy(dAtA[i:], m.Service) } - if len(m.BearerToken) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintStorage(dAtA, i, uint64(len(m.BearerToken))) - i += copy(dAtA[i:], m.BearerToken) - } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -1658,12 +1598,6 @@ func (m *FindTracesRequest) MarshalTo(dAtA []byte) (int, error) { } i += n9 } - if len(m.BearerToken) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintStorage(dAtA, i, uint64(len(m.BearerToken))) - i += copy(dAtA[i:], m.BearerToken) - } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -1728,12 +1662,6 @@ func (m *FindTraceIDsRequest) MarshalTo(dAtA []byte) (int, error) { } i += n10 } - if len(m.BearerToken) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintStorage(dAtA, i, uint64(len(m.BearerToken))) - i += copy(dAtA[i:], m.BearerToken) - } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -1852,10 +1780,6 @@ func (m *GetTraceRequest) Size() (n int) { _ = l l = m.TraceID.Size() n += 1 + l + sovStorage(uint64(l)) - l = len(m.BearerToken) - if l > 0 { - n += 1 + l + sovStorage(uint64(l)) - } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1868,10 +1792,6 @@ func (m *GetServicesRequest) Size() (n int) { } var l int _ = l - l = len(m.BearerToken) - if l > 0 { - n += 1 + l + sovStorage(uint64(l)) - } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1906,10 +1826,6 @@ func (m *GetOperationsRequest) Size() (n int) { if l > 0 { n += 1 + l + sovStorage(uint64(l)) } - l = len(m.BearerToken) - if l > 0 { - n += 1 + l + sovStorage(uint64(l)) - } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1983,10 +1899,6 @@ func (m *FindTracesRequest) Size() (n int) { l = m.Query.Size() n += 1 + l + sovStorage(uint64(l)) } - l = len(m.BearerToken) - if l > 0 { - n += 1 + l + sovStorage(uint64(l)) - } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2021,10 +1933,6 @@ func (m *FindTraceIDsRequest) Size() (n int) { l = m.Query.Size() n += 1 + l + sovStorage(uint64(l)) } - l = len(m.BearerToken) - if l > 0 { - n += 1 + l + sovStorage(uint64(l)) - } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2476,38 +2384,6 @@ func (m *GetTraceRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BearerToken", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStorage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BearerToken = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipStorage(dAtA[iNdEx:]) @@ -2562,38 +2438,6 @@ func (m *GetServicesRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: GetServicesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BearerToken", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStorage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BearerToken = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipStorage(dAtA[iNdEx:]) @@ -2766,38 +2610,6 @@ func (m *GetOperationsRequest) Unmarshal(dAtA []byte) error { } m.Service = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BearerToken", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStorage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BearerToken = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipStorage(dAtA[iNdEx:]) @@ -3370,38 +3182,6 @@ func (m *FindTracesRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BearerToken", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStorage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BearerToken = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipStorage(dAtA[iNdEx:]) @@ -3580,38 +3360,6 @@ func (m *FindTraceIDsRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BearerToken", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStorage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BearerToken = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipStorage(dAtA[iNdEx:]) From 670d6a910001b2282ec1d36b8d0eec3adfa54655 Mon Sep 17 00:00:00 2001 From: radekg Date: Mon, 30 Sep 2019 11:38:56 +0200 Subject: [PATCH 03/10] Update gRPC storage plugin readme with bearer token propagation instructions Signed-off-by: radekg --- plugin/storage/grpc/README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/plugin/storage/grpc/README.md b/plugin/storage/grpc/README.md index 7677ae954b8..1423ed7934d 100644 --- a/plugin/storage/grpc/README.md +++ b/plugin/storage/grpc/README.md @@ -112,3 +112,35 @@ There are more logger options that can be used with `hclog` listed on [godoc](ht Note: Setting the `Output` option to `os.Stdout` can confuse the `go-plugin` framework and lead it to consider the plugin errored. + +Bearer token propagation from the UI +------------------------------------ +When using `--query.bearer-token-propagation=true`, the bearer token will be properly passed on to the gRPC plugin server. To get access to the bearer token in your plugin, use a method similar to: + +```golang +import ( + // ... other imports + "fmt" + "google.golang.org/grpc/metadata" +) + +// ... spanReader type declared here + +func (r *spanReader) extractBearerToken(ctx context.Context) (string, bool) { + if md, ok := metadata.FromIncomingContext(ctx); ok { + values := md.Get("bearerToken") + if len(values) > 0 { + return values[0], true + } + } + return "", false +} + +// ... spanReader interface implementation + +func (r *spanReader) GetServices(ctx context.Context) ([]string, error) { + str, ok := r.extractBearerToken(ctx) + fmt.Println(fmt.Sprintf("spanReader.GetServices: bearer-token: '%s', wasGiven: '%t'" str, ok)) + // ... +} +``` \ No newline at end of file From 372aab9a1500390cb81854c77801ab313d830de1 Mon Sep 17 00:00:00 2001 From: radekg Date: Tue, 1 Oct 2019 08:08:53 +0200 Subject: [PATCH 04/10] Expose a literal from token propagation context, use literal in gRPC plugin, FindTraceIDs client context. Signed-off-by: radekg --- plugin/storage/grpc/README.md | 3 ++- plugin/storage/grpc/shared/grpc_client.go | 4 ++-- storage/spanstore/token_propagation.go | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/plugin/storage/grpc/README.md b/plugin/storage/grpc/README.md index 1423ed7934d..fd8fd5da5a5 100644 --- a/plugin/storage/grpc/README.md +++ b/plugin/storage/grpc/README.md @@ -121,6 +121,7 @@ When using `--query.bearer-token-propagation=true`, the bearer token will be pro import ( // ... other imports "fmt" + "github.com/jaegertracing/jaeger/storage/spanstore" "google.golang.org/grpc/metadata" ) @@ -128,7 +129,7 @@ import ( func (r *spanReader) extractBearerToken(ctx context.Context) (string, bool) { if md, ok := metadata.FromIncomingContext(ctx); ok { - values := md.Get("bearerToken") + values := md.Get(spanstore.BearerTokenKey) if len(values) > 0 { return values[0], true } diff --git a/plugin/storage/grpc/shared/grpc_client.go b/plugin/storage/grpc/shared/grpc_client.go index ce264d42ae7..cd4554295dd 100644 --- a/plugin/storage/grpc/shared/grpc_client.go +++ b/plugin/storage/grpc/shared/grpc_client.go @@ -40,7 +40,7 @@ func (c *grpcClient) updateContextWithBearerToken(outgoing context.Context, sour bearerToken, hasToken := spanstore.GetBearerToken(source) if hasToken { requestMetadata := metadata.New(map[string]string{ - "bearerToken": bearerToken, + spanstore.BearerTokenKey: bearerToken, }) return metadata.NewOutgoingContext(outgoing, requestMetadata) } @@ -147,7 +147,7 @@ func (c *grpcClient) FindTraces(ctx context.Context, query *spanstore.TraceQuery // FindTraceIDs retrieves traceIDs that match the traceQuery func (c *grpcClient) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error) { - resp, err := c.readerClient.FindTraceIDs(c.updateContextWithBearerToken(context.Background(), ctx), &storage_v1.FindTraceIDsRequest{ + resp, err := c.readerClient.FindTraceIDs(c.updateContextWithBearerToken(ctx, ctx), &storage_v1.FindTraceIDsRequest{ Query: &storage_v1.TraceQueryParameters{ ServiceName: query.ServiceName, OperationName: query.OperationName, diff --git a/storage/spanstore/token_propagation.go b/storage/spanstore/token_propagation.go index 79f80924e1d..b4b87bf28ce 100644 --- a/storage/spanstore/token_propagation.go +++ b/storage/spanstore/token_propagation.go @@ -18,6 +18,8 @@ import "context" type contextKey string +// BearerTokenKey is the string literal used internally in the implementation of this context. +const BearerTokenKey = "bearer.token" const bearerToken = contextKey("bearer.token") // StoragePropagationKey is a key for viper configuration to pass this option to storage plugins. From c35211c571d5880b74ff6d7ef1cebc4b57ad0de3 Mon Sep 17 00:00:00 2001 From: radekg Date: Tue, 1 Oct 2019 08:18:53 +0200 Subject: [PATCH 05/10] gRPC plugin client, uses original context everywhere, adapt upgrade function Signed-off-by: radekg --- plugin/storage/grpc/shared/grpc_client.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/plugin/storage/grpc/shared/grpc_client.go b/plugin/storage/grpc/shared/grpc_client.go index cd4554295dd..26cfa493364 100644 --- a/plugin/storage/grpc/shared/grpc_client.go +++ b/plugin/storage/grpc/shared/grpc_client.go @@ -35,16 +35,18 @@ type grpcClient struct { depsReaderClient storage_v1.DependenciesReaderPluginClient } -// updateContextWithBearerToken updates the outgoing context with a bearer token extracted from the source -func (c *grpcClient) updateContextWithBearerToken(outgoing context.Context, source context.Context) context.Context { - bearerToken, hasToken := spanstore.GetBearerToken(source) +// upgradeContextWithBearerToken turns the context into a gRPC outgoing context with bearer token +// in the request metadata, if the original context has bearer token attached. +// Otherwise returns original context. +func (c *grpcClient) upgradeContextWithBearerToken(ctx context.Context) context.Context { + bearerToken, hasToken := spanstore.GetBearerToken(ctx) if hasToken { requestMetadata := metadata.New(map[string]string{ spanstore.BearerTokenKey: bearerToken, }) - return metadata.NewOutgoingContext(outgoing, requestMetadata) + return metadata.NewOutgoingContext(ctx, requestMetadata) } - return outgoing + return ctx } // DependencyReader implements shared.StoragePlugin. @@ -64,7 +66,7 @@ func (c *grpcClient) SpanWriter() spanstore.Writer { // GetTrace takes a traceID and returns a Trace associated with that traceID func (c *grpcClient) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { - stream, err := c.readerClient.GetTrace(c.updateContextWithBearerToken(ctx, ctx), &storage_v1.GetTraceRequest{ + stream, err := c.readerClient.GetTrace(c.upgradeContextWithBearerToken(ctx), &storage_v1.GetTraceRequest{ TraceID: traceID, }) if err != nil { @@ -87,7 +89,7 @@ func (c *grpcClient) GetTrace(ctx context.Context, traceID model.TraceID) (*mode // GetServices returns a list of all known services func (c *grpcClient) GetServices(ctx context.Context) ([]string, error) { - resp, err := c.readerClient.GetServices(c.updateContextWithBearerToken(ctx, ctx), &storage_v1.GetServicesRequest{}) + resp, err := c.readerClient.GetServices(c.upgradeContextWithBearerToken(ctx), &storage_v1.GetServicesRequest{}) if err != nil { return nil, errors.Wrap(err, "plugin error") } @@ -97,7 +99,7 @@ func (c *grpcClient) GetServices(ctx context.Context) ([]string, error) { // GetOperations returns the operations of a given service func (c *grpcClient) GetOperations(ctx context.Context, service string) ([]string, error) { - resp, err := c.readerClient.GetOperations(c.updateContextWithBearerToken(ctx, ctx), &storage_v1.GetOperationsRequest{ + resp, err := c.readerClient.GetOperations(c.upgradeContextWithBearerToken(ctx), &storage_v1.GetOperationsRequest{ Service: service, }) if err != nil { @@ -109,7 +111,7 @@ func (c *grpcClient) GetOperations(ctx context.Context, service string) ([]strin // FindTraces retrieves traces that match the traceQuery func (c *grpcClient) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error) { - stream, err := c.readerClient.FindTraces(c.updateContextWithBearerToken(context.Background(), ctx), &storage_v1.FindTracesRequest{ + stream, err := c.readerClient.FindTraces(c.upgradeContextWithBearerToken(ctx), &storage_v1.FindTracesRequest{ Query: &storage_v1.TraceQueryParameters{ ServiceName: query.ServiceName, OperationName: query.OperationName, @@ -147,7 +149,7 @@ func (c *grpcClient) FindTraces(ctx context.Context, query *spanstore.TraceQuery // FindTraceIDs retrieves traceIDs that match the traceQuery func (c *grpcClient) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error) { - resp, err := c.readerClient.FindTraceIDs(c.updateContextWithBearerToken(ctx, ctx), &storage_v1.FindTraceIDsRequest{ + resp, err := c.readerClient.FindTraceIDs(c.upgradeContextWithBearerToken(ctx), &storage_v1.FindTraceIDsRequest{ Query: &storage_v1.TraceQueryParameters{ ServiceName: query.ServiceName, OperationName: query.OperationName, From 3e82f81854ae033d6ecaf8f68ca11adadb9ba9b9 Mon Sep 17 00:00:00 2001 From: radekg Date: Tue, 1 Oct 2019 18:28:45 +0200 Subject: [PATCH 06/10] Reuse the bearer token key string in the context key Signed-off-by: radekg --- storage/spanstore/token_propagation.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/spanstore/token_propagation.go b/storage/spanstore/token_propagation.go index b4b87bf28ce..ba023822b2e 100644 --- a/storage/spanstore/token_propagation.go +++ b/storage/spanstore/token_propagation.go @@ -20,7 +20,7 @@ type contextKey string // BearerTokenKey is the string literal used internally in the implementation of this context. const BearerTokenKey = "bearer.token" -const bearerToken = contextKey("bearer.token") +const bearerToken = contextKey(BearerTokenKey) // StoragePropagationKey is a key for viper configuration to pass this option to storage plugins. const StoragePropagationKey = "storage.propagate.token" From 308d1137ff620da5423d26526c44a54bb05f4af2 Mon Sep 17 00:00:00 2001 From: radekg Date: Tue, 1 Oct 2019 18:31:27 +0200 Subject: [PATCH 07/10] upgradeContextWithBearerToken does not need a receiver Signed-off-by: radekg --- plugin/storage/grpc/shared/grpc_client.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugin/storage/grpc/shared/grpc_client.go b/plugin/storage/grpc/shared/grpc_client.go index 26cfa493364..63fa498f535 100644 --- a/plugin/storage/grpc/shared/grpc_client.go +++ b/plugin/storage/grpc/shared/grpc_client.go @@ -38,7 +38,7 @@ type grpcClient struct { // upgradeContextWithBearerToken turns the context into a gRPC outgoing context with bearer token // in the request metadata, if the original context has bearer token attached. // Otherwise returns original context. -func (c *grpcClient) upgradeContextWithBearerToken(ctx context.Context) context.Context { +func upgradeContextWithBearerToken(ctx context.Context) context.Context { bearerToken, hasToken := spanstore.GetBearerToken(ctx) if hasToken { requestMetadata := metadata.New(map[string]string{ @@ -66,7 +66,7 @@ func (c *grpcClient) SpanWriter() spanstore.Writer { // GetTrace takes a traceID and returns a Trace associated with that traceID func (c *grpcClient) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { - stream, err := c.readerClient.GetTrace(c.upgradeContextWithBearerToken(ctx), &storage_v1.GetTraceRequest{ + stream, err := c.readerClient.GetTrace(upgradeContextWithBearerToken(ctx), &storage_v1.GetTraceRequest{ TraceID: traceID, }) if err != nil { @@ -89,7 +89,7 @@ func (c *grpcClient) GetTrace(ctx context.Context, traceID model.TraceID) (*mode // GetServices returns a list of all known services func (c *grpcClient) GetServices(ctx context.Context) ([]string, error) { - resp, err := c.readerClient.GetServices(c.upgradeContextWithBearerToken(ctx), &storage_v1.GetServicesRequest{}) + resp, err := c.readerClient.GetServices(upgradeContextWithBearerToken(ctx), &storage_v1.GetServicesRequest{}) if err != nil { return nil, errors.Wrap(err, "plugin error") } @@ -99,7 +99,7 @@ func (c *grpcClient) GetServices(ctx context.Context) ([]string, error) { // GetOperations returns the operations of a given service func (c *grpcClient) GetOperations(ctx context.Context, service string) ([]string, error) { - resp, err := c.readerClient.GetOperations(c.upgradeContextWithBearerToken(ctx), &storage_v1.GetOperationsRequest{ + resp, err := c.readerClient.GetOperations(upgradeContextWithBearerToken(ctx), &storage_v1.GetOperationsRequest{ Service: service, }) if err != nil { @@ -111,7 +111,7 @@ func (c *grpcClient) GetOperations(ctx context.Context, service string) ([]strin // FindTraces retrieves traces that match the traceQuery func (c *grpcClient) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error) { - stream, err := c.readerClient.FindTraces(c.upgradeContextWithBearerToken(ctx), &storage_v1.FindTracesRequest{ + stream, err := c.readerClient.FindTraces(upgradeContextWithBearerToken(ctx), &storage_v1.FindTracesRequest{ Query: &storage_v1.TraceQueryParameters{ ServiceName: query.ServiceName, OperationName: query.OperationName, @@ -149,7 +149,7 @@ func (c *grpcClient) FindTraces(ctx context.Context, query *spanstore.TraceQuery // FindTraceIDs retrieves traceIDs that match the traceQuery func (c *grpcClient) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error) { - resp, err := c.readerClient.FindTraceIDs(c.upgradeContextWithBearerToken(ctx), &storage_v1.FindTraceIDsRequest{ + resp, err := c.readerClient.FindTraceIDs(upgradeContextWithBearerToken(ctx), &storage_v1.FindTraceIDsRequest{ Query: &storage_v1.TraceQueryParameters{ ServiceName: query.ServiceName, OperationName: query.OperationName, From 2b8bb78b734a441c0938d26f8f452c39433ef1eb Mon Sep 17 00:00:00 2001 From: radekg Date: Wed, 2 Oct 2019 12:04:10 +0200 Subject: [PATCH 08/10] Apply make fmt Signed-off-by: radekg --- plugin/storage/grpc/shared/grpc_client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/storage/grpc/shared/grpc_client.go b/plugin/storage/grpc/shared/grpc_client.go index 63fa498f535..4c715f2ea8a 100644 --- a/plugin/storage/grpc/shared/grpc_client.go +++ b/plugin/storage/grpc/shared/grpc_client.go @@ -20,12 +20,12 @@ import ( "time" "github.com/pkg/errors" + "google.golang.org/grpc/metadata" "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/proto-gen/storage_v1" "github.com/jaegertracing/jaeger/storage/dependencystore" "github.com/jaegertracing/jaeger/storage/spanstore" - "google.golang.org/grpc/metadata" ) // grpcClient implements shared.StoragePlugin and reads/writes spans and dependencies From 4a00c03693f511185b4b8ca19edb42ac00f5cc6b Mon Sep 17 00:00:00 2001 From: radekg Date: Thu, 3 Oct 2019 11:38:50 +0200 Subject: [PATCH 09/10] Add test coverage for context upgrades Signed-off-by: radekg --- plugin/storage/grpc/shared/grpc_client_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plugin/storage/grpc/shared/grpc_client_test.go b/plugin/storage/grpc/shared/grpc_client_test.go index 3ea04aa0b9e..7ee469c9b47 100644 --- a/plugin/storage/grpc/shared/grpc_client_test.go +++ b/plugin/storage/grpc/shared/grpc_client_test.go @@ -24,6 +24,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + "google.golang.org/grpc/metadata" + "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/proto-gen/storage_v1" grpcMocks "github.com/jaegertracing/jaeger/proto-gen/storage_v1/mocks" @@ -91,6 +93,22 @@ func withGRPCClient(fn func(r *grpcClientTest)) { fn(r) } +func TestContextUpgradeWithToken(t *testing.T) { + testBearerToken := "test-bearer-token" + ctx := spanstore.ContextWithBearerToken(context.Background(), testBearerToken) + upgradedToken := upgradeContextWithBearerToken(ctx) + md, ok := metadata.FromOutgoingContext(upgradedToken) + assert.Truef(t, ok, "Expected metadata in context") + bearerTokenFromMetadata := md.Get(spanstore.BearerTokenKey) + assert.Equal(t, []string{testBearerToken}, bearerTokenFromMetadata) +} + +func TestContextUpgradeWithoutToken(t *testing.T) { + upgradedToken := upgradeContextWithBearerToken(context.Background()) + _, ok := metadata.FromOutgoingContext(upgradedToken) + assert.Falsef(t, ok, "Expected no metadata in context") +} + func TestGRPCClientGetServices(t *testing.T) { withGRPCClient(func(r *grpcClientTest) { r.spanReader.On("GetServices", mock.Anything, &storage_v1.GetServicesRequest{}). From 08314972b9d134deb98cd9d74a85348f4f6c28e9 Mon Sep 17 00:00:00 2001 From: radekg Date: Thu, 3 Oct 2019 12:11:44 +0200 Subject: [PATCH 10/10] D'oh, fmt for tests... Signed-off-by: radekg --- plugin/storage/grpc/shared/grpc_client_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin/storage/grpc/shared/grpc_client_test.go b/plugin/storage/grpc/shared/grpc_client_test.go index 7ee469c9b47..7b6b295557b 100644 --- a/plugin/storage/grpc/shared/grpc_client_test.go +++ b/plugin/storage/grpc/shared/grpc_client_test.go @@ -23,7 +23,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" - "google.golang.org/grpc/metadata" "github.com/jaegertracing/jaeger/model"