Serilog sink: add `MinimumLogLevel` to filter logs separately from events and breadcrumbs
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
- 48/100
Hướng nghiên cứu
Read SentrySink.InnerEmit alongside NLog's SentryTarget.InnerWrite (#5913) to see where the log-level check belongs, then look at SentrySerilogOptions and the WriteTo.Sentry(...) overload that already exposes minimumEventLevel and minimumBreadcrumbLevel. The open questions — how to express "off" with LogEventLevel and which default keeps 7.0 behaviour — should be settled on the thread before writing code, since they shape the option's type and the Serilog.Settings.Configuration binding. Done means the sink options, the WriteTo.Sentry argument and the sink's filtering are in place, with tests covering each level combination from the table in the issue.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem Statement
Since 7.0.0, the Serilog sink sends every entry it receives to Sentry as a log. Serilog's restrictedToMinimumLevel and levelSwitch decide which entries reach the sink, so raising them also cuts events and breadcrumbs. The sink has MinimumEventLevel and MinimumBreadcrumbLevel, but no level for logs.
Measured against 7.0.1, writing one info, one warning and one error:
| Sink setup | Logs | Breadcrumbs | Events |
|---|---|---|---|
| default | 3 | 3 | 1 |
restrictedToMinimumLevel: Error |
1 | 1 | 1 |
restrictedToMinimumLevel: Fatal |
0 | 0 | 0 |
An app that uses the sink for errors and breadcrumbs, and doesn't want Sentry Logs, can only use SetBeforeSendLog. To leave SentrySdk.Logger alone, the callback has to match on the sink's origin:
options.SetBeforeSendLog(log =>
log.TryGetAttribute("sentry.origin", out var origin) && origin is "auto.log.serilog" ? null : log);
That builds each log before dropping it, counts it as discarded in client reports, and can't be set from Serilog.Settings.Configuration.
The other logging integrations already have a switch for logs alone:
- NLog:
MinimumLogLevel, which can beOff(#5913). That PR noted that Serilog has no threshold for logs. Logging.AddSentry(): theSentryprovider alias,Logging:Sentry:LogLevel:Default = None(#5988, getsentry/sentry-docs#20947).
Solution Brainstorm
Add MinimumLogLevel to SentrySerilogOptions, and a minimumLogLevel argument to WriteTo.Sentry(...) next to minimumEventLevel and minimumBreadcrumbLevel, so it binds from appsettings.json. SentrySink.InnerEmit checks it before CaptureStructuredLog, as SentryTarget.InnerWrite does for NLog, so a filtered entry never becomes a log.
Open points:
- How to say "off".
LogEventLevelhas noOffmember.LevelAlias.Offexists from Serilog 3.0, butSentry.Serilogreferences Serilog 2.7.1 and 2.10.0, and it's a constant rather than an enum member, so configuration binding can't parse"Off". Options: a nullable level wherenullmeans no logs,Fatal + 1, or a separate switch. - Default. To ship in a 7.x minor, the default has to keep 7.0's behaviour and send every level that reaches the sink. NLog defaults to
Info, but changing Serilog's default to match would be a behaviour change.
This was raised while sanity-checking getsentry/sentry-docs#20947, which documents the Logging.AddSentry() switch.
- 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
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của getsentry/sentry-dotnet
-
chore: remove stale IL3050/IL3053 workaround from the iOS sampleCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởState: Needs Discussion
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
getsentry/sentry-dotnet#6071 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Heap dumps: every SDK shutdown logs "Error waiting for GarbageCollectionMonitor task to complete"Có thể đã có người làm @pcbeingused33 đã nhận hôm nay. Đang mởState: Needs Discussion
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
getsentry/sentry-dotnet#6039 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
.NET Platform: Android Task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
getsentry/sentry-dotnet#6020 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Move the Blazor WebAssembly sample off the deprecated DevServerCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở.NET Framework: Blazor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
getsentry/sentry-dotnet#5906 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Docs MSBuild Needs Docs Update
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
getsentry/sentry-dotnet#5691 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của getsentry/sentry-dotnet
Issue tương tự
-
In-car displays show 0 km/h and P while the AV drivesCó thể đã có người làm @bazilinskyy đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
bazilinskyy/coupled-sim#366 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
BaryoDev/umbraco-pwa#196 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
microsoft/fluentui-blazor#5688 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug flaky lsp-transport small
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày