Skip to content

Clean up SentrySpanArguments interface and related dead code in SentrySpan #21405

@Lms24

Description

@Lms24

Description

Currently, SentrySpanArguments includes an endTimestamp property that is passed to the SentrySpan constructor. If an endTimestamp is set, the span ends itself immediately, debug-logs itself to the console and emits the spanEnd client hook event. The funny thing is that by our public API, this is dead code. StartSpanOptions don't define endTimestamp at all.

Unfortunately though, when we convert StartSpanOptions to SentrySpanArguments in parseSentrySpanArguments, we spread the options into the new arguments object. Meaning users can simply ignore TS and still get the span to end immediately by adding the endTimestamp property.

Removing endTimestamp is technically a breaking change because SentrySpanArguments are exported from @sentry/core. Just removing the dead code in the SentrySpan constructor alone also feels wrong. So I suggest we do this as a cleanup task in one go in v11.

to external contributors: please do not pick up this issue!

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions