Skip to content

Commit edb34e6

Browse files
authored
botocore: upgrade moto package from 5.0.9 to 5.1.11 (#3736)
* 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.
1 parent 67661d4 commit edb34e6

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4646
([#3699](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3699))
4747
- `opentelemetry-instrumentation-botocore`: Add support for SNS semantic convention attribute aws.sns.topic.arn
4848
([#3734](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3734))
49+
- `opentelemetry-instrumentation`: botocore: upgrade moto package from 5.0.9 to 5.1.11
50+
([#3736](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3736))
4951

5052
## Version 1.36.0/0.57b0 (2025-07-29)
5153

instrumentation/opentelemetry-instrumentation-botocore/test-requirements-0.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ iniconfig==2.0.0
1313
Jinja2==3.1.6
1414
jmespath==1.0.1
1515
MarkupSafe==2.1.5
16-
moto==5.0.9
16+
moto==5.1.11
1717
packaging==24.0
1818
pluggy==1.5.0
1919
py-cpuinfo==9.0.0

instrumentation/opentelemetry-instrumentation-botocore/test-requirements-1.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ iniconfig==2.0.0
1313
Jinja2==3.1.6
1414
jmespath==1.0.1
1515
MarkupSafe==2.1.5
16-
moto==5.0.9
16+
moto==5.1.11
1717
packaging==24.0
1818
pluggy==1.5.0
1919
py-cpuinfo==9.0.0

instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_dynamodb.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ def test_scan(self):
439439
Limit=42,
440440
Select="ALL_ATTRIBUTES",
441441
TotalSegments=17,
442-
Segment=21,
442+
Segment=16,
443443
ProjectionExpression="PE",
444444
ConsistentRead=True,
445445
ReturnConsumedCapacity="TOTAL",
@@ -448,14 +448,14 @@ def test_scan(self):
448448
span = self.assert_span("Scan")
449449
self.assert_table_names(span, self.default_table_name)
450450
self.assertEqual(
451-
21, span.attributes[SpanAttributes.AWS_DYNAMODB_SEGMENT]
451+
16, span.attributes[SpanAttributes.AWS_DYNAMODB_SEGMENT]
452452
)
453453
self.assertEqual(
454454
17, span.attributes[SpanAttributes.AWS_DYNAMODB_TOTAL_SEGMENTS]
455455
)
456-
self.assertEqual(1, span.attributes[SpanAttributes.AWS_DYNAMODB_COUNT])
456+
self.assertEqual(0, span.attributes[SpanAttributes.AWS_DYNAMODB_COUNT])
457457
self.assertEqual(
458-
1, span.attributes[SpanAttributes.AWS_DYNAMODB_SCANNED_COUNT]
458+
0, span.attributes[SpanAttributes.AWS_DYNAMODB_SCANNED_COUNT]
459459
)
460460
self.assert_attributes_to_get(span, "id", "idl")
461461
self.assert_consistent_read(span, True)

0 commit comments

Comments
 (0)