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

[otlp] Workaround DI containers which create unregistered services #5808

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

CodeBlanch
Copy link
Member

@CodeBlanch CodeBlanch commented Aug 28, 2024

Fixes #5537
Fixes #5803

Changes

  • Prevent UseOtlpExporterRegistration from being instantiated without a registration when using Unity or Grace DI containers

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Appropriate CHANGELOG.md files updated for non-trivial changes

@CodeBlanch CodeBlanch requested a review from a team August 28, 2024 17:59
@github-actions github-actions bot added the pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package label Aug 28, 2024
Copy link

codecov bot commented Aug 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.23%. Comparing base (6250307) to head (8c3a151).
Report is 300 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5808      +/-   ##
==========================================
+ Coverage   83.38%   86.23%   +2.84%     
==========================================
  Files         297      257      -40     
  Lines       12531    11150    -1381     
==========================================
- Hits        10449     9615     -834     
+ Misses       2082     1535     -547     
Flag Coverage Δ
unittests ?
unittests-Project-Experimental 86.21% <100.00%> (?)
unittests-Project-Stable 86.14% <100.00%> (?)

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

Files with missing lines Coverage Δ
...enTelemetryProtocol/Builder/OtlpExporterBuilder.cs 100.00% <100.00%> (ø)
...tryProtocol/Builder/UseOtlpExporterRegistration.cs 100.00% <100.00%> (ø)

... and 212 files with indirect coverage changes

Copy link
Contributor

@Kielek Kielek left a comment

Choose a reason for hiding this comment

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

LGTM.
Do you think that it is worth to add some additional DI to our coverage?

@CodeBlanch CodeBlanch merged commit f3a22c3 into open-telemetry:main Aug 29, 2024
31 checks passed
@CodeBlanch CodeBlanch deleted the otlp-container-bug branch August 29, 2024 17:28
@reyang
Copy link
Member

reyang commented Aug 29, 2024

Do you think that it is worth to add some additional DI to our coverage?

+1, if this is a scenario we would support, a test case is needed.

@CodeBlanch
Copy link
Member Author

Do you think that it is worth to add some additional DI to our coverage?

I commented about that a bit on here and we discussed somewhat on the SIG this week. Short answer is I feel like we should do something but I don't know what that something is 🤣 I don't feel a test in OtlpExporter project would be super useful. Because any dev at any time in this repo or contrib who introduces a serviceProvider.GetService(...) or serviceProvider.GetServices(...) call may run into this again. We would need coverage over everything using all known containers which exist or may exist in the future. Yuck!

I just spun up this issue in runtime to see if there might be a better way to do it or if some other safe way could be added: dotnet/runtime#107153

@secovel
Copy link

secovel commented Sep 6, 2024

What version can I expect to see this fix in? We need to get off 1.7.0 due to some vulnerability reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package
Projects
None yet
4 participants