-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
Currently TelemetryDeck
provides startDurationSignal
and stopAndSendDurationSignal
. This works for normal flows.
In some apps, users can allow users to control whether telemetry is used or not. So while a duration signal is active. Example:
- User starts onboarding, setting
startDurationSignal("onboarding")
. - User disables telemetry in settings.
- User finishes onboarding, triggering
stopAndSendDurationSignal("onboarding")
.
At this point, the the setting for using telemetry prevents the stop from sending, because telemetry is disabled.
But since the SDK doesn’t expose a "stop without send", the underlying DurationSignalTracker
still holds an open timer. This leaves the SDK with dangling signals and no way to clean them up.
What would be good is a method such as:
@MainActor
public static func stopDurationSignal(_ signalName: String)
// or
@MainActor
public static func cancelDurationSignal(_ signalName: String)
This would:
- Call
DurationSignalTracker.shared.stopTracking(signalName)
- Drop the duration data silently (no
internalSignal
call).
Benefit
- Keeps SDK state consistent when signals should not be sent.
- Matches use cases where telemetry can be turned off mid-session.
- No risk of sending data against user intent.
Possible implementation
@MainActor
public static func stopDurationSignal(_ signalName: String) {
_ = DurationSignalTracker.shared.stopTracking(signalName)
}
This uses the same internal stopTracking
already available in DurationSignalTracker
.
Metadata
Metadata
Assignees
Labels
No labels