Diagnostics: Diagnostics split manager into tracker and synchronizer#795
Merged
tonidero merged 5 commits intoFeb 17, 2023
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## diagnostics #795 +/- ##
==============================================
Coverage ? 82.07%
==============================================
Files ? 129
Lines ? 4250
Branches ? 538
==============================================
Hits ? 3488
Misses ? 549
Partials ? 213 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
de85a24 to
a5f1219
Compare
Base automatically changed from
diagnostics-limit-events-sent
to
diagnostics
February 16, 2023 09:32
193d5d3 to
55865b4
Compare
NachoSoto
approved these changes
Feb 16, 2023
| import com.revenuecat.purchases.common.verboseLog | ||
| import java.io.IOException | ||
|
|
||
| class DiagnosticsTracker( |
Contributor
There was a problem hiding this comment.
It would help to have a docstring here too, otherwise I'd be wondering what the difference between this and DiagnosticsManager is.
tonidero
added a commit
that referenced
this pull request
Feb 22, 2023
### 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
tonidero
added a commit
that referenced
this pull request
Feb 22, 2023
…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.
tonidero
added a commit
that referenced
this pull request
Feb 22, 2023
### 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
tonidero
added a commit
that referenced
this pull request
Feb 28, 2023
…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.
tonidero
added a commit
that referenced
this pull request
Feb 28, 2023
### 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
tonidero
added a commit
that referenced
this pull request
Feb 28, 2023
…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.
tonidero
added a commit
that referenced
this pull request
Feb 28, 2023
### 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Based on #793
This PR refactors previous code to split the
DiagnosticsManagerintoDiagnosticsTrackerandDiagnosticsSynchronizer. This is a prerequisite to avoid circular dependencies when tracking request data.DiagnosticsManager->Backend->HttpClient->DiagnosticsManager.DiagnosticsSynchronizer->Backendfor syncing andHttpClient->DiagnosticsTrackerfor tracking requestsI 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.