aws / aws-xray-sdk-go

AWS X-Ray SDK for the Go programming language.
Apache License 2.0
276 stars 117 forks source link

SDK V2 intrumentation of DynamoDB doesn't capture table name #417

Open POlczak-ITTouch opened 10 months ago

POlczak-ITTouch commented 10 months ago

I use the following function to instrument the github.com/aws/aws-sdk-go-v2/aws config of DynamoDB:

func InstrumentAWSV2SDK(cfg *aws.Config) {
    xray.AWSV2Instrumentor(&cfg.APIOptions)
}

However the resulting segments and subsegments only include the operation field. The table_name field which is filled by v1 instrumentation is missing from V2 segments:

{
    "id": "41dca423be59c89b",
    "name": "DynamoDB",
    "start_time": 1695049841.6308432,
    "end_time": 1695049842.310672,
    "http": {
        "response": {
            "status": 200,
            "content_length": 2
        }
    },
    "aws": {
        "region": "eu-west-3",
        "operation": "PutItem",
        "request_id": "ST03KT8SKU47VP27DQ5MDT9C83VV4KQNSO5AEMVJF66Q9ASUAAJG"
    },
    "namespace": "aws"
}
wangzlei commented 10 months ago

Sorry for bringing this sorry for the inconvenience. Currently, both OpenTelemetry and XRay do not support AWS service specific attributes in AWS SDK for Go v2 instrumentation. This feature is on our backlog but does not have a concrete schedule yet. A complete solution would involve covering all AWS service operations through configuration, similar to the AWS SDK for Go v1 instrumentation.

For DynamoDB(and SQS), there is a temporary solution available through OpenTelemetry. So, if you only need the DynamoDB table name, you can consider options:

  1. migrate to OpenTelemetry.
  2. customize your AWS SDK v2 instrumentation by copying OpenTelemtry code into XRay SDK.
POlczak-ITTouch commented 9 months ago

Ok, thank you for your answer. I'll consider using one of the temporary solutions. However having this feature in the future release without any workarounds would obviously be great, so please consider this ticket a feature request.