Skip to content

Support status code ranges when configuring TraceIgnoreStatusCodes from appsettings.json #5644

Open

Description

@jamescrosswell

TraceIgnoreStatusCodes can be set from configuration, but only as a list of individual status codes: BindableSentryOptions.TraceIgnoreStatusCodes is a List<int>. Configuration can't express a range, and "TraceIgnoreStatusCodes": [ "305-399" ] throws an InvalidOperationException at startup.

This matters more in 7.0, where the default becomes [301, (305, 399), (401, 404)] (#5632). Configuration replaces the default rather than adding to it, so keeping the default and ignoring one more code from appsettings.json means listing around 100 integers.

Proposal

Change the bindable property to a List<string> and parse each entry in ApplyTo as either a single code ("404") or an inclusive range ("305-399"). JSON numbers bind to string without problems, so existing configs like [ 404, 429 ] keep working.

"Sentry": {
  "TraceIgnoreStatusCodes": [ 301, "305-399", "401-404", 429 ]
}

FailedRequestStatusCodes has no bindable equivalent at all today, so it could get the same treatment.

Raised by @ric-oliv in #5632 (comment)

Activity

  1. linear-code commented on Sep 29, 2026

    @linear-code
  2. added
    .NET
    on Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETImprovementState: Needs DiscussionTraces

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions