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

'set_logger_provider' no longer importable from 'opentelemetry.sdk._logs' #3088

Closed
wbarnha opened this issue Dec 13, 2022 · 5 comments · Fixed by #3113
Closed

'set_logger_provider' no longer importable from 'opentelemetry.sdk._logs' #3088

wbarnha opened this issue Dec 13, 2022 · 5 comments · Fixed by #3113
Labels
bug Something isn't working doc Documentation-related logging triaged

Comments

@wbarnha
Copy link

wbarnha commented Dec 13, 2022

A week ago I was able to run the example for logging in https://github.com/open-telemetry/opentelemetry-python/tree/main/docs/examples/logs.

Steps to reproduce
I install either version via:

pip install opentelemetry-exporter-otlp==1.15.0

or

pip install opentelemetry-exporter-otlp==1.14.0

Then run the following code:

from opentelemetry.sdk._logs import set_logger_provider

What is the expected behavior?
Should import without any issues.

What is the actual behavior?

ImportError: cannot import name 'set_logger_provider' from 'opentelemetry.sdk._logs' (/usr/local/lib/python3.10/dist-packages/opentelemetry/sdk/_logs/__init__.py)

Additional context
I found that when I installed opentelemetry-exporter-otlp==1.14.0, opentelemetry-sdk==1.15.0 was installed as well. When I installed opentelemetry-sdk==1.14.0, everything works fine again.

@wbarnha wbarnha added the bug Something isn't working label Dec 13, 2022
@wbarnha wbarnha changed the title ImportError: cannot import name 'set_logger_provider' from 'opentelemetry.sdk._logs' 'set_logger_provider' no longer importable from 'opentelemetry.sdk._logs' Dec 13, 2022
@AldoCF96
Copy link

same ttrying to run the example and it failed

@sernst
Copy link

sernst commented Dec 15, 2022

Yes, the example shown here:

https://github.com/open-telemetry/opentelemetry-python/blob/main/docs/examples/logs/example.py#L10

no longer works with the 1.15.0 release. Is there a change in the package and how this should work going forward?

@srikanthccv srikanthccv added doc Documentation-related triaged logging labels Dec 18, 2022
@hannah-jj
Copy link
Contributor

I've encountered the same problem and searched for the method in the source code and found it at a new location:
from opentelemetry._logs import set_logger_provider

@aabmass
Copy link
Member

aabmass commented Dec 20, 2022

Would someone like to send a PR to update the example?

@hannah-jj
Copy link
Contributor

Would someone like to send a PR to update the example?

Yes, I'd be happy to send a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working doc Documentation-related logging triaged
Projects
None yet
6 participants