Skip to content

[OpenTelemetry] Logs - Return None for unset or out-of-range LogLevel mapping#7092

Merged
martincostello merged 4 commits intoopen-telemetry:mainfrom
ysolomchenko:LogRecord.LogLevel-returns-invalid-values-for-None/unspecified
Apr 15, 2026
Merged

[OpenTelemetry] Logs - Return None for unset or out-of-range LogLevel mapping#7092
martincostello merged 4 commits intoopen-telemetry:mainfrom
ysolomchenko:LogRecord.LogLevel-returns-invalid-values-for-None/unspecified

Conversation

@ysolomchenko
Copy link
Copy Markdown
Contributor

Fixes # N/A
Design discussion issue # N/A

Found by Codex/security scans.

Changes

Fixed LogRecord.LogLevel to preserve LogLevel.None and handle unspecified or out-of-range severities without returning invalid enum values.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@github-actions github-actions bot added the pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package label Apr 15, 2026
@ysolomchenko ysolomchenko marked this pull request as ready for review April 15, 2026 09:47
@ysolomchenko ysolomchenko requested a review from a team as a code owner April 15, 2026 09:47
Comment thread src/OpenTelemetry/Logs/LogRecord.cs Outdated
Comment thread src/OpenTelemetry/Logs/LogRecord.cs
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.73%. Comparing base (7f78716) to head (b6dc613).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7092      +/-   ##
==========================================
+ Coverage   88.69%   88.73%   +0.03%     
==========================================
  Files         270      270              
  Lines       12919    12920       +1     
==========================================
+ Hits        11458    11464       +6     
+ Misses       1461     1456       -5     
Flag Coverage Δ
unittests-Project-Experimental 88.37% <100.00%> (-0.31%) ⬇️
unittests-Project-Stable 88.72% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/OpenTelemetry/Logs/LogRecord.cs 70.86% <100.00%> (+0.19%) ⬆️

... and 4 files with indirect coverage changes

@martincostello martincostello added this pull request to the merge queue Apr 15, 2026
Merged via the queue into open-telemetry:main with commit 8934056 Apr 15, 2026
63 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

Thank you for your contribution @ysolomchenko! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants