Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add back Guard.ThrowIfNull batch options #4608

Merged
merged 2 commits into from
Jun 22, 2023

Conversation

alanwest
Copy link
Member

@vishweshbankwar oops, sorry, I glossed over this reviewing your update regarding #4575 (comment)

Since you made the property not nullable, I think we want to keep the Guard.ThrowIfNull so that it's certain not to be null.

@alanwest alanwest requested a review from a team June 21, 2023 23:14
@codecov
Copy link

codecov bot commented Jun 21, 2023

Codecov Report

Merging #4608 (ba78dfb) into main (be51a68) will decrease coverage by 0.03%.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4608      +/-   ##
==========================================
- Coverage   84.92%   84.90%   -0.03%     
==========================================
  Files         313      313              
  Lines       12601    12604       +3     
==========================================
  Hits        10701    10701              
- Misses       1900     1903       +3     
Impacted Files Coverage Δ
...nTelemetry/Logs/LogRecordExportProcessorOptions.cs 0.00% <0.00%> (ø)

... and 3 files with indirect coverage changes

@utpilla utpilla merged commit bd0d8d6 into open-telemetry:main Jun 22, 2023
@alanwest alanwest deleted the alanwest/null branch June 22, 2023 16:53
@@ -38,7 +41,7 @@ public LogRecordExportProcessorOptions()
{
Debug.Assert(defaultBatchExportLogRecordProcessorOptions != null, "defaultBatchExportLogRecordProcessorOptions was null");

this.BatchExportProcessorOptions = defaultBatchExportLogRecordProcessorOptions ?? new();
this.batchExportProcessorOptions = defaultBatchExportLogRecordProcessorOptions ?? new();
Copy link
Member

Choose a reason for hiding this comment

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

Why is the ?? new() here? My guess would be to suppress a warning for old targets. Just FYI the ! operatior is fine for that: this.batchExportProcessorOptions = defaultBatchExportLogRecordProcessorOption!

On newer targets Debug.Assert is smarter (decorated) to make the analysis happy.

New targets:
public static void Assert([DoesNotReturnIf(false)] bool condition, string? message);
Old targets:
public static void Assert(bool condition, string message);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants