feat: report mParticle API usage through the Rokt kit - #759
Conversation
Rokt diagnostics can identify native SDK API usage, but calls made through mParticle are not distinguishable. This instruments public mParticle core, identity, user, session, messaging, media, and Rokt-facade APIs to forward a bounded, non-sensitive API identifier into the Rokt SDK — only when the Rokt kit is active. Android port of mParticle/mparticle-apple-sdk#813. - Forward diagnostics through the active Rokt kit via a decoupled RoktApiDiagnosticsForwarder interface (core stays free of kit types) using a fixed uppercase code vocabulary. Requires Rokt SDK 6.0.3 and calls its public Rokt.logMParticleApiCall API. - Match the iOS reported-API set: drop identifiers iOS deliberately excludes (single setUserAttribute) and Android-only internal machinery (identity getters/state listeners); rename SET_UPDATE_INTERVAL -> SET_UPLOAD_INTERVAL; add RESET, SET_LOG_LEVEL, GET_INTEGRATION_ATTRIBUTES, GET_ATTRIBUTION_INFO, IS_KIT_ACTIVE, GET_KIT_INSTANCE. - Keep Android-specific public APIs that are neither internal nor noisy (install referrer, non-auto push toggles, media audio state). - Never over-log: suppress diagnostics while SDK/kit internals invoke public APIs (auto-upload, logLtvIncrease -> logEvent, push-token modify, and the Rokt kit's attribute enrichment / event + identity forwarding) via MParticle.withoutRoktApiUsage. - Exclude all API arguments and values from diagnostics; code identifiers only. - Add core tests for active-kit gating and internal-call suppression. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PR SummaryMedium Risk Overview Core introduces Rokt SDK is bumped 6.0.1 → 6.0.3 in Reviewed by Cursor Bugbot for commit bfb6cd7. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 8a4d883. Configure here.
| * Force upload all queued messages to the mParticle server. | ||
| */ | ||
| public void upload() { | ||
| MParticle.logRoktApiUsage("UPLOAD"); |
There was a problem hiding this comment.
Internal uploads misreported as partner
Medium Severity
upload now always emits UPLOAD, but SDK-internal callers still invoke it directly without withoutRoktApiUsage. Session-end endUploadLoop, alias-driven uploads, and the nested upload inside setUpdateInterval are therefore reported as partner API usage whenever the Rokt kit is active, contradicting the intended never-over-log behavior.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 8a4d883. Configure here.
|
Superseded by #761 so the head branch lives directly in mParticle/mparticle-android-sdk rather than a fork. The replacement uses the same reviewed commits and preserves the SDK Team review request. |


Background
Rokt diagnostics can identify native SDK API usage, but calls made through mParticle are not currently distinguishable. This adds bounded, non-sensitive API identifiers only when the Rokt kit is active. Android port of mParticle/mparticle-apple-sdk#813; requires Rokt SDK
6.0.3, which exposes the publicRokt.logMParticleApiCallentry point.What Has Changed
RoktApiDiagnosticsForwarderinterface soandroid-corestays free of kit types.setUserAttribute) and Android-only internal machinery that would misreport SDK plumbing as partner calls (identity getters, identity-state listeners); renamedSET_UPDATE_INTERVAL→SET_UPLOAD_INTERVAL; addedRESET,SET_LOG_LEVEL,GET_INTEGRATION_ATTRIBUTES,GET_ATTRIBUTION_INFO,IS_KIT_ACTIVE,GET_KIT_INSTANCE.enablePushNotifications).kits/rokt/rokt/.../Rokt.kt) reports a distinct[MP_API_*]set (SELECT_PLACEMENTS,SELECT_SHOPPABLE_ADS,PURCHASE_FINALIZED,ROKT_EVENTS,ROKT_CLOSE,ROKT_SET_SESSION_ID,ROKT_GET_SESSION_ID,REGISTER_PAYMENT_EXTENSION) — additive by design with the native SDK's own[API_*]diagnostics, so drop-offs between the facade call and the native call are observable.logLtvIncrease→logEvent, push-tokenmodify, and the Rokt kit's attribute enrichment / event + identity forwarding — viaMParticle.withoutRoktApiUsage.logMParticleApiCall). API arguments and values are never included — code identifiers only.Testing
:android-core:testDebugUnitTestforMParticleTestandKitFrameworkWrapperTestpass locally, including new tests for active-kit gating and internal-call suppression.429rate-limiting oncom.rokt:roktsdk:6.0.3); it will be validated in CI.Checklist
🤖 Generated with Claude Code