-
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
FileExistsError: [Errno 17] File exists: '/root/.opencensus/.azure/gunicorn' when I try to run Docker #816
Comments
Hi @RenanAlonkin , I have found a workaround, you can specify a storage_path when creating the AzureExporter object:
It creates a folder with unique id per thread in the .azure folder (inspired from the default value of storage_path). |
@RenanAlonkin Are you still wanting [#817] to be merged? |
To be honest, no, I've created a workaround for my project. It does not look good, but it works. What jeremy posted looks like it will work, when I have time I will try to use it. |
Using the azure ext for multiple threads/workers applications is a common pattern for web applications I think. I had no problem with the appinsights python sdk but it is deprecated now so I had to switch my app to opencensus for logging. It would be nice to have a fix as more and more people are going to migrate to this library. PS: if two azure exporters can live together on the same .azure folder maybe the solution of @RenanAlonkin is better but I did not spend enough time on the code to say |
Specifying the storage path is the recommended approach for this issue. Closing. |
Re-opening to implement a more permanent fix. See [#903]. |
Hi @lzchen , |
@jeremy010203 |
Hello there,
I'm currently having the following problem: I have an API, and I want to use Opencensus to export my exceptions to Azure's Application Insights, but, when I try to run it inside of a Docker Container this problem appears:
Describe your environment.
3.8.0 (default, Nov 6 2019, 16:00:02)
Opencensus
opencensus==0.7.5 opencensus-ext-azure==1.0.0
FastAPI:
fastapi==0.42.0 uvicorn==0.10.8 gunicorn==20.0.0
Steps to reproduce.
I've created an "Opencensus middleware" for FastAPI, the code can be found at this link. All I do is call it inside FastAPI middleware.
UPDATE:
Okay, I've found the reason that this error is occuring, but I don't know how to solve it (completely).
This problem occurs because I'm trying to run opencensus in a multi-worker env. To solve it, I changed
os.makedirs(self.path)
toos.makedirs(self.path, exist_ok=True)
, butexist_ok=True
is not compatible with Python 2. Can anybody help me to solve it? I would like to make a PR to this solution.The text was updated successfully, but these errors were encountered: