Skip to content

Conversation

Flash0ver
Copy link
Member

@Flash0ver Flash0ver commented Aug 21, 2025

Changes

Add Serilog integration to Sentry Structured Logging.

Docs

Dogfooding

  • getsentry/symbol-collector -> SymbolCollector.Server

@Flash0ver Flash0ver self-assigned this Aug 21, 2025
@Flash0ver Flash0ver added Serilog .NET Pull requests that update .net code Logs labels Aug 21, 2025
Copy link
Contributor

github-actions bot commented Aug 21, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against cdf0318

@Flash0ver
Copy link
Member Author

@sentry review

@Flash0ver Flash0ver marked this pull request as ready for review August 22, 2025 00:08

private void CaptureStructuredLog(IHub hub, LogEvent logEvent, string formatted, string? template)
{
var traceHeader = hub.GetTraceHeader() ?? SentryTraceHeader.Empty;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the ParentSpanId required in the protocol for StructuredLogging? An empty SpanId probably isn't that useful otherwise eh?

Copy link
Member Author

@Flash0ver Flash0ver Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No ... it's an optional "Default Attribute" ... the trace_id is required.

Oops ... I made this mistake in the Sentry-SDK and Microsoft.Extensions.Logging integrations, too.

I'll create a follow-up PR to fix this issue in all integrations.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

follow-up for both the SDK-Logger and the Microsoft.Extensions.Logging integration: #4565

@jacobsamo
Copy link

Looking forward to when this gets out, would really benefit my team

cursor[bot]

This comment was marked as outdated.

Copy link

codecov bot commented Sep 10, 2025

Codecov Report

❌ Patch coverage is 82.17822% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.45%. Comparing base (6ea6bf4) to head (cdf0318).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/Sentry.Serilog/SentrySink.cs 70.00% 5 Missing and 4 partials ⚠️
src/Sentry.Serilog/SentrySink.Structured.cs 87.50% 4 Missing and 3 partials ⚠️
src/Sentry.Serilog/LogLevelExtensions.cs 80.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4462      +/-   ##
==========================================
+ Coverage   73.34%   73.45%   +0.10%     
==========================================
  Files         479      480       +1     
  Lines       17509    17589      +80     
  Branches     3445     3469      +24     
==========================================
+ Hits        12842    12920      +78     
+ Misses       3788     3785       -3     
- Partials      879      884       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jamescrosswell jamescrosswell self-requested a review September 17, 2025 08:01
Copy link
Collaborator

@jamescrosswell jamescrosswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a couple of comments, nothing blocking though. LGTM!

@Flash0ver Flash0ver merged commit bc5c060 into main Sep 25, 2025
33 checks passed
@Flash0ver Flash0ver deleted the feat/logs-serilog branch September 25, 2025 09:37
@Mike-E-angelo
Copy link

Woohoo, thank you again for your amazing efforts out there, @Flash0ver, @jamescrosswell, and team! This will really help out a lot with my projects. 🙏🙏🙏

@Syed-RI
Copy link

Syed-RI commented Sep 25, 2025

release the kraken, I mean nuget package, please? Also idiot proof (I'm the idiot) docs please ❤️

@Flash0ver
Copy link
Member Author

We got 4 Structured-Logs-related fixes in the pipeline, small yet impactful changes, that I'd like to ship in one release. With 3 developers working on these, I'm confident with releasing early next week. Also, docs are ready to be published too (getsentry/sentry-docs#14693).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Logs .NET Pull requests that update .net code Serilog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants