-
Notifications
You must be signed in to change notification settings - Fork 764
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
Remove usage of InternalsVisibleTo in the internal instrumentations. #1856
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1856 +/- ##
==========================================
- Coverage 83.31% 83.30% -0.02%
==========================================
Files 188 188
Lines 6139 6139
==========================================
- Hits 5115 5114 -1
- Misses 1024 1025 +1
|
src/OpenTelemetry.Instrumentation.AspNet/OpenTelemetry.Instrumentation.AspNet.csproj
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.Instrumentation.AspNet/OpenTelemetry.Instrumentation.AspNet.csproj
Outdated
Show resolved
Hide resolved
Do we want the instrumentation libraries to take dependency on the SDK, or just the API? In the initial PR #960, I suggested that we might want instrumentation library to take the convention rather than the dependency on the SDK. Happy to revisit this topic since the scope has changed (initially we didn't think instrumentation library should change the flag, now we do). |
Just pushed an update to move the includes to the Common.props file which cleans things up pretty nicely. |
The spec requires that instrumentation libraries must be able to depend only on the API. Otherwise, there is no reason for the SDK/API split to exist. https://github.com/open-telemetry/opentelemetry-specification/blob/v1.0.1/specification/library-guidelines.md#requirements
|
Yep, the challenge here is that some instrumentation libraries want (not that they must) to take dependency on the SDK as they need additional features (e.g. "SuppressInstrumention" which is not an API concept). And I think it is not something I would encourage. So we might need to consider putting the "wanted" features to the API. |
@Oberon00 I haven't been working on OTel Python for long time, do you know if there is a similar requirement in Python client, that an instrumentation library would want to suppress the spans from underlying library? #960 In OTel.NET, there is high demand on the following scenario:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
The issue about some instrumentations depending on SDK and not API is separately addressable (or not). Not blocking this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I am modifying the section about "How to write instrumentation library", to reflect recent changes of eliminating ActivitySourceAdapter. |
This PR is related to #893 which has a dependency on open-telemetry/opentelemetry-specification#530 which points to https://github.com/lmolkova/oteps/blob/terminal-context/text/0069-terminal-context.md. |
I guess it relates to it in just that it is making 2 additional methods on |
Hey just FYI there is also this thing I looked at it bit. Not much (zero?) documentation and it seems kind of heavy, but something else to consider. |
I can live with the tests using internals. I just want the community to be able to make their own instrumentation's the same way you all make the ones that are included in the project. This PR will make sure that we can do that. |
90f3d87
to
ec49356
Compare
@cijothomas this is broken now because the instrumentations can't call the increment and decrement methods any more. I'm trying to see if I can just remove them from |
I pushed the change using the dedicated |
Oh fun. So this is one of those where tests fail when all run together, but if you run a small group at a time they pass. So I'm guessing that somehow the |
#1892 I tried the same in standalone PR. |
I'll check. |
So I guess the difference between your PR and mine is that I have a copy of the |
Changed to add a random suffix to the end of the slot name, but this is probably not a great solution as it would add a lot of AsyncLocal's |
@cijothomas this has been updated to only remove the internalsvisibleto now. Hopefully we can get this merged now and ensure that no other cheats for the internal instrumentations creep into the library. |
...y.Instrumentation.StackExchangeRedis/OpenTelemetry.Instrumentation.StackExchangeRedis.csproj
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ready to go!
Thanks for continuous effort in driving this cleanups!
Fixes #1585
Changes
This PR removes usage of
InternalsVisibleTo
within the included instrumentations. This makes it so that 3rd party instrumentations are working with the same API and can create their own instrumentations without being blocked by internal APIs. This change required adding a lot of linked source files to each instrumentation which would be nice if there weren't so many, but it does work and is something that 3rd party instrumentations can do and know that they are using unsupported APIs.Doing this exposed that
SuppressInstrumentationScope.IncrementIfTriggered
andSuppressInstrumentationScope.DecrementIfTriggered
need to be part of the public API.