feat: add productAnalytics option, track API, taps#205
Open
abelonogov-ld wants to merge 3 commits into
Open
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2aa75b7. Configure here.
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.

Summary
Introduces a
productAnalyticsconfiguration block to the Swift Observability SDK, consolidating product-analytics telemetry (taps, track events) to mirror the TypeScript/web SDK, and adds a publicLDObserve.track(...)API.Key points:
ObservabilityOptions.ProductAnalytics(taps, trackEvents)option, with.enabled/.disabledpresets.userTapsis removed fromInstrumentationand moved toproductAnalytics.taps.user.tap->clickand is gated byproductAnalytics.taps(Session Replay capture is unaffected).launchdarkly.trackspans, both automatically (via the LDafterTrackhook) and manually (via the newLDObserve.track(...)API). Both paths funnel through a single emitter inObservabilityService.Changes
Configuration (
ObservabilityOptions)ProductAnalyticsstruct:taps(default.disabled): emit aclickspan for each tap.trackEvents(default.enabled): emit alaunchdarkly.trackspan when a custom event is tracked..enabled/.disabledpresets.userTapsfromInstrumentation; added aproductAnalyticsproperty and init parameter.Public API (
Observe/LDObserve)func track(name:value:attributes:)to theObserveprotocol, plus default-argument convenience overloads (track(name:),track(name:value:),track(name:attributes:)).track(...)inLDObserve,ObservabilityService, andNoOpObservabilityService.launchdarkly.trackspan-name constant toSemanticConvention.Tap spans
user.taptoclickinUInteraction+Span.swift.productAnalytics.taps(capture still flows to Session Replay unconditionally).Track events / hook wiring
ObservabilityHook.afterTrack(seriesContext:)extracts the event data and context keys and forwards them throughObservabilityHookExporterinto a singleObservabilityService.track(...)emitter.afterIdentifycaches the latest context keys inObservabilityServiceso manualLDObserve.track(...)calls can attribute events; the hook path's fresh keys take precedence over the cache.key/value) so the event name and metric value can never be clobbered by a user field named"key"or"value".trackemits viaAppTraceClient, so it respects `tracesApi.includNote
Medium Risk
Removes
Instrumentation.userTaps(breaking config migration) and adds new automatic track/tap span emission tied to tracing and SDK hooks; behavior is gated but affects default telemetry shape.Overview
Adds
productAnalyticsonObservabilityOptions(taps,trackEvents) and moves tap telemetry out ofInstrumentationby removinguserTaps. Tap spans are renameduser.tap→clickand only emitted whenproductAnalytics.tapsis enabled; Session Replay tap capture is unchanged.Custom events are exported as
launchdarkly.trackspans via a newLDObserve.track(...)API and the LaunchDarklyafterTrackhook, both routed through one emitter inObservabilityService(gated bytrackEvents, with identify context keys cached for manual tracks). Docs, sample apps, and TestApp demos are updated; TestApp also wires a localios-client-sdkpackage for hook support.Reviewed by Cursor Bugbot for commit 8abb432. Bugbot is set up for automated code reviews on this repo. Configure here.