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

Get worker ID from application process #1492

Open
lchabert opened this issue Nov 21, 2024 · 2 comments
Open

Get worker ID from application process #1492

lchabert opened this issue Nov 21, 2024 · 2 comments

Comments

@lchabert
Copy link

Hi,

In order to get consolidated stats from django-prometheus plugins with multiple workers, the prom module need to setup files on tmp dir.
By default, it save the tmp file suffixed by the pid of the worker process.
Documented here: documentation

In the documentation, we can see a snippet of code to use the worker id instead of the pid when uwsgi is used as server.

How can we have the same behaviour with unit ?

I can't see any env variable pushed with the application worker or any channel open with unit to retrieve this kind of information.

Do you have any hints ?

Thx.

@ac000
Copy link
Member

ac000 commented Nov 21, 2024

This kind of information is simply not provided.

The obvious thing (to me anyway) seems to be to simply give those files a name that you can then easily lookup in a directory and know that it is a file you are interested in. You could even put said files in their own directory... then all you do is read through any files in there...

@lchabert
Copy link
Author

lchabert commented Dec 2, 2024

Hi,

As far i can read (and understand), the plugin does not work like that. The best way to have no orphaned files is to create predictible file name for each worker.
And nginx unit does not give the information of the process name/index.

Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants