Skip to content

Add load_timings to PaymentSheet load analytics via DurationProvider#13195

Draft
amk-stripe wants to merge 1 commit into
masterfrom
amk/loadtimings-android-durationprovider-paymentsheet
Draft

Add load_timings to PaymentSheet load analytics via DurationProvider#13195
amk-stripe wants to merge 1 commit into
masterfrom
amk/loadtimings-android-durationprovider-paymentsheet

Conversation

@amk-stripe
Copy link
Copy Markdown
Collaborator

  • Add completedDuration(key) API to DurationProvider interface
  • Update DefaultDurationProvider to store completed durations in a second map; start(reset=true) clears any previous completed value, end() stores the duration, and measureDuration always resets before measuring
  • Add two new DurationProvider.Key values: PaymentSheetLoadLogLoadStarted and PaymentSheetLoadComputePaymentMethodTypes
  • In DefaultPaymentElementLoader, wrap eventReporter.onLoadStarted with PaymentSheetLoadLogLoadStarted and createPaymentMethodMetadata + supportsIntent check with PaymentSheetLoadComputePaymentMethodTypes
  • In DefaultEventReporter, add buildLoadTimings() helper that reads completed durations for the six PaymentSheet load keys and maps them to analytics field names as integer milliseconds
  • Add load_timings to PaymentSheetEvent.LoadSucceeded and LoadFailed params when any timings are present
  • Update all FakeDurationProvider implementations to implement the new completedDuration method
  • Add DefaultDurationProviderTest covering the completed duration behavior
  • Extend DefaultEventReporterTest to verify load_timings appear in both mc_load_succeeded and mc_load_failed with correct mapped keys and ms values
  • Extend DefaultPaymentElementLoaderTest to verify timing keys after successful load, failed load, and path-specific cases

Committed-By-Agent: goose

Summary

Motivation

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Before After
before screenshot after screenshot

Changelog

- Add completedDuration(key) API to DurationProvider interface
- Update DefaultDurationProvider to store completed durations in a second
  map; start(reset=true) clears any previous completed value, end() stores
  the duration, and measureDuration always resets before measuring
- Add two new DurationProvider.Key values:
  PaymentSheetLoadLogLoadStarted and PaymentSheetLoadComputePaymentMethodTypes
- In DefaultPaymentElementLoader, wrap eventReporter.onLoadStarted with
  PaymentSheetLoadLogLoadStarted and createPaymentMethodMetadata +
  supportsIntent check with PaymentSheetLoadComputePaymentMethodTypes
- In DefaultEventReporter, add buildLoadTimings() helper that reads
  completed durations for the six PaymentSheet load keys and maps them to
  analytics field names as integer milliseconds
- Add load_timings to PaymentSheetEvent.LoadSucceeded and LoadFailed
  params when any timings are present
- Update all FakeDurationProvider implementations to implement the new
  completedDuration method
- Add DefaultDurationProviderTest covering the completed duration behavior
- Extend DefaultEventReporterTest to verify load_timings appear in both
  mc_load_succeeded and mc_load_failed with correct mapped keys and ms values
- Extend DefaultPaymentElementLoaderTest to verify timing keys after
  successful load, failed load, and path-specific cases

Committed-By-Agent: goose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant