miyagawa / Starman

Starman is a high-performance preforking Perl PSGI web server
http://search.cpan.org/dist/Starman
Other
287 stars 84 forks source link

Support custom proctitles #131

Open jrubinator opened 6 years ago

jrubinator commented 6 years ago

Use Case: We're monitoring applications, and using their proctitles to indicate the application being monitored. To do this, we include things like [App::Name] in our titles - eg. starman worker [App::Name] idle and starman master [App::Name].

We're not currently using Starman, but I would like to. Unfortunately, I don't currently see a good way to enable this proctitle-setting. I know that in #89 we decided not to do this, but I was hoping that this use case might be convincing :)

Do either of these solutions seem reasonable? If so, I can submit a PR for one of them.

  1. Modify Starman::Server and Plack::Handler::Starman to be better extensible. I think this would consist of adding a method that generates the proctitle - that's the join of $options->{argv} - and one that picks the server.
  2. Allow a --name argument (or enhance the --proctitle option to allow specifying what the proctitle should be).

Addendums:

I said above that I don't see good ways to accomplish what I'm looking for, but I do see some bad ways to do so:

  1. by running starman $ARGS bin/app_name.psgi [App::Name] idle. This relies on those final two strings to be passed through untouched and unused. It seems to fall under "not good".
  2. Adapt our process monitoring to recognize things of the format bin/app_name.psgi. I would rather not do this, since this ties our monitoring to the name of an script, rather than the reported state of an application.