newrelic / go-agent

New Relic Go Agent
Apache License 2.0
764 stars 294 forks source link

External Services(AWS sdk go v2 ) api calls are not logged / visible when using github.com/newrelic/go-agent/v3/integrations/nrawssdk-v #796

Open ARKKYN opened 11 months ago

ARKKYN commented 11 months ago

Description

External Services(AWS sdk go v2 ) api calls are not logged / visible when using github.com/newrelic/go-agent/v3/integrations/nrawssdk-v2 . I tried to log external api calls to s3 and sqs but the requests are not logged or shown in. newrelic ui

Steps to Reproduce

This is the code I Tried

        txn := instrumentation.GetNewRelic().StartTransaction("S3_API")
    defer txn.End()

    cfg, err := config.LoadDefaultConfig(context.TODO())
    if err != nil {
        fmt.Println("Error loading AWS config:", err)
    }
    nrAsg.AppendMiddlewares(&cfg.APIOptions, txn)
    sqsClient = sqs.NewFromConfig(cfg)
    return sqsClient, err
mirackara commented 11 months ago

That's strange. Do you see them being logged if you try running the example file here

iamemilio commented 9 months ago

Hi @ARKKYN we had a PR that reported something similar, and I was wondering if you had tried this: https://github.com/newrelic/go-agent/pull/599/files

iamemilio commented 9 months ago

specifically this part:

awsConfig, err := config.LoadDefaultConfig(ctx, func(awsConfig *config.LoadOptions) error {
        // Instrument all new AWS clients with New Relic
        nrawssdk.AppendMiddlewares(&awsConfig.APIOptions, nil)
        return nil
    })