open-telemetry / opentelemetry-dotnet

The OpenTelemetry .NET Client
https://opentelemetry.io
Apache License 2.0
3.18k stars 753 forks source link

[console, in-memory] Tweak nullable annotations in registration extensions #5833

Closed CodeBlanch closed 1 week ago

CodeBlanch commented 2 weeks ago

Changes

Details

OTLP, Zipkin, & Prometheus exporters all expose shapes which are (essentially):

public static ProviderBuilder AddExporter(this ProviderBuilder builder) {};
public static ProviderBuilder AddExporter(this ProviderBuilder builder, Action<ExporterOptions> configure) {}
public static ProviderBuilder AddExporter(this ProviderBuilder builder, string? name, Action<ExporterOptions>? configure) {}

The second one sometimes has Action<ExporterOptions>? configure this PR is dropping that ? in the signature. null is still allowed, it just isn't encouraged/promoted. For more thoughts/details see: https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2067#discussion_r1758241013

Merge requirement checklist

codecov[bot] commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 86.21%. Comparing base (6250307) to head (5fd4faa). Report is 315 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5833/graphs/tree.svg?width=650&height=150&src=pr&token=vscyfvPfy5&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry)](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5833?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) ```diff @@ Coverage Diff @@ ## main #5833 +/- ## ========================================== + Coverage 83.38% 86.21% +2.83% ========================================== Files 297 257 -40 Lines 12531 11166 -1365 ========================================== - Hits 10449 9627 -822 + Misses 2082 1539 -543 ``` | [Flag](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5833/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5833/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `?` | | | [unittests-Project-Experimental](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5833/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `86.21% <ø> (?)` | | | [unittests-Project-Stable](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5833/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `86.16% <ø> (?)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files with missing lines](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5833?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | Coverage Δ | | |---|---|---| | [...xporter.Console/ConsoleExporterHelperExtensions.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5833?src=pr&el=tree&filepath=src%2FOpenTelemetry.Exporter.Console%2FConsoleExporterHelperExtensions.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkuRXhwb3J0ZXIuQ29uc29sZS9Db25zb2xlRXhwb3J0ZXJIZWxwZXJFeHRlbnNpb25zLmNz) | `0.00% <ø> (ø)` | | | [...porter.Console/ConsoleExporterLoggingExtensions.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5833?src=pr&el=tree&filepath=src%2FOpenTelemetry.Exporter.Console%2FConsoleExporterLoggingExtensions.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkuRXhwb3J0ZXIuQ29uc29sZS9Db25zb2xlRXhwb3J0ZXJMb2dnaW5nRXh0ZW5zaW9ucy5jcw==) | `0.00% <ø> (ø)` | | | [...porter.Console/ConsoleExporterMetricsExtensions.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5833?src=pr&el=tree&filepath=src%2FOpenTelemetry.Exporter.Console%2FConsoleExporterMetricsExtensions.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkuRXhwb3J0ZXIuQ29uc29sZS9Db25zb2xlRXhwb3J0ZXJNZXRyaWNzRXh0ZW5zaW9ucy5jcw==) | `0.00% <ø> (ø)` | | | [...rter.InMemory/InMemoryExporterMetricsExtensions.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5833?src=pr&el=tree&filepath=src%2FOpenTelemetry.Exporter.InMemory%2FInMemoryExporterMetricsExtensions.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkuRXhwb3J0ZXIuSW5NZW1vcnkvSW5NZW1vcnlFeHBvcnRlck1ldHJpY3NFeHRlbnNpb25zLmNz) | `97.72% <ø> (ø)` | | ... and [220 files with indirect coverage changes](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5833/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry)