Diagnostics: Track endpoint hit#803
Conversation
There was a problem hiding this comment.
I removed this test since the encoding part now is part of the EndpointTest.
There was a problem hiding this comment.
I added a name, which will be used when posting data to the diagnostics endpoint. I thought about posting the path template but that wasn't very readable.
There was a problem hiding this comment.
Nice 👍🏻
I did this refactor for iOS and it's been useful.
Codecov Report
@@ Coverage Diff @@
## diagnostics #803 +/- ##
==============================================
Coverage ? 82.35%
==============================================
Files ? 130
Lines ? 4308
Branches ? 547
==============================================
Hits ? 3548
Misses ? 543
Partials ? 217 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Nice 👍🏻
I did this refactor for iOS and it's been useful.
There was a problem hiding this comment.
"Hit" is a weird word for for this. Maybe trackRequest(endpoint:...)?
There was a problem hiding this comment.
Hmm what would you name the event that gets sent when we perform a request? request seems not descriptive enough. Maybe http_request_performed? This would be trackHttpRequestPerformedIfNeeded then.
There was a problem hiding this comment.
Just did the rename. Lmk what you think!
There was a problem hiding this comment.
hit here on the other hand makes sense, for a cache "hit" vs "miss" 👍🏻
9c954f3 to
dfa2575
Compare
|
|
||
| fun trackHttpRequestPerformed( | ||
| endpoint: Endpoint, | ||
| responseTime: Long, |
There was a problem hiding this comment.
Does Kotlin have any sort of "Duration" type? It would be nice to encode in the type system that this is milliseconds.
There was a problem hiding this comment.
Good idea! There is a Duration type indeed representing a difference in time. I think that could fit here well 👍
| val payload: String, | ||
| val origin: Origin | ||
| ) { | ||
| enum class Origin { |
There was a problem hiding this comment.
This would be a good thing to add to iOS too.
|
Tests are failing due to SDKMAN but they are passing locally and since this is being merged to a non-main branch, will merge it for now. Will deal with those issues in that branch. |
### 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 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 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 We broke posting receipts to the backend in #803 This fixes it so we post to the correct URL
Description
Based on #795
Deals with CSDK-655
Changes
endpoint_hitevent to the diagnostics endpoint on every requestEndpointclass with the enpoints we support, instead of hardcoding the path on each method.