Granulate/gprofiler

python: gunicorn appids improvements

Jongy opened this issue · 0 comments

Jongy commented

This assumption is wrong -

# wsgi app specification will come always as the last argument (if hasn't been specified config file)
return self.gunicorn_to_app_id(process.cmdline()[-1], process)

and I'm seeing many sites where we select a random argument to gunicorn due to it.

Let's try improving it with heuristics:

  1. all app specs will have : in them, so don't try arguments that don't have :.
  2. if multiple args with : exist, prefer the one not preceeded by a -- or - argument, i.e in a commandline like gunicorn -k 4 myapp:app -b 0.0.0.0:80 it will prefer the first : occurrence because it's preceeded by arg 4 not by arg -b.

The same probably applies for #693 .