Skip to content

Commit

Permalink
Adds back retry_attempts to botocore (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasdesr authored Jan 6, 2021
1 parent 5a6c4f6 commit 21a5c16
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#236](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/236))
- Add README and example app for Prometheus Remote Write Exporter
([#227](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/227]))
- `opentelemetry-instrumentation-botocore` Adds a field to report the number of retries it take to complete an API call
([#275](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/275))

### Changed
- `opentelemetry-instrumentation-asgi`, `opentelemetry-instrumentation-wsgi` Return `None` for `CarrierGetter` if key not found
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ def _patched_api_call(self, original_func, instance, args, kwargs):
"aws.request_id", req_id,
)

if "RetryAttempts" in metadata:
span.set_attribute(
"retry_attempts", metadata["RetryAttempts"],
)

if "HTTPStatusCode" in metadata:
span.set_attribute(
"http.status_code", metadata["HTTPStatusCode"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def test_traced_client(self):
"aws.region": "us-west-2",
"aws.request_id": "fdcdcab1-ae5c-489e-9c33-4637c5dda355",
"aws.service": "ec2",
"retry_attempts": 0,
"http.status_code": 200,
},
)
Expand Down Expand Up @@ -116,6 +117,7 @@ def test_s3_client(self):
"aws.operation": "ListBuckets",
"aws.region": "us-west-2",
"aws.service": "s3",
"retry_attempts": 0,
"http.status_code": 200,
},
)
Expand Down Expand Up @@ -159,6 +161,7 @@ def test_s3_put(self):
"aws.operation": "CreateBucket",
"aws.region": "us-west-2",
"aws.service": "s3",
"retry_attempts": 0,
"http.status_code": 200,
},
)
Expand All @@ -169,6 +172,7 @@ def test_s3_put(self):
"aws.operation": "PutObject",
"aws.region": "us-west-2",
"aws.service": "s3",
"retry_attempts": 0,
"http.status_code": 200,
},
)
Expand All @@ -180,6 +184,7 @@ def test_s3_put(self):
"aws.operation": "GetObject",
"aws.region": "us-west-2",
"aws.service": "s3",
"retry_attempts": 0,
"http.status_code": 200,
},
)
Expand All @@ -203,6 +208,7 @@ def test_sqs_client(self):
"aws.operation": "ListQueues",
"aws.region": "us-east-1",
"aws.service": "sqs",
"retry_attempts": 0,
"http.status_code": 200,
},
)
Expand Down Expand Up @@ -233,6 +239,7 @@ def test_sqs_send_message(self):
"aws.operation": "CreateQueue",
"aws.region": "us-east-1",
"aws.service": "sqs",
"retry_attempts": 0,
"http.status_code": 200,
},
)
Expand All @@ -248,6 +255,7 @@ def test_sqs_send_message(self):
"aws.queue_url": response["QueueUrl"],
"aws.region": "us-east-1",
"aws.service": "sqs",
"retry_attempts": 0,
"http.status_code": 200,
},
)
Expand All @@ -270,6 +278,7 @@ def test_kinesis_client(self):
"aws.operation": "ListStreams",
"aws.region": "us-east-1",
"aws.service": "kinesis",
"retry_attempts": 0,
"http.status_code": 200,
},
)
Expand Down Expand Up @@ -315,6 +324,7 @@ def test_lambda_client(self):
"aws.operation": "ListFunctions",
"aws.region": "us-east-1",
"aws.service": "lambda",
"retry_attempts": 0,
"http.status_code": 200,
},
)
Expand All @@ -335,6 +345,7 @@ def test_kms_client(self):
"aws.operation": "ListKeys",
"aws.region": "us-east-1",
"aws.service": "kms",
"retry_attempts": 0,
"http.status_code": 200,
},
)
Expand All @@ -359,6 +370,7 @@ def test_sts_client(self):
"aws.region": "us-east-1",
"aws.request_id": "c6104cbe-af31-11e0-8154-cbc7ccf896c7",
"aws.service": "sts",
"retry_attempts": 0,
"http.status_code": 200,
},
)
Expand Down Expand Up @@ -395,6 +407,7 @@ def check_headers(**kwargs):
"aws.region": "us-west-2",
"aws.request_id": "fdcdcab1-ae5c-489e-9c33-4637c5dda355",
"aws.service": "ec2",
"retry_attempts": 0,
"http.status_code": 200,
},
)
Expand Down Expand Up @@ -463,6 +476,7 @@ def test_dynamodb_client(self):
"aws.region": "us-west-2",
"aws.service": "dynamodb",
"aws.table_name": "test_table_name",
"retry_attempts": 0,
"http.status_code": 200,
},
)
Expand All @@ -478,6 +492,7 @@ def test_dynamodb_client(self):
"aws.region": "us-west-2",
"aws.service": "dynamodb",
"aws.table_name": "test_table_name",
"retry_attempts": 0,
"http.status_code": 200,
},
)
Expand All @@ -493,6 +508,7 @@ def test_dynamodb_client(self):
"aws.region": "us-west-2",
"aws.service": "dynamodb",
"aws.table_name": "test_table_name",
"retry_attempts": 0,
"http.status_code": 200,
},
)

0 comments on commit 21a5c16

Please sign in to comment.