Skip to content

HTTPClient: verbose logs for request IDs#3320

Merged
NachoSoto merged 2 commits into
mainfrom
log-request-id
Oct 26, 2023
Merged

HTTPClient: verbose logs for request IDs#3320
NachoSoto merged 2 commits into
mainfrom
log-request-id

Conversation

@NachoSoto

@NachoSoto NachoSoto commented Oct 20, 2023

Copy link
Copy Markdown
Contributor

See https://github.com/RevenueCat/khepri/pull/6798.
This can help debug issues as it helps us cross-reference requests on our end.

Changes:

  • Logging X-Request-ID and X-Amzn-Trace-ID headers if present (only in verbose mode)
  • Logging these even for failed requests
  • Also logging request_handled_by_load_shedder for failed requests
  • To accomplish that. HTTPURLResponse now conforms to our HTTPResponseType, this allows us to extract headers in an uniform way

Example:

[network] DEBUG: ℹ️ API request completed: GET '/v1/subscribers/$RCAnonymousID%3Ad9dc4f3b33054cf28c0f2ec9da0f48d5' (304)
Request-ID: 'be534c50-5231-403b-be2f-7c077861751d'; Amzn-Trace-ID: 'Root=1-6532c6ca-7ef80f961ec9c4145484df13'

@NachoSoto NachoSoto requested review from a team and antoniobg October 20, 2023 18:24
@NachoSoto NachoSoto force-pushed the log-request-id branch 2 times, most recently from c36d872 to 2e705d5 Compare October 24, 2023 16:51
See https://github.com/RevenueCat/khepri/pull/6798.

- Logging `X-Request-ID` and `X-Amzn-Trace-ID` headers if present (only in verbose mode)
- Logging these even for failed requests
- Also logging `request_handled_by_load_shedder` for failed requests
- To accomplish that. `HTTPURLResponse` now conforms to our `HTTPResponseType`, this allows us to extract headers in an uniform way
@codecov

codecov Bot commented Oct 24, 2023

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 91.42857% with 6 lines in your changes missing coverage. Please review.

Project coverage is 85.98%. Comparing base (0aa950a) to head (8c77901).
Report is 503 commits behind head on main.

Files with missing lines Patch % Lines
Sources/Networking/HTTPClient/HTTPResponse.swift 72.72% 3 Missing ⚠️
Sources/Logging/Strings/NetworkStrings.swift 90.00% 2 Missing ⚠️
Sources/Networking/HTTPClient/HTTPClient.swift 96.29% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3320      +/-   ##
==========================================
+ Coverage   85.96%   85.98%   +0.02%     
==========================================
  Files         237      237              
  Lines       17086    17120      +34     
==========================================
+ Hits        14688    14721      +33     
- Misses       2398     2399       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joshdholtz joshdholtz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yesssss... love this ❤️

@NachoSoto NachoSoto merged commit ed80980 into main Oct 26, 2023
@NachoSoto NachoSoto deleted the log-request-id branch October 26, 2023 03:24
NachoSoto added a commit that referenced this pull request Oct 26, 2023
**This is an automatic release.**

### New Features
* `PaywallColor`: change visibility of `Color.init(light:dark:)` to
`private` (#3345) via NachoSoto (@NachoSoto)
### RevenueCatUI
* `Paywalls`: new `.onPurchaseCompleted` overload with
`StoreTransaction` (#3323) via NachoSoto (@NachoSoto)
* `Paywalls`: finished template 5 (#3340) via NachoSoto (@NachoSoto)
* `Paywalls`: new `onDismiss` parameter for `presentPaywallIfNeeded`
(#3342) via NachoSoto (@NachoSoto)
* `Paywalls`: disable shimmering on footer loading view (#3324) via
NachoSoto (@NachoSoto)
### Bugfixes
* `ErrorUtils.purchasesError(withSKError:)`: handle `URLError`s (#3346)
via NachoSoto (@NachoSoto)
### Other Changes
* `Paywalls`: add identifier to events (#3332) via Josh Holtz
(@joshdholtz)
* `Paywalls`: create new event session when paywall appears (#3330) via
Josh Holtz (@joshdholtz)
* `HTTPClient`: verbose logs for request IDs (#3320) via NachoSoto
(@NachoSoto)
* `Paywalls Tester`: fix `macOS` build (#3341) via NachoSoto
(@NachoSoto)
* `ProductFetcherSK1`: enable `TimingUtil` log (#3327) via NachoSoto
(@NachoSoto)
* `Paywall Tester`: fixed paywall presentation (#3339) via NachoSoto
(@NachoSoto)
* `CI`: replace Carthage build jobs with `xcodebuild` (#3338) via
NachoSoto (@NachoSoto)
* `Integration Tests`: use repetition count from test plan (#3329) via
NachoSoto (@NachoSoto)
* `Integration Tests`: new logs for troubleshooting flaky tests (#3328)
via NachoSoto (@NachoSoto)
* `CircleCI`: change iOS 17 job to use M1 Large resource (#3322) via
NachoSoto (@NachoSoto)
* `Paywalls Tester`: fix release build (#3321) via NachoSoto
(@NachoSoto)
* `Paywalls`: enable all iOS 17 tests (#3331) via NachoSoto (@NachoSoto)
* `CI`: added workaround for Snapshots in `Xcode Cloud` (#2857) via
NachoSoto (@NachoSoto)
* `StoreKit 1`: disabled `finishTransactions` log on observer mode
(#3314) via NachoSoto (@NachoSoto)

---------

Co-authored-by: NachoSoto <ignaciosoto90@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants