aws-powertools / powertools-lambda-python

A developer toolkit to implement Serverless best practices and increase developer velocity.
https://docs.powertools.aws.dev/lambda/python/latest/
MIT No Attribution
2.72k stars 378 forks source link

fix(event_sources): change partition and offset field types in KafkaEventRecord #4515

Closed scampbell5 closed 3 weeks ago

scampbell5 commented 3 weeks ago

Issue number: https://github.com/aws-powertools/powertools-lambda-python/issues/4504

Summary

Changes

Updated offset and partition properties to be an int type instead of str on the KafkaEventRecord class.

User experience

from aws_lambda_powertools.utilities.data_classes import event_source, KafkaEvent

@event_source(data_class=KafkaEvent)
def lambda_handler(event: KafkaEvent, context):
    assert isinstance(event.record.offset, int)
    assert isinstance(event.record.partition, int)

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change? **RFC issue number**: Checklist: * [ ] Migration process documented * [ ] Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

boring-cyborg[bot] commented 3 weeks ago

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need. In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

sonarcloud[bot] commented 3 weeks ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.43%. Comparing base (e14e768) to head (cf74437). Report is 571 commits behind head on develop.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #4515 +/- ## =========================================== + Coverage 96.38% 96.43% +0.05% =========================================== Files 214 219 +5 Lines 10030 10626 +596 Branches 1846 1976 +130 =========================================== + Hits 9667 10247 +580 - Misses 259 267 +8 - Partials 104 112 +8 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

boring-cyborg[bot] commented 3 weeks ago

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!