Skip to content

Collapse Envelope.FromTransaction overloads into a single method with optional parameters #5397

Description

@jamescrosswell

Background

Follow-up from #5182 (review).

Envelope.FromTransaction is currently split into two overloads:

public static Envelope FromTransaction(SentryTransaction transaction) =>
    FromTransaction(transaction, null, null);

public static Envelope FromTransaction(
    SentryTransaction transaction,
    IDiagnosticLogger? logger,
    IReadOnlyCollection<SentryAttachment>? attachments)

The sibling factory methods FromEvent and FromFeedback instead expose a single method with optional parameters defaulting to null:

public static Envelope FromFeedback(
    SentryEvent @event,
    IDiagnosticLogger? logger = null,
    IReadOnlyCollection<SentryAttachment>? attachments = null,
    SessionUpdate? sessionUpdate = null)

As @bitsandfoxes noted, collapsing FromTransaction into a single method with optional parameters would bring it in line with the rest.

Proposal

Replace the two FromTransaction overloads with a single method:

public static Envelope FromTransaction(
    SentryTransaction transaction,
    IDiagnosticLogger? logger = null,
    IReadOnlyCollection<SentryAttachment>? attachments = null)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Breaking ChangeBinary/Source/Behavioral Breaking Changes.Next MajorChanges scheduled for the next Major release.public APIAdditions/modifications to, or removals from, the public API surface area.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions