No release in over a year
puma_dynamic_tags - allows to use a dynamic tag puma's option calculated by a proc.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.3
~> 0.14
~> 13.0
~> 3.11
~> 0.21
 Project Readme

puma_dynamic_tags · Supported by Cado Labs · Gem Version

Puma plugin that allows you to define dynamically calculated process titles (tag option) for your workers inside your puma's config.

Installation

gem install puma_dynamic_tags

or:

# Gemfile
gem "puma_dynamic_tags"
bundle install

Usage

Setup your puma application:

# config.ru

# (Sinatra example)
require "sinatra"
run Sinatra::Application

Enable dynamic_tags plugin and configure dynamic tag option:

# config/puma.rb
plugin "dynamic_tags"

# and now you can use dynamic tags:

tag do
  "some_dynamic_result: #{Time.now}" # your dynamic code
end

and then:

# run your puma in your favorite mode
bundle exec puma -t 8:32 -w 3

and then (check your process titles):

puma 5.6.4 (tcp://0.0.0.0:9292) [some_dynamic_result: 2022-04-08 03:01:04 +0300] # (main claster process)
puma: cluster worker 2: 38624 [some_dynamic_result: 2022-04-08 03:02:50 +0300] # <--- dynamic process title
puma: cluster worker 1: 38624 [some_dynamic_result: 2022-04-08 03:02:50 +0300] # <--- dynamic process title
puma: cluster worker 0: 38624 [some_dynamic_result: 2022-04-08 03:02:50 +0300] # <--- dynamic process title

and then (run phase-restart in order to make sure that your workers have a new titles):

puma 5.6.4 (tcp://0.0.0.0:9292) [some_dynamic_result: 2022-04-08 03:01:04 +0300] # (main claster process)
puma: cluster worker 2: 38624 [some_dynamic_result: 2022-04-08 03:03:25 +0300] # <--- each title has been recalculated
puma: cluster worker 1: 38624 [some_dynamic_result: 2022-04-08 03:03:25 +0300] # <--- each title has been recalculated
puma: cluster worker 0: 38624 [some_dynamic_result: 2022-04-08 03:03:25 +0300] # <--- each title has been recalculated

Profit!

Contributing

  • Fork it ( https://github.com/0exp/puma_dynamic_tags )
  • Create your feature branch (git checkout -b feature/my-new-feature)
  • Commit your changes (git commit -am '[feature_context] Add some feature')
  • Push to the branch (git push origin feature/my-new-feature)
  • Create new Pull Request

License

Released under MIT License.

Supporting

Supported by Cado Labs

Authors

Rustam Ibragimov