getsentry / getsentry/sentry-dotnet
Swap attachments/logger parameter order in Envelope.From* factory methods
- Dominant language
- C#
- Stars
- 770
- Forks
- 248
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 51
Description
### Background
Follow-up from [#5182 (review)](https://github.com/getsentry/sentry-dotnet/pull/5182#discussion_r3567442222).
In [`Envelope.cs`](src/Sentry/Protocol/Envelopes/Envelope.cs), the `From*` factory methods take `IDiagnosticLogger?` before the attachments collection, e.g.:
```csharp
public static Envelope FromTransaction(
SentryTransaction transaction,
IDiagnosticLogger? logger,
IReadOnlyCollection? attachments)
```
As [@Flash0ver noted](https://github.com/getsentry/sentry-dotnet/pull/5182#discussion_r3555773841), the `IDiagnosticLogger` is the "least functional" parameter while `attachments` has a bigger impact on behavior, so it would read better with `attachments` first and `logger` last. The existing `FromEvent` and `FromFeedback` methods currently keep `IDiagnosticLogger` as the second parameter, so today the API is at least internally consistent.
### Proposal
For the next major, swap the parameter order so `attachments` precedes `logger`, and apply it **consistently across all three factory methods** (`FromTransaction`, `FromEvent`, `FromFeedback`) to keep the public API surface uniform.
### Why defer
Reordering parameters on these `public static` methods is a binary- and source-breaking change, so it should land in the next major (7.0.0) rather than a minor release.
### Acceptance criteria
- [ ] `FromTransaction`, `FromEvent`, and `FromFeedback` take `attachments` before `logger`
- [ ] Parameter ordering is consistent across all three methods
- [ ] Internal callers updated accordingly
Contributor guide
Research direction
Start in src/Sentry/Protocol/Envelopes/Envelope.cs and inspect the FromTransaction, FromEvent, and FromFeedback factory methods. Search for their internal callers and update each call to pass attachments before logger. Done means all three public methods and their internal callers use the same parameter order.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend-api-design
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100