Skip to content

Feature request: Ability to stop or cancel duration signals without sending #247

@markbattistella

Description

@markbattistella

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:

  1. User starts onboarding, setting startDurationSignal("onboarding").
  2. User disables telemetry in settings.
  3. 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions