-
Notifications
You must be signed in to change notification settings - Fork 250
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
AzureExporter not working with multiprocessing #928
Comments
@dpgrodriguez
|
Hi Leighton, I tried your suggestion but still cannot send span data from inside multiprocess. I used your exact code and this is what was displayed:
The only span data generated was from "outside". I also tried removing the parent span from
with these results:
The data from inside multiprocessing also wasn't sent to Applicaiton Insights These are the versions that I'm using: |
Did you set the |
Yes, tried setting it to 5 and 1. |
Any other recommendations? |
Perhaps it's the way you are setting up
|
Is there a way to show lower level debug messages? |
@dpgrodriguez So the only way to get this working for your OS is to duplicate the initialization logic of your |
That's some interesting findings. I did some digging as well. In
However, in the
Any thoughts on this? Could it be that the threading Queue is not playing well with multiprocessing? |
@dpgrodriguez |
The worker is actually present but doesn't see the contents of the threading queue because it can't access it. I did some quick PoC of using the multiprocess Queue and was able to send logs to analytics.
This works and sends the multiprocessed SpanData into insights. |
I am facing the same issue while utilizing multiprocessing through joblib. Mine is a pandas based ML Pipeline where work is distributed across multiple processes using joblib ("multiprocessing" back end).
joblib with "multiprocessing" backend successfully logs to a file on the disk across multiple processes. But, when I add "AzureLogHandler", I don't see any logs sent to Azure Application Insights. I have used the workaround proposed in the thread. It works. But finally it's a work around. It would be great if this issue can be prioritized and addressed in Open-Census. |
@arnabbiswas1 If you are interested in using other technologies (such as Gunicorn), take a look at the examples in OpenTelemetry. |
@lzchen Thanks for the pointers. Right now we are using "multiprocessing" as a backend. The other backend which we can use is "loky". That has the same logging issue, even with log files on the disk.
In general, for various priorities, I can't spend much time in this issue at this point of time. Considering that some flavor of multiprocessing is very common in Python based applications and Microsoft is using this library for Azure Monitor/Application Insight, I thought there may be some work arounds or solutions. Thanks for your support. Please keep me posted, in case, you encounter with some other solutions in future. |
Is there any resolution for integrating AzureLogHandler and AzureEventHandler objects with the multithreaded process? I have been trying to send intermediate loggers to App Insights from a threaded process every 5 secs, I have utilized a workaround to create the AzureEventHandler at the process ID level, however, when the main thread closes, the opencensus BaseLogHandler class raises an error as such: The workaround has resulted in successful uploading of intermediate logs to App Insights, the only issue is faced when the Main thread closes. |
Can you please share a working sample of how you managed to integrate Azure Exporter / Azure Event handler / Azure Log handler to work in a multiprocessing setup? That would help me a lot in resolving the issue which I am facing upon using the Azure Event handler under multiple processes. FYI @dpgrodriguez |
I was experiencing the same issue (with Celery) and I figured out that it's not specifically related to the AzureExporter, but to the opencensus.common.schedule.Queue |
Any news on this? 👀 We're having the same problem with Celery and would really appreciate to have an official solution |
There is a draft pr open and the issue should be addressed once it is merged and released. |
Would you be able to share a link to this PR? I would be nice to be able to check if it has been merged or not... |
Describe your environment.
MacOS 10.14.6
Python 3.7.5
opencensus-ext-azure==1.0.4
opencensus-ext-requests==0.7.3
Steps to reproduce.
I have code that I want to monitor the dependency calls to Azure DevOps APIs. Our code is running multiprocessing using the
Process
class. When the exporter is ran outside of multiprocessing, it sends telemetry to App Insights. When ran inside a multiprocessing Process, it doesn't. I added a callback to print the spandata and it doesn't get called when usingProcess
.BaseInsights:
What is the expected behavior?
Span data gets sent to Application Insights
What is the actual behavior?
Span data is not sent to Application Insights
The text was updated successfully, but these errors were encountered: