Skip to content

Commit

Permalink
link context in metadata client
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
butonic committed Jun 7, 2023
1 parent 5714f55 commit 701a280
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/link-context.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: link context in metadata client

We now disconnect the existing outgoing grpc metadata when making calls in the metadata client. To keep track of related spans we link the two contexts.

https://github.com/cs3org/reva/pull/3951
6 changes: 4 additions & 2 deletions pkg/storage/utils/metadata/cs3.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,15 +461,17 @@ func (cs3 *CS3) providerClient() (provider.ProviderAPIClient, error) {
}

func (cs3 *CS3) getAuthContext(ctx context.Context) (context.Context, error) {
ctx, span := tracer.Start(ctx, "getAuthContext")
// we need to start a new context to get rid of an existing x-access-token in the outgoing context
authCtx := context.Background()
authCtx, span := tracer.Start(authCtx, "getAuthContext", trace.WithLinks(trace.LinkFromContext(ctx)))
defer span.End()

client, err := pool.GetGatewayServiceClient(cs3.gatewayAddr)
if err != nil {
return nil, err
}

authCtx := ctxpkg.ContextSetUser(ctx, cs3.serviceUser)
authCtx = ctxpkg.ContextSetUser(authCtx, cs3.serviceUser)
authRes, err := client.Authenticate(authCtx, &gateway.AuthenticateRequest{
Type: "machine",
ClientId: "userid:" + cs3.serviceUser.Id.OpaqueId,
Expand Down

0 comments on commit 701a280

Please sign in to comment.