Skip to content

Public ISpan.startChild with start timestamp #5896

Description

@sentry-junior

ITransaction already exposes a public timestamped startChild overload, but ISpan does not. Nested child spans (including Android extended app start via Sentry.getExtendedAppStartSpan()) therefore have no stable public way to set an explicit start time.

Current behavior

  • Public on ISpan: startChild(operation) and startChild(operation, description) only
  • Public on ITransaction: startChild(operation, description, timestamp)
  • Overloads that set child start time on ISpan (SpanOptions, SentryDate + Instrumenter, etc.) are @ApiStatus.Internal
  • Public end-time control already exists on ISpan: finish(status, timestamp)
  • Sentry.getExtendedAppStartSpan() returns an ISpan, not the parent transaction

Gap

When custom timers are recorded off the originating thread (or otherwise deferred), span start is stamped at startChild() call time unless an explicit start timestamp is provided. That skews durations.

The public timestamped API exists one level up on ITransaction, but callers parenting under a nested span—including the extended app-start span—cannot use it without reaching for internal ISpan APIs. End timestamps can already be set publicly; start timestamps cannot.

Related history: #2507 (internal span options path), #3722 (SpanOptions made public), #3639 (start timestamp on create via options).

Proposed API (optional)

Mirror the existing public ITransaction overload on ISpan:

ISpan startChild(
    @NotNull String operation,
    @Nullable String description,
    @Nullable SentryDate timestamp);

This is intentionally narrow: timestamp only. Not asking to promote Instrumenter overloads or idle/trim/scope-binding knobs, or to change getExtendedAppStartSpan()'s return type.

Requested by Sergio Lombana.

--

View Junior Session [Sentry]

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions