Skip to content

Instrument Android checkout failures - #676

Open
tiagocandido wants to merge 1 commit into
telemetry/swift-integrationfrom
telemetry/android-integration
Open

Instrument Android checkout failures#676
tiagocandido wants to merge 1 commit into
telemetry/swift-integrationfrom
telemetry/android-integration

Conversation

@tiagocandido

@tiagocandido tiagocandido commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Record Android checkout errors, protocol decoding failures, paired navigation retry outcomes, and navigation duration
  • Add a default-on telemetry setting with an explicit runtime opt-out that discards buffered measurements
  • Lazily and failure-safely initialize telemetry, avoiding threads and wake-ups on the disabled path, and guard recorder creation against a concurrent runtime opt-out
  • Report react-native-android as the platform when embedded in React Native, android otherwise
  • Keep retry reasons paired across attempts and preserve preload attribution captured at navigation start
  • Match the cross-platform decode taxonomy: envelope decode failures record envelope and params decode failures record params
  • Record decode errors once per undecodable message, not once per client decode attempt: a message decoded by both a merchant handler and the kit default client counts once, and a terminal ec.error with undecodable params records even when nothing subscribes to it
  • Document the bounded diagnostic data and explicit opt-out

Validation

  • Android unit tests
  • Detekt
  • Android API dump and API compatibility checks

@github-actions github-actions Bot added the #gsd:50662 Rebase Checkout Kit on UCP label Aug 18, 2026
@tiagocandido
tiagocandido force-pushed the telemetry/android-integration branch from c4a1ff0 to f8749f0 Compare August 19, 2026 13:02
@tiagocandido
tiagocandido force-pushed the telemetry/swift-integration branch from 0bdb099 to da2ae5b Compare August 19, 2026 13:02
@tiagocandido
tiagocandido force-pushed the telemetry/android-integration branch from f8749f0 to 8a67b38 Compare August 24, 2026 11:17
@tiagocandido
tiagocandido force-pushed the telemetry/swift-integration branch from da2ae5b to 0611c9e Compare August 24, 2026 11:17

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown

Package Size

Platform Artifact Base Head Delta
Android release AAR 349.8 KiB 364.6 KiB +14.8 KiB
Android file breakdown
File Base Head Delta
classes.jar 372.3 KiB 388.2 KiB +15.9 KiB
res/layout/checkout_view_content.xml 2.6 KiB 2.6 KiB 0 B
res/layout/checkout_sheet_content.xml 2.0 KiB 2.0 KiB 0 B
res/values/values.xml 1.3 KiB 1.3 KiB 0 B
R.txt 1.2 KiB 1.2 KiB 0 B
AndroidManifest.xml 922 B 922 B 0 B
proguard.txt 798 B 798 B 0 B
res/drawable/close.xml 431 B 431 B 0 B
res/menu/checkout_menu.xml 354 B 354 B 0 B
META-INF/com/android/build/gradle/aar-metadata.properties 157 B 157 B 0 B

Measured from the PR base SHA and PR head SHA. The file breakdown shows uncompressed sizes within each package artifact, so individual files do not sum to the compressed artifact total. This comment reports package artifact sizes only; it is not a final app binary-size report.

@bitrise

bitrise Bot commented Aug 25, 2026

Copy link
Copy Markdown

Install this build

Open Tophat, select your target device, then click Install. Links open on the Mac running Tophat.

SDK Install
Kotlin Install with Tophat

Checkout Kit E2E results

Status Suite Target Platform OS version tag Device
kotlin-android kotlin android latest Google Pixel 11
Android 17.0

ProtocolClient().onDecodeError { method, error, params ->
log.e(LOG_TAG, "Failed to decode $method params", error)
log.d(LOG_TAG, "Raw $method params: $params")
CheckoutTelemetry.recorder.recordProtocolDecodeError(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The PR description mentions matching the cross-platform decode taxonomy, which made me wonder whether the counts match across platforms too, not just the labels. an AI review pass flagged this spot, and I traced it through the diffs to check.

Since this hook is built into every CheckoutProtocol.Client, the count seems to depend on how many clients process a message, rather than on the inbound message itself. Two cases I wanted to sanity-check:

  • if a merchant registers an ec.complete handler, AlwaysRunAfterMerchant means a malformed payload can be decoded by both the merchant client and the kit default client, so it looks like it records twice
  • if ec.error arrives with a valid envelope but malformed params and there's no merchant subscriber, it looks like no handler decodes it, and the terminal-error path decodes it separately without recording a params decode error, so it records zero

So the question is: is this metric meant to count failed decode attempts by clients (which is what it does today), or malformed messages from checkout (which is what the name suggests to me)? If it's the latter, should it record once per message in EmbeddedCheckoutProtocolBridge, where each message is first decoded?

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.

You read it right — the contract says undecodable messages, so per-client counting was wrong on both edges. The bridge now records once per message, and the terminal ec.error path records even with no subscribers; both have regression tests. iOS had the same ec.error gap (fixed in #675), web already counts per message.

@tiagocandido
tiagocandido force-pushed the telemetry/android-integration branch from 8a67b38 to af4ddda Compare August 27, 2026 12:44
@tiagocandido
tiagocandido force-pushed the telemetry/swift-integration branch from 0611c9e to 4478383 Compare August 27, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

#gsd:50662 Rebase Checkout Kit on UCP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants