-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The PR is a follow up on bedrock service support PR: #209 We add contract tests for following Bedrock services that covers all resource attributes we newly support: 1. Bedrock API: `GetGuardrail` 2. BedrockAgent APIs: `GetAgent`, `GetDataSource`, `GetKnowledgeBase` 3. BedrockRuntime API: `InvokeModel` 4. BedrockAgentRuntime API: `InvokeAgent` Upgrade `botocore` and `boto3` to the latest version `1.34.143` so that to support Bedrock services API calls. Upgrade `localstack/localstack` image to the latest version `3.5.0` so resolve the SQS API call issue using `localstack/localstack:2.0.1` with new version of `boto3`: localstack/localstack#9610 **Contract test limitation:** The contract tests in current repo is using [LocalStackContainer](https://github.com/aws-observability/aws-otel-python-instrumentation/blob/912dd93ff19b7a4594bb9ed1a7d8cde4907a735d/contract-tests/tests/test/amazon/botocore/botocore_test.py#L68) to serve AWS SDK service calls. But it doesn’t has bedrock related service support (This is [the full service list](https://docs.localstack.cloud/references/coverage/) it support.). In this case, no matter which bedrock API we call in contract test, the response will always be 4XX. As a workaround, we inject `inject_200_success` and `inject_500_error` directly into the API call to make sure we receive http response with expected status code and attributes. **`_assert_semantic_conventions_span_attributes` function change:** In [_assert_semantic_conventions_span_attributes function](https://github.com/aws-observability/aws-otel-python-instrumentation/blob/1753bbf2c3cd41778abc358a7f1e3199e48c7fa9/contract-tests/tests/test/amazon/botocore/botocore_test.py#L448) it is checking the input `service` equals to `rpc.service`, however, we pass the input service with ["remote_service"](https://github.com/aws-observability/aws-otel-python-instrumentation/blob/1753bbf2c3cd41778abc358a7f1e3199e48c7fa9/contract-tests/tests/test/amazon/botocore/botocore_test.py#L430), where there is mismatch for example for Bedrock Agent Runtime: we have `rpc_service="Bedrock Agent Runtime", remote_service="AWS::Bedrock". ` Thus we change to use `rpc_service` if it is provided by: ``` kwargs.get("rpc_service") if "rpc_service" in kwargs else kwargs.get("remote_service").split("::")[-1], ``` By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
- Loading branch information
Showing
3 changed files
with
255 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
opentelemetry-distro==0.46b0 | ||
opentelemetry-exporter-otlp-proto-grpc==1.25.0 | ||
typing-extensions==4.9.0 | ||
botocore==1.34.26 | ||
boto3==1.34.26 | ||
botocore==1.34.143 | ||
boto3==1.34.143 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters