fix(ios): pin the SDK build that reports where a request's time went - #549
Merged
Conversation
maple-swift 0.2.1 records URLSession's connection phases on client spans. The mobile screens are slow and maple-api is not the reason: joining 241 iOS client spans to their own server span in the same trace puts 404ms p50 / 1148ms p95 *before* the server and 97ms / 759ms *after* it, against 233ms / 857ms of actual server work. In the worst trace the app held two completed responses for twelve seconds — both ending at the same instant, long after the API had answered in ~220ms. Nothing in the trace could say what that time was, because the SDK's relay delegate built URLSessionTaskMetrics and dropped them. 0.2.1 keeps them, so the gap resolves into DNS, TLS, queueing, TTFB and body transfer instead of a guess. No app-side behaviour changes here — this is the instrument, and the fix follows the numbers it produces.
🍁 Maple PR previewNote Preview resources were removed when this pull request closed. Final commit |
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.
Bumps
maple-swiftto 0.2.1, which recordsURLSession's connection phases on client spans.Why
The mobile screens load slowly and
maple-apiis not the reason. Joining 241 iOS client spans to their ownmaple-apiserver span in the same trace:Two thirds of every request happens outside the API. Home's five requests do fan out in parallel — that part is fine — but in trace
85db338c…the app held two completed responses for 12.6 s, both ending at the same instant, long after the API had answered them in ~220 ms.Contention is implicated: a request with no concurrent peers has an 89 ms post-server tail; with peers it is 496 ms p50 / 5,820 ms p95, and the request's own payload size does not explain the difference (~18 KB in every bucket).
Why the traces could not say more
The SDK's relay delegate implemented
didReceive/didCompleteWithErrorbut notdidFinishCollecting, soURLSessionTaskMetrics— whichURLSessionhad been measuring all along — was built and discarded. That is why 404 ms of pre-server time had no attribution.0.2.1 keeps them. The gap now resolves into
maple.http.{queued,dns,connect,tls,request,ttfb,response}_ms, plusmaple.http.connection.reusedand semconv'shttp.request.resend_countandnetwork.protocol.{name,version}.maple.http.queued_msvsresponse_msis what separates "connection setup" from "body transfer stuck behind something", which is the open question.Scope
Instrument only — no app-side behaviour changes. The fix follows the numbers this produces rather than the current best guess at them.
Two things found along the way, left for separate changes:
ui.screenspans measure time-on-screen (max observed: 11 hours) and sit in the same latency rollup as real operations, which is whylist_servicesreports maple-ios P95 = 12.62 s. That number is currently meaningless./alerts/rules?limit=100(42 KB) and/error_issues?limit=100(39 KB), where the issues response is used only to compute two integers. Trimming it needs a count endpoint on the API side.Verification
xcodegen generate+xcodebuild -scheme Mapleagainst 0.2.1: BUILD SUCCEEDEDMapleTracingTests60 passed (5 new),MapleReplayTests80 passedproject.ymlis the only durable pin — the generated.pbxprojand itsPackage.resolvedare gitignored.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.