-
Notifications
You must be signed in to change notification settings - Fork 822
botocore: upgrade moto package from 5.0.9 to 5.1.11 #3736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
+8
−6
Conversation
This file contains hidden or 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
Moto 5.0.9, released in May 2024, lacks support for certain AWS resources such as Step Functions APIs. This PR upgrades moto to the latest release (5.1.11) to add these capabilities. After the upgrade, one DynamoDB unit test failed. This PR also addresses that failure. The unit test failures after upgrading moto from 5.0.9 to 5.1.11 happened due to two key improvements in moto's DynamoDB implementation: 1. Enhanced Parameter Validation Before (moto 5.0.9): Moto had lenient validation and allowed invalid parameter combinations like Segment=21 with TotalSegments=17, even though this violates AWS DynamoDB's actual behavior. After (moto 5.1.11): Moto added stricter validation that matches AWS DynamoDB's real behavior: Segment parameter must be zero-based (0 to TotalSegments-1) Segment=21 with TotalSegments=17 now correctly throws ValidationException 2. More Accurate Parallel Scan Simulation Before (moto 5.0.9): Moto's parallel scan implementation was simplified and might have returned items regardless of which segment was being scanned, leading to predictable but incorrect behavior. After (moto 5.1.11): Moto improved its parallel scan simulation to more accurately reflect how AWS DynamoDB distributes items across segments: Items are distributed based on hash values of partition keys Different segments contain different subsets of data Segment 16 (out of 17 total) might legitimately contain 0 items if the hash distribution doesn't place any items there Why This Matters These changes make moto behave more like the actual AWS DynamoDB service, which is beneficial for testing because: Tests catch invalid parameter usage that would fail in production Tests reflect realistic data distribution patterns Code is validated against more accurate AWS behavior The test failures weren't bugs in the OpenTelemetry instrumentation code - they were issues with the test setup that became visible when moto started enforcing AWS's actual constraints and behavior patterns.
|
LGTM, just needs a changelog |
Contributor
Author
Added. I thought it's not required as this change is only about unit test. |
lukeina2z
added a commit
to lukeina2z/opentelemetry-python-contrib
that referenced
this pull request
Sep 6, 2025
…ibutes AWS Step Functions defines two semantic convention attributes: aws.step_functions.activity.arn aws.step_functions.state_machine.arn https://github.com/open-telemetry/semantic-conventions/blob/main/docs/registry/attributes/aws.md#amazon-step-functions-attributes Currently, these attributes are not set in the botocore instrumentation library. This PR adds support for them by extracting values from both Request and Response objects. Tests Added new unit tests (passing). Verified with: tox -e py312-test-instrumentation-botocore tox -e spellcheck tox -e lint-instrumentation-botocore tox -e ruff Backward Compatibility This change is backward compatible. It only adds instrumentation for additional AWS resources and does not modify existing behavior in the auto-instrumentation library. Note This PR depends on open-telemetry#3736. Since open-telemetry#3736 has not yet been merged, its changes are included here as well.
xrmx
approved these changes
Sep 9, 2025
chloe-zh97
pushed a commit
to chloe-zh97/opentelemetry-python-contrib
that referenced
this pull request
Sep 10, 2025
) * botocore: upgrade moto package from 5.0.9 to 5.1.11 Moto 5.0.9, released in May 2024, lacks support for certain AWS resources such as Step Functions APIs. This PR upgrades moto to the latest release (5.1.11) to add these capabilities. After the upgrade, one DynamoDB unit test failed. This PR also addresses that failure. The unit test failures after upgrading moto from 5.0.9 to 5.1.11 happened due to two key improvements in moto's DynamoDB implementation: 1. Enhanced Parameter Validation Before (moto 5.0.9): Moto had lenient validation and allowed invalid parameter combinations like Segment=21 with TotalSegments=17, even though this violates AWS DynamoDB's actual behavior. After (moto 5.1.11): Moto added stricter validation that matches AWS DynamoDB's real behavior: Segment parameter must be zero-based (0 to TotalSegments-1) Segment=21 with TotalSegments=17 now correctly throws ValidationException 2. More Accurate Parallel Scan Simulation Before (moto 5.0.9): Moto's parallel scan implementation was simplified and might have returned items regardless of which segment was being scanned, leading to predictable but incorrect behavior. After (moto 5.1.11): Moto improved its parallel scan simulation to more accurately reflect how AWS DynamoDB distributes items across segments: Items are distributed based on hash values of partition keys Different segments contain different subsets of data Segment 16 (out of 17 total) might legitimately contain 0 items if the hash distribution doesn't place any items there Why This Matters These changes make moto behave more like the actual AWS DynamoDB service, which is beneficial for testing because: Tests catch invalid parameter usage that would fail in production Tests reflect realistic data distribution patterns Code is validated against more accurate AWS behavior The test failures weren't bugs in the OpenTelemetry instrumentation code - they were issues with the test setup that became visible when moto started enforcing AWS's actual constraints and behavior patterns. * add changelog.
xrmx
added a commit
that referenced
this pull request
Sep 10, 2025
…ibutes (#3737) * botocore: Add support for AWS Step Functions semantic convention attributes AWS Step Functions defines two semantic convention attributes: aws.step_functions.activity.arn aws.step_functions.state_machine.arn https://github.com/open-telemetry/semantic-conventions/blob/main/docs/registry/attributes/aws.md#amazon-step-functions-attributes Currently, these attributes are not set in the botocore instrumentation library. This PR adds support for them by extracting values from both Request and Response objects. Tests Added new unit tests (passing). Verified with: tox -e py312-test-instrumentation-botocore tox -e spellcheck tox -e lint-instrumentation-botocore tox -e ruff Backward Compatibility This change is backward compatible. It only adds instrumentation for additional AWS resources and does not modify existing behavior in the auto-instrumentation library. Note This PR depends on #3736. Since #3736 has not yet been merged, its changes are included here as well. * add changelog. --------- Co-authored-by: Riccardo Magliocchetti <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Moto 5.0.9, released in May 2024, lacks support for certain AWS resources such as Step Functions APIs (describeActivity). This PR upgrades moto to the latest release (5.1.11) to add these capabilities.
After the upgrade, one DynamoDB unit test failed. This PR also addresses that failure.
The unit test failures after upgrading moto from 5.0.9 to 5.1.11 happened due to two key improvements in moto's DynamoDB implementation:
After (moto 5.1.11): Moto added stricter validation that matches AWS DynamoDB's real behavior:
Segment parameter must be zero-based (0 to TotalSegments-1)
Segment=21 with TotalSegments=17 now correctly throws ValidationException
After (moto 5.1.11): Moto improved its parallel scan simulation to more accurately reflect how AWS DynamoDB distributes items across segments:
Items are distributed based on hash values of partition keys
Different segments contain different subsets of data
Segment 16 (out of 17 total) might legitimately contain 0 items if the hash distribution doesn't place any items there
Why This Matters
These changes make moto behave more like the actual AWS DynamoDB service, which is beneficial for testing because:
Tests catch invalid parameter usage that would fail in production
Tests reflect realistic data distribution patterns
Code is validated against more accurate AWS behavior
The test failures weren't bugs in the OpenTelemetry instrumentation code - they were issues with the test setup that became visible when moto started enforcing AWS's actual constraints and behavior patterns.
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Test
Verified with:
tox -e py312-test-instrumentation-botocore
tox -e spellcheck
tox -e lint-instrumentation-botocore
tox -e ruff
Skip Changelog
as this PR only impacts unit tests.