Skip to content

Diagnostics#811

Merged
tonidero merged 13 commits into
mainfrom
diagnostics
Feb 28, 2023
Merged

Diagnostics#811
tonidero merged 13 commits into
mainfrom
diagnostics

Conversation

@tonidero

@tonidero tonidero commented Feb 22, 2023

Copy link
Copy Markdown
Contributor

Description

This is the integration branch for all the Diagnostics feature. All code here has already been reviewed in different PRs.

This feature allows developers to opt-in to send us diagnostics information through a flag in the PurchasesConfiguration object. This information is anonymized and will only be used to improve the RevenueCat product.

@tonidero tonidero added the pr:feat A new feature label Feb 22, 2023
* Examples of this information include response times, cache hits or error codes.
* This information will be anonymized so it can't be traced back to the end-user.
* The default value is false.
*/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These docs weren't actually reviewed. So would appreciate a look here before merging this.

@tonidero

Copy link
Copy Markdown
Contributor Author

Tests still failing due to sdkman, but in the meantime, I will need an approval to get this merged. All code has already been reviewed except that documentation comment

@tonidero tonidero marked this pull request as ready for review February 22, 2023 18:50
@tonidero tonidero requested a review from a team February 22, 2023 18:50
@codecov

codecov Bot commented Feb 23, 2023

Copy link
Copy Markdown

Codecov Report

Merging #811 (dc3904a) into main (811fdae) will increase coverage by 0.93%.
The diff coverage is 90.33%.

❗ Current head dc3904a differs from pull request most recent head 1e41da9. Consider uploading reports for the commit 1e41da9 to get more accurate results

@@            Coverage Diff             @@
##             main     #811      +/-   ##
==========================================
+ Coverage   81.54%   82.48%   +0.93%     
==========================================
  Files         121      131      +10     
  Lines        3999     4339     +340     
  Branches      512      549      +37     
==========================================
+ Hits         3261     3579     +318     
- Misses        535      543       +8     
- Partials      203      217      +14     
Impacted Files Coverage Δ
...ain/java/com/revenuecat/purchases/common/Config.kt 100.00% <ø> (ø)
...a/com/revenuecat/purchases/utils/SyncDispatcher.kt 50.00% <ø> (ø)
...otlin/com/revenuecat/purchases/PurchasesFactory.kt 76.66% <40.62%> (-20.06%) ⬇️
...java/com/revenuecat/purchases/common/Dispatcher.kt 75.67% <62.50%> (+2.94%) ⬆️
...chases/common/diagnostics/DiagnosticsFileHelper.kt 80.00% <80.00%> (ø)
...java/com/revenuecat/purchases/common/Anonymizer.kt 81.81% <81.81%> (ø)
...java/com/revenuecat/purchases/common/FileHelper.kt 93.10% <93.10%> (ø)
...ases/common/diagnostics/DiagnosticsSynchronizer.kt 93.75% <93.75%> (ø)
...in/java/com/revenuecat/purchases/common/Backend.kt 85.64% <95.16%> (+1.92%) ⬆️
...purchases/common/diagnostics/DiagnosticsTracker.kt 96.29% <96.29%> (ø)
... and 20 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Comment thread .sdkmanrc
# Enable auto-env through the sdkman_auto_env config
# Add key=value pairs of SDKs to use below
java=11.0.13-librca
java=11.0.17-librca

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was bumped to try to fix sdkman issues. Didn't help but I thought it was worth updating since the older version doesn't seem to appear on sdkman versions list

@NachoSoto

Copy link
Copy Markdown
Contributor

Let's make sure we merge this with "rebase" and not "squash" to keep the commit history? 🙏🏻

@NachoSoto

Copy link
Copy Markdown
Contributor

Merging will increase coverage by 0.93%.

👏🏻

@tonidero

Copy link
Copy Markdown
Contributor Author

Let's make sure we merge this with "rebase" and not "squash" to keep the commit history? 🙏🏻

I think we need to squash it so it appears as a single commit on main and the changelog generation works correctly? I guess we could modify it after it's been generated but that would probably dirty the history a bit. Does that make sense @NachoSoto ?

@NachoSoto

Copy link
Copy Markdown
Contributor

I'm mainly thinking that having a 3000 line commit might be harder to manage if we need to git blame or git bisect, versus the individual PRs that you've made. I think you neatly organized each PR as a small change, so I don't think it's dirtying the history at all.
As for the changelog, we can combine all of them in a single entry (might do the same with signature verification in iOS too).

@tonidero

Copy link
Copy Markdown
Contributor Author

I'm mainly thinking that having a 3000 line commit might be harder to manage if we need to git blame or git bisect, versus the individual PRs that you've made. I think you neatly organized each PR as a small change, so I don't think it's dirtying the history at all. As for the changelog, we can combine all of them in a single entry (might do the same with signature verification in iOS too).

Sounds good! I will do that then. Also, can I get an approval here @RevenueCat/coresdk ?

### Description
Based on #787 

This PR adds support to enable/disable diagnostics (disabled by default)
and adds all the plumbing to sync diagnostics when configuring the SDK.
…795)

### Description
Based on #793 
This PR refactors previous code to split the `DiagnosticsManager` into
`DiagnosticsTracker` and `DiagnosticsSynchronizer`. This is a
prerequisite to avoid circular dependencies when tracking request data.
- Before:
`DiagnosticsManager`->`Backend`->`HttpClient`->`DiagnosticsManager`.
- After: `DiagnosticsSynchronizer`->`Backend` for syncing and
`HttpClient`->`DiagnosticsTracker` for tracking requests

I could have tried to extract this logic from the HttpClient, but that
would be a bigger refactor. This was the simplest solution I thought for
this problem. Also, sorry I didn't see that issue before. I didn't
modify the #785 PR directly to try to avoid some conflicts that would
happen if I did it there directly.
### Description
Based on #795 
Deals with [CSDK-655](https://revenuecats.atlassian.net/browse/CSDK-655)

### Changes
- Adds functionality to send an `endpoint_hit` event to the diagnostics
endpoint on every request
- Adds the `Endpoint` class with the enpoints we support, instead of
hardcoding the path on each method.
- Adds functionality to detect whether a response comes from the backend
or the cache.

[CSDK-655]:
https://revenuecats.atlassian.net/browse/CSDK-655?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
### Description
Deals with
[SDK-2865](https://linear.app/revenuecat/issue/SDK-2865/add-random-jitter-to-diagnostics-requests)

This increases the jittering we add for diagnostics calls to make sure
they don't cause any interference with the main SDK calls.
### Description
This PR we are adapting the code to the latest changes in the backend. 

### Changes
- We've removed `exceptions` as a type of diagnostic, those can be sent
as a Log/Event
- We've renamed `DiagnosticsEvent` to `DiagnosticsEntry`
- We've renamed `DiagnosticsEvent.Log` to `DiagnosticsEntry.Event`
- Renamed "type" of `DiagnosticsEntry.Event` to `event`
- Enabled diagnostics and verbose logs in purchase tester.
@tonidero tonidero enabled auto-merge (rebase) February 28, 2023 19:19
@tonidero tonidero merged commit 890e379 into main Feb 28, 2023
@tonidero tonidero deleted the diagnostics branch February 28, 2023 19:36
tonidero added a commit that referenced this pull request Mar 2, 2023
**This is an automatic release.**

### New Features
* Diagnostics (#811) via Toni Rico (@tonidero)
### Dependency Updates
* Bump fastlane from 2.212.0 to 2.212.1 (#821) via dependabot[bot]
(@dependabot[bot])
* Bump fastlane from 2.211.0 to 2.212.0 (#808) via dependabot[bot]
(@dependabot[bot])
* Bump fastlane-plugin-versioning_android from 0.1.0 to 0.1.1 (#798) via
dependabot[bot] (@dependabot[bot])
* Bump danger from 8.6.1 to 9.2.0 (#778) via dependabot[bot]
(@dependabot[bot])
### Other Changes
* Fix bundle install on CircleCI (#827) via Cesar de la Vega (@vegaro)
* Update README.md to include minimum Kotlin version (#786) via Cesar de
la Vega (@vegaro)
* Remove `tag_release_with_latest_if_needed` fastlane lane (#781) via
Cesar de la Vega (@vegaro)
* Adds docs for timeouts when closing and releasing (#759) via Cesar de
la Vega (@vegaro)
* Add Amazon App tester package to purchase tester queries (#789) via
Stefan Wehner (@tonidero)

---------

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
Co-authored-by: Toni Rico <antonio.rico.diez@revenuecat.com>
tonidero added a commit that referenced this pull request Mar 9, 2023
## 5.8.2

⚠️ ⚠️ ⚠️ ⚠️ 

Android SDK versions 5.8.0 and 5.8.1 have a major bug that prevents
sending purchase tokens to RevenueCat. Users will get charged but won't
receive entitlements. An automatic refund will occur after 72 hours
unless an unaffected SDK version is used. Downgrade to 5.7.1 or upgrade
to 5.8.2 or later to avoid this bug.
Users who got charged while using 5.8.0 and 5.8.1 will be able to access
their purchases automatically upon opening an app that uses 5.7.1 or
lower, or 5.8.2 or higher.

⚠️ ⚠️ ⚠️ ⚠️

### Other changes in 5.8.0 and 5.8.1
### New Features
* Diagnostics (#811) via Toni Rico (@tonidero)
### Bugfixes
* Fix issue with missing subscriber attributes if set after login but
before login callback (#809) via Toni Rico (@tonidero)
### Dependency Updates
* Bump fastlane from 2.212.0 to 2.212.1 (#821) via dependabot[bot]
(@dependabot[bot])
* Bump fastlane from 2.211.0 to 2.212.0 (#808) via dependabot[bot]
(@dependabot[bot])
* Bump fastlane-plugin-versioning_android from 0.1.0 to 0.1.1 (#798) via
dependabot[bot] (@dependabot[bot])
* Bump danger from 8.6.1 to 9.2.0 (#778) via dependabot[bot]
(@dependabot[bot])
### Other Changes
* Fix docs deployment (#836) via Toni Rico (@tonidero)
* Fix SDKMAN issues (#822) via Toni Rico (@tonidero)
* Fix bundle install on CircleCI (#827) via Cesar de la Vega (@vegaro)
* Update README.md to include minimum Kotlin version (#786) via Cesar de
la Vega (@vegaro)
* Remove `tag_release_with_latest_if_needed` fastlane lane (#781) via
Cesar de la Vega (@vegaro)
* Adds docs for timeouts when closing and releasing (#759) via Cesar de
la Vega (@vegaro)
* Add Amazon App tester package to purchase tester queries (#789) via
Stefan Wehner (@tonidero)

---------

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
Co-authored-by: Toni Rico <antonio.rico.diez@revenuecat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:feat A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants