Skip to content

Diagnostics support#766

Closed
tonidero wants to merge 13 commits into
mainfrom
telemetry
Closed

Diagnostics support#766
tonidero wants to merge 13 commits into
mainfrom
telemetry

Conversation

@tonidero

@tonidero tonidero commented Feb 1, 2023

Copy link
Copy Markdown
Contributor

Description

Starting https://revenuecats.atlassian.net/browse/CSDK-646

In this PR we add basic support for diagnostics metrics we want to be aware of. The data sent will be completely anonymous. This PR adds the basic architecture plus the file management in the device.

Main features remaining:

@tonidero tonidero added pr:feat A new feature WIP labels Feb 1, 2023
@codecov

codecov Bot commented Feb 2, 2023

Copy link
Copy Markdown

Codecov Report

Merging #766 (6255231) into main (3663eb4) will increase coverage by 0.42%.
The diff coverage is 89.92%.

@@            Coverage Diff             @@
##             main     #766      +/-   ##
==========================================
+ Coverage   81.54%   81.97%   +0.42%     
==========================================
  Files         121      127       +6     
  Lines        3999     4127     +128     
  Branches      512      521       +9     
==========================================
+ Hits         3261     3383     +122     
  Misses        535      535              
- Partials      203      209       +6     
Impacted Files Coverage Δ
.../main/kotlin/com/revenuecat/purchases/Purchases.kt 83.69% <0.00%> (-0.11%) ⬇️
...in/java/com/revenuecat/purchases/common/Backend.kt 83.33% <50.00%> (-0.39%) ⬇️
...chases/common/diagnostics/DiagnosticsAnonymizer.kt 50.00% <50.00%> (ø)
...chases/common/diagnostics/DiagnosticsFileHelper.kt 77.77% <77.77%> (ø)
...otlin/com/revenuecat/purchases/PurchasesFactory.kt 92.40% <78.94%> (-4.32%) ⬇️
...java/com/revenuecat/purchases/common/FileHelper.kt 93.10% <93.10%> (ø)
...purchases/common/diagnostics/DiagnosticsManager.kt 93.10% <93.10%> (ø)
...t/purchases/common/diagnostics/DiagnosticsEvent.kt 100.00% <100.00%> (ø)
...at/purchases/common/diagnostics/MetricEventName.kt 100.00% <100.00%> (ø)
...com/revenuecat/purchases/PurchasesConfiguration.kt 100.00% <100.00%> (+14.63%) ⬆️
... and 2 more

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

@tonidero tonidero left a comment

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.

There is some functionality missing which I plan to address in other PRs since this PR was getting too big. I also have some questions I posted in slack but in the meantime, I think this could get an initial review.

onSuccessHandler: (JSONObject) -> Unit,
onErrorHandler: (PurchasesError) -> Unit
) {
// WIP: Perform request

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.

Will deal with these WIPs in a different PR (this PR is already too big)

telemetryList = telemetryList,
onSuccessHandler = {
verboseLog("Synced telemetry file successfully.")
telemetryFileHelper.cleanSentTelemetry(telemetryCount)

@tonidero tonidero Feb 2, 2023

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 is so, if we track an event while there is a sync in progress, we still send it on the next configure call.

@tonidero tonidero requested a review from a team February 2, 2023 13:56
import org.json.JSONArray
import org.json.JSONObject

sealed class TelemetryEvent(val telemetryType: String) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is nice.

@NachoSoto NachoSoto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a great initial implementation 👍🏻
Will be very easy to replicate in iOS.

Comment thread common/src/main/java/com/revenuecat/purchases/common/FileHelper.kt Outdated
Comment thread api-tester/src/main/java/com/revenuecat/apitester/java/PurchasesAPI.java Outdated
Comment thread common/src/main/java/com/revenuecat/purchases/common/FileHelper.kt Outdated
Comment thread common/src/main/java/com/revenuecat/purchases/common/FileHelper.kt
@tonidero tonidero changed the title Telemetry support Diagnostics support Feb 9, 2023
@tonidero

tonidero commented Feb 9, 2023

Copy link
Copy Markdown
Contributor Author

I'm closing this in favor of new PRs that better split the code: #783, #784, #785

@tonidero tonidero closed this Feb 9, 2023
@tonidero tonidero deleted the telemetry branch March 31, 2023 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:feat A new feature WIP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants