Closed cirezd closed 1 year ago
Thank you for the feedback @cirezd. We will investigate and get back to you asap.
Thank you for your feedback. This has been routed to the support team for assistance.
@cirezd
Could you try installing https://pypi.org/project/azure-monitor-opentelemetry-exporter/ instead? Your current code is set up to use this exporter library. The library you are using currently is our all-inclusive "distro" offering which we recommend using a different api and is still in development.
@lzchen You are right, I confused the packages. I actually had both installed (so many packages it gets confusing...).
I reinstalled azure-monitor-opentelemetry-exporter --pre
and I still get the same error message.
I can reproduce this if I execute this in VSCode. I believe the warning message is outputted because the TracerProvider
is being set more than once. The line trace.set_tracer_provider(TracerProvider())
is being run once (when the Python file is interpreted), and then another time (when uvicorn.run("telemetry_tests:app", port=8008, reload=True)
) is run in the subprocess. If you just run the Python file via uvicorn telemetry_tests:app --reload
in the command line it should only run the trace.set_tracer_provider(TracerProvider())
once. If you still want to continue to execute this via VSCode debug, you can move that line, the exporter, the span processor lines in the if __name__ == "__main__":
clause.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @cijothomas, @reyang, @rajkumar-rangaraj, @TimothyMothra, @vishweshbankwar, @ramthi.
Author: | cirezd |
---|---|
Assignees: | lzchen |
Labels: | `question`, `Service Attention`, `customer-reported`, `Monitor - Exporter` |
Milestone: | - |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @cijothomas, @reyang, @rajkumar-rangaraj, @TimothyMothra, @vishweshbankwar, @ramthi.
Issue Details
Hello dear Bot. You are tagging the wrong people ;)
@cijothomas
I fixed the CODEOWNERS file so you shouldn't be tagged anymore :)
I can reproduce this if I execute this in VSCode. I believe the warning message is outputted because the
TracerProvider
is being set more than once. The linetrace.set_tracer_provider(TracerProvider())
is being run once (when the Python file is interpreted), and then another time (whenuvicorn.run("telemetry_tests:app", port=8008, reload=True)
) is run in the subprocess. If you just run the Python file viauvicorn telemetry_tests:app --reload
in the command line it should only run thetrace.set_tracer_provider(TracerProvider())
once. If you still want to continue to execute this via VSCode debug, you can move that line, the exporter, the span processor lines in theif __name__ == "__main__":
clause.
Thank you that indeed solves the issue of Overriding of current TracerProvider is not allowed
. It also works if one puts the lines into a fastapi startup event. But in that case the error of sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=0 mode='r' encoding='UTF-8'>
remains.
@cirezd If you are still getting errors, please paste the code snippet you are using.
Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!
Describe the bug Using the tracer to track a dependency manually results in Resource Warning and warning
Overriding of current TracerProvider is not allowed
. I am using the Azure Monitor package for telemetry in a fastAPI application that makes API calls, whereby the client is an async dependency. There is no other telemetry running. This is basically just the sample here https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-opentelemetry-exporter/samples/traces/sample_trace.py applied to a fastAPI app. I am using fastAPI version 0.92.To Reproduce Steps to reproduce the behavior:
Expected behavior No error
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.