-
Notifications
You must be signed in to change notification settings - Fork 649
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
Make necessary metrics API symbols private #2626
Conversation
@ocelotl I just thought of something. Any idea how this effects the docs? Do they show the same structure as before? |
It makes a difference in the displayed paths: This is how the documentation looks in This is how the documentation looks in this PR: Notice that in the second image there is an underscore before I tried fixing this issue as it says here by making this change: diff --git a/opentelemetry-api/src/opentelemetry/_metrics/_instrument.py b/opentelemetry-api/src/opentelemetry/_metrics/_instrument.py
index ec8161a7a..1e881a1c7 100644
--- a/opentelemetry-api/src/opentelemetry/_metrics/_instrument.py
+++ b/opentelemetry-api/src/opentelemetry/_metrics/_instrument.py
@@ -54,6 +54,9 @@ class Instrument(ABC):
# FIXME check that the unit contains only ASCII characters
+Instrument.__module__ = "opentelemetry._metrics.instrument"
+
+
class _ProxyInstrument(ABC, Generic[InstrumentT]):
def __init__(self, name, unit, description) -> None:
self._name = name Nevertheless, I go this error when running
I am ok with this PR as it is now, I don't see this as being too critical. We can add a workaround in a separate PR, the most important part of this PR is that we don't have unnecessary symbols that are exposed in the public API. |
Did the original issue require us to simply add a |
Closing in favor of #2651 |
Fixes #2622
Note for reviewers
This PR is big but it is mostly just renaming public modules to make them private. For example, if there is
a/b.py
, this PR addsa/_b.py
, then it adds a blanka/b.py
and imports ina/b.py
all the public symbols that are ina/_b.py
.The idea behind this is to make public only the intended public symbols, here is an example:
In this way we don't expose
re.match
as part of our public API, because to import that the user would have to do this:from a._b import match
.