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

Reduce InternalsVisibleTo #3726

Merged
merged 2 commits into from
Oct 4, 2022
Merged

Conversation

reyang
Copy link
Member

@reyang reyang commented Oct 4, 2022

Trying to reduce the scope of InternalsVisibleTo, ideally the SDK should not leave any backdoor for exporters.

@reyang reyang requested a review from a team October 4, 2022 21:36
[assembly: InternalsVisibleTo("OpenTelemetry.Exporter.Prometheus.AspNetCore" + AssemblyInfo.PublicKey)]
[assembly: InternalsVisibleTo("OpenTelemetry.Exporter.Prometheus.AspNetCore.Tests" + AssemblyInfo.PublicKey)]
[assembly: InternalsVisibleTo("OpenTelemetry.Exporter.Prometheus.HttpListener" + AssemblyInfo.PublicKey)]
[assembly: InternalsVisibleTo("OpenTelemetry.Exporter.Prometheus.HttpListener.Tests" + AssemblyInfo.PublicKey)]
Copy link
Member

Choose a reason for hiding this comment

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

Can we remove tests too or no?

Copy link
Member Author

Choose a reason for hiding this comment

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

Tried and they have dependency on MeterProvider.TryFindExporter.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the test code which makes use of the internals

This is where the internal method is defined

internal static bool TryFindExporter<T>(this MeterProvider provider, out T exporter)

Copy link
Contributor

Choose a reason for hiding this comment

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

Could probably have a reflection-based alternative for tests.

Looks like PrometheusExporterMiddleware also uses this.

Copy link
Member

@CodeBlanch CodeBlanch left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Oct 4, 2022

Codecov Report

Merging #3726 (13e1967) into main (a8c222a) will increase coverage by 0.06%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3726      +/-   ##
==========================================
+ Coverage   87.19%   87.26%   +0.06%     
==========================================
  Files         274      274              
  Lines       10009    10009              
==========================================
+ Hits         8727     8734       +7     
+ Misses       1282     1275       -7     
Impacted Files Coverage Δ
...tation/OpenTelemetryProtocolExporterEventSource.cs 75.00% <0.00%> (-10.00%) ⬇️
...ter.ZPages/Implementation/ZPagesActivityTracker.cs 100.00% <0.00%> (+2.85%) ⬆️
...Listener/Internal/PrometheusExporterEventSource.cs 66.66% <0.00%> (+5.55%) ⬆️
...entation/ExportClient/OtlpGrpcTraceExportClient.cs 50.00% <0.00%> (+14.28%) ⬆️
...xporter.OpenTelemetryProtocol/OtlpTraceExporter.cs 59.09% <0.00%> (+22.72%) ⬆️

@CodeBlanch CodeBlanch merged commit 6b38ed7 into open-telemetry:main Oct 4, 2022
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.

3 participants