Skip to content

Commit

Permalink
contrib/aws/aws-sdk-go: add request id to trace (#1266)
Browse files Browse the repository at this point in the history
  • Loading branch information
yulius-take2 committed May 2, 2022
1 parent e7717ad commit 4b39c30
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contrib/aws/aws-sdk-go/aws/aws.go
Expand Up @@ -24,6 +24,7 @@ const (
tagAWSOperation = "aws.operation"
tagAWSRegion = "aws.region"
tagAWSRetryCount = "aws.retry_count"
tagAWSRequestID = "aws.request_id"
)

type handlers struct {
Expand Down Expand Up @@ -78,6 +79,7 @@ func (h *handlers) Complete(req *request.Request) {
return
}
span.SetTag(tagAWSRetryCount, req.RetryCount)
span.SetTag(tagAWSRequestID, req.RequestID)
if req.HTTPResponse != nil {
span.SetTag(ext.HTTPCode, strconv.Itoa(req.HTTPResponse.StatusCode))
}
Expand Down
1 change: 1 addition & 0 deletions contrib/aws/aws-sdk-go/aws/aws_test.go
Expand Up @@ -57,6 +57,7 @@ func TestAWS(t *testing.T) {
assert.Equal(t, "403", s.Tag(ext.HTTPCode))
assert.Equal(t, "PUT", s.Tag(ext.HTTPMethod))
assert.Equal(t, "http://s3.us-west-2.amazonaws.com/BUCKET", s.Tag(ext.HTTPURL))
assert.NotNil(t, s.Tag(tagAWSRequestID))
})

t.Run("ec2", func(t *testing.T) {
Expand Down

0 comments on commit 4b39c30

Please sign in to comment.