Skip to content
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

fix(AWSPinpoint): Connectivity errors should be retried indefinitely #4357

Merged
merged 4 commits into from Oct 25, 2022

Conversation

ruisebas
Copy link
Member

@ruisebas ruisebas commented Oct 20, 2022

Issue #, if available:

Description of changes:

  • Checking for attributes and metrics limits independently from each other, as Pinpoint does allow to have up to 40 metrics and 40 attributes.
  • Events that failed to submit due to connectivity errors are now considered to be retryable indefinitely, i.e. their retryCount won't be increased.
  • Removed warnings with NSKeyedUnarchiver due to missing allowed classes.

Check points:

  • Added new tests to cover change, if needed
  • All unit tests pass
  • All integration tests pass
  • Updated CHANGELOG.md
  • Documentation update for the change if required
  • PR title conforms to conventional commit style

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ruisebas ruisebas requested review from a team and awsmobilesdk as code owners October 20, 2022 20:11
phantumcode
phantumcode previously approved these changes Oct 20, 2022
@frankiesimon
Copy link

@ruisebas Sorry for the flood of comments. Just making sure it's clear. There IS a quota of also testing the combined number of metrics and attributes as I wrote in my last comment it's confirmed by AWS support. So you should probably not remove the check as the PR currently does but rather adjust it to what PinPoint would actually check. (And again, it's best if you reproduce on your end to confirm the behaviors when surpassing the separate/mutual quotas).

I can confirm the scenarios I tested but I didn't try to send 40 attributes and 40 metrics. The issue discussion has separate parts based on what I know vs what I was guessing. Last comment mostly relevant for this PR - adjusting the condition to be <=.

aws-amplify/amplify-swift#2471

@@ -115,12 +110,12 @@ - (void)addAttribute:(NSString *)theValue forKey:(NSString *)theKey {
if(!theKey) return;

@synchronized(self.attributes) {
if(self.currentNumOfAttributesAndMetrics < MAX_NUM_OF_METRICS_AND_ATTRIBUTES) {
if(self.attributes.count < MAX_NUM_OF_METRICS_AND_ATTRIBUTES) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the correct quota check would be the same as before BUT the comparison should be <=. Also the same warning applies.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm waiting for someone from Pinpoint to confirm which one is the right limit, as I was able to successfully submit events with 40 metrics and 40 attributes.

Note that when this condition evaluates to true, we add a new attribute.

So the check needs to be < regardless, otherwise we would accept one extra attribute when the event is already at its capacity limit, which would result in Pinpoint rejecting its submission.

The same applies for the addMetric method below.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification I understand now why the condition is < and not <=.

@@ -160,11 +155,11 @@ - (void)addMetric:(NSNumber *)theValue forKey:(NSString *)theKey {
}

@synchronized(self.metrics) {
if(self.currentNumOfAttributesAndMetrics < MAX_NUM_OF_METRICS_AND_ATTRIBUTES) {
if(self.metrics.count < MAX_NUM_OF_METRICS_AND_ATTRIBUTES) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the correct quota check would be the same as before BUT the comparison should be <=. Also the same warning applies.

@ruisebas ruisebas merged commit 1e49d0f into main Oct 25, 2022
@ruisebas ruisebas deleted the ruisebas/analytics_offline_submit branch October 25, 2022 20:25
gabek pushed a commit to KeepSafe/aws-sdk-ios that referenced this pull request Aug 31, 2023
…ws-amplify#4357)

Also:
- Updating Pinpoint event quotas and exposing them as public constants
- Removing NSKeyedUnarchiver warnings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants