Description
openedon Sep 28, 2019
Requirement - what kind of business use case are you trying to solve?
I am trying to run elastic search storage back end via GRPC plugin and have the bearer token forwarded to the GRPC plugin server.
Problem - what in Jaeger blocks you from solving the requirement?
Query UI has an option to forward Bearer token to the storage back end using --query.bearer-token-propagation=true
flag. However, when using the GRPC storage plugin, the context created with spanstore.ContextWithBearerToken(ctx, token)
in https://github.com/jaegertracing/jaeger/blob/master/cmd/query/app/token_propagation_handler.go#L48 is not passed to the GRPC plugin.
Currently, the last place in the storage where the context with the bearer.token
can be reached, is the GRPC client: https://github.com/jaegertracing/jaeger/blob/master/plugin/storage/grpc/shared/grpc_client.go.
This can be tested by adding these lines of code:
str, ok := spanstore.GetBearerToken(ctx)
fmt.Println(fmt.Sprintf(" =====================> CLIENT: The context is: %v ::: %t", str, ok))
to any of the following methods:
func (c *grpcClient) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error)
func (c *grpcClient) GetServices(ctx context.Context) ([]string, error)
func (c *grpcClient) GetOperations(ctx context.Context, service string) ([]string, error)
func (c *grpcClient) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error)
func (c *grpcClient) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error)
However, on the server part of the plugin, the context is a new instance because the plugin is running as a separate process.
Proposal - what do you suggest to solve the problem or improve the existing situation?
To fix this problem, the bearer token has to be passed inside of the GRPC requests to the GRPC server and the ContextWithBearerToken
must be reconstructed on the other side.