1

I was reading the official documentation on https://github.com/aws/aws-xray-sdk-go but not quite sure how can I add the Cognito client that is created on my lambda function to the service map and x-ray traces.

    import (
        "context"
        cognito "github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider"
       "github.com/aws/aws-xray-sdk-go/xray"
    )
    
    func GetClient() {
    ...
    cfg, errCfg := config.LoadDefaultConfig(context.TODO())
    client := cognito.NewFromConfig(cfg)
    
    // the next line is not valid, because the function receives a *client.Client as a parameter
    // and my current client is of type *cognito.Client
    // the error is: cannot use client (variable of type *cognitoidentityprovider.Client) as *"github.com/aws/aws-sdk-go/aws/client".Client value in argument to xray.AWS
    xray.AWS(client)
    ...
    }

I appreciate your advice.

juan
  • 358
  • 1
  • 4
  • 12

1 Answers1

-1

Please see these docs for instrumenting AWS SDK for Go clients with X-Ray SDK: https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-go-awssdkclients.html

William Armiros
  • 267
  • 1
  • 10
  • That's exactly one of my questions. On that documentation they are using SDK V1, so I cannot use xray.AWS – juan Apr 04 '23 at 22:29