-
Notifications
You must be signed in to change notification settings - Fork 407
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
feat(parser): add KinesisFirehoseModel #1556
feat(parser): add KinesisFirehoseModel #1556
Conversation
@leandrodamascena we might want to do an E2E for this. Due to parser's nature, it has the highest risk of causing runtime disruption. |
Codecov ReportBase: 99.73% // Head: 99.77% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #1556 +/- ##
===========================================
+ Coverage 99.73% 99.77% +0.03%
===========================================
Files 124 126 +2
Lines 5718 5757 +39
Branches 651 656 +5
===========================================
+ Hits 5703 5744 +41
+ Misses 8 6 -2
Partials 7 7
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Hii @ran-isenberg thanks for one more PR 😃.. I'm starting to work on it now. @heitorlessa in fact adding e2e tests is a big improvement in the parser area. I just need to check how much data we need to generate in |
+1 for E2E tests. |
Yeah Ran, it makes sense and I understand your concern.. But for now we can write e2e tests when someone adds a new service, feature or even extends an existing feature and make life easier for new contributors. |
You use CDK right? |
Yeah, we use CDK for e2 testing. But I have some considerations to make about e2e testing before we think about any implementation on Parser.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to update the code to account for differences between payloads.
Payload using Kinesis Firehose with a Kinesis Stream as source:
{
"invocationId":"77c0024f-9869-4af0-951a-d83c102e8a63",
"sourceKinesisStreamArn":"arn:aws:kinesis:us-east-1:200984112386:stream/kinesis-evento",
"deliveryStreamArn":"arn:aws:firehose:us-east-1:200984112386:deliverystream/KDS-S3-10POr",
"region":"us-east-1",
"records":[
{
"recordId":"49633602406469139358835205474851822974501572780333465650000000",
"approximateArrivalTimestamp":1664028793294,
"data":"eyJ1c2VyX2lkIjoidXNlcjEiLCAic2NvcmUiOiAxMDB9Cg==",
"kinesisRecordMetadata":{
"sequenceNumber":"49633602406469139358835205474851822974501572780333465650",
"subsequenceNumber":0,
"partitionKey":"0",
"shardId":"shardId-000000000003",
"approximateArrivalTimestamp":1664028793294
}
},
{
"recordId":"49633602406469139358835205474853031900321189264934043698000000",
"approximateArrivalTimestamp":1664028820148,
"data":"eyJ1c2VyX2lkIjoidXNlcjEiLCAic2NvcmUiOiAxMDB9Cg==",
"kinesisRecordMetadata":{
"sequenceNumber":"49633602406469139358835205474853031900321189264934043698",
"subsequenceNumber":0,
"partitionKey":"0",
"shardId":"shardId-000000000003",
"approximateArrivalTimestamp":1664028820148
}
}
]
}
Payload using Kinesis Firehose with Direct PUT:
{
"invocationId":"25326478-5c08-45ad-a34d-7342edbc942d",
"deliveryStreamArn":"arn:aws:firehose:us-east-1:200984112386:deliverystream/PUT-S3-PCYyW",
"region":"us-east-1",
"records":[
{
"recordId":"49633602747871247603140515133584305740288993709252411394000000",
"approximateArrivalTimestamp":1664029185290,
"data":"eyJ1c2VyX2lkIjoidXNlcjEiLCAic2NvcmUiOiAxMDB9Cg=="
},
{
"recordId":"49633602747871247603140515133585514666108608544585547778000000",
"approximateArrivalTimestamp":1664029186945,
"data":"eyJ1c2VyX2lkIjoidXNlcjEiLCAic2NvcmUiOiAxMDB9Cg=="
}
]
}
We can go in the same direction as we went here #1499 and create separate classes for each type of payload.
The way I'd handle schemas is to put the models in a new repo and maintain proper versions BUT it should be managed and updated by the AWS services, not the community. They should be aware of how we use and model the events since sometime the docs are not good enough. |
I've modeled the metadata as optional so it works for both cases. The only reason to split them is if it's officially documented as such. do you think that's the case? I didnt find a mention that metadata params are applicable only for put events. If we add by ourselves, it's more likely to be broken in the future. |
I'll open an issue and add this discussion in there, so we can keep focus here in this PR. ok? |
No problem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ran-isenberg could please check this changes?
aws_lambda_powertools/utilities/parser/models/kinesis_firehose.py
Outdated
Show resolved
Hide resolved
aws_lambda_powertools/utilities/parser/models/kinesis_firehose.py
Outdated
Show resolved
Hide resolved
I totally agree with you! 💯 |
@leandrodamascena added my small fix and fixed develop conflict |
Heyy good morning and happy monday @ran-isenberg! |
LGTM |
Issue number: #1555
Summary
Add Kinesis Data Firehose event envelope and parser model
Checklist
If your change doesn't seem to apply, please leave them unchecked.
Is this a breaking change?
RFC issue number:
Checklist:
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.
View rendered docs/utilities/parser.md