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

Azure Monitor opentelemetry exporter uses deprecated locale.getdefaultlocale #32232

Closed
jenshnielsen opened this issue Sep 26, 2023 · 7 comments · Fixed by #32345
Closed

Azure Monitor opentelemetry exporter uses deprecated locale.getdefaultlocale #32232

jenshnielsen opened this issue Sep 26, 2023 · 7 comments · Fixed by #32345
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor - Exporter Monitor OpenTelemetry Exporter needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@jenshnielsen
Copy link
Contributor

  • Package Name: azure-monitor-opentelemetry-exporter
  • Package Version: 1.0.0.b17
  • Operating System: windows 11
  • Python Version: python 3.11

Describe the bug
Using Azure Monitor Opentelemetry exporter triggers a deprecation warning

C:\Users\jenielse\Miniconda3\envs\myenv\Lib\site-packages\azure\monitor\opentelemetry\exporter_utils.py:57: DeprecationWarning: Use setlocale(), getencoding() and getlocale() instead
"ai.device.locale": locale.getdefaultlocale()[0],

To Reproduce
Steps to reproduce the behavior:

  1. Configure export with azure monitor opentelemetry exporter.

Or any other opteration that triggers an import of _utils.py from the package

Expected behavior

No deprecation warning.

Additional context

Afaik this only became deprecated in python 3.11

Note however that on windows the replacement has some issues python/cpython#82986

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor - Exporter Monitor OpenTelemetry Exporter needs-team-triage Workflow: This issue needs the team to triage. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Sep 26, 2023
@xiangyan99 xiangyan99 removed the needs-team-triage Workflow: This issue needs the team to triage. label Sep 27, 2023
@xiangyan99
Copy link
Member

Thanks for the feedback, we’ll investigate asap.

@github-actions github-actions bot added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Sep 27, 2023
@pvaneck pvaneck assigned jeremydvoss and lzchen and unassigned pvaneck Sep 27, 2023
@pamelafox
Copy link
Member

pamelafox commented Sep 28, 2023

There's also another deprecation warning in similar code (opentelemetry):

../../home/vscode/.local/lib/python3.11/site-packages/azure/monitor/opentelemetry/_vendor/v0_39b0/opentelemetry/instrumentation/dependencies.py:4
  /home/vscode/.local/lib/python3.11/site-packages/azure/monitor/opentelemetry/_vendor/v0_39b0/opentelemetry/instrumentation/dependencies.py:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    from pkg_resources import (

@jenshnielsen
Copy link
Contributor Author

@pamelafox Yes I actually reported that one over here open-telemetry/opentelemetry-python-contrib#1970 (this issue was fixed in opentelemetry sdk/api a few months ago but not in contrib/instrumentation yet

@lzchen
Copy link
Member

lzchen commented Sep 28, 2023

@jenshnielsen

Interesting that you are seeing the warning messages. DeprecationWarnings should be ignored for code that is not directly executed from main but this might come up possibly in CI runs.

Regardless, it seems that getdefaultlocale() will be removed in py3.13 so we might want to switch over before that happens to avoid breaking code. The windows issue with getlocale() is a bit concerning so we might be better off simply just to ignore deprecation warnings before py3.13 comes out, similar to here. Thoughts?

@pamelafox
Copy link
Member

I don't know about @jenshnielsen but I use pytest to test our app code, and pytest defaults to showing warnings like the deprecation warnings, so they add a lot of noise to pytest output. We can filter them out but it's always nicer when code is upgraded, where it makes sense.

@jenshnielsen
Copy link
Contributor Author

I indeed noticed it via our test suite and pytest too.

@lzchen
Copy link
Member

lzchen commented Oct 5, 2023

@pamelafox

There's a pr in upstream opentelemetry that will fix this issue

@github-actions github-actions bot locked and limited conversation to collaborators Jan 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor - Exporter Monitor OpenTelemetry Exporter needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants