Support status code ranges when configuring TraceIgnoreStatusCodes from appsettings.json

Đang mở
#5,644 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
observability-sre

Hướng nghiên cứu

Start by locating BindableSentryOptions.TraceIgnoreStatusCodes and its ApplyTo method, then inspect how configuration binding and status-code defaults are tested. Support numeric strings and inclusive ranges while preserving existing numeric configurations; verify that configured ranges and individual codes produce the expected ignored statuses, and clarify whether FailedRequestStatusCodes is included.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

.NET Improvement State: Needs Discussion Traces

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 https://github.com/getsentry/sentry-dotnet/pull/5632#issuecomment-5892916655

Ngôn ngữ chính
C#
Star
775
Fork
262
Merge trung bình
1 ngày 16 giờ
Pull request đã merge (30 ngày)
118

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của getsentry/sentry-dotnet

Tất cả issue của getsentry/sentry-dotnet

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.