puma_dynamic_tags · ·
Installation
gem install puma_dynamic_tags
or:
# Gemfile
gem "puma_dynamic_tags"
bundle install
Usage
Setup your puma application:
# config.ru
# (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 names):
puma 5.6.4 (tcp://0.0.0.0:9292) [some_dynamic_result: 2022-04-08 03:01:04 +0300] # <--- dynamic process name
puma: cluster worker 2: 38624 [some_dynamic_result: 2022-04-08 03:02:50 +0300] # <--- dynamic process name
puma: cluster worker 1: 38624 [some_dynamic_result: 2022-04-08 03:02:50 +0300] # <--- dynamic process name
puma: cluster worker 0: 38624 [some_dynamic_result: 2022-04-08 03:02:50 +0300] # <--- dynamic process name
and then (run phase-restart and check recalculated process names with your dynamic tag):
puma 5.6.4 (tcp://0.0.0.0:9292) [some_dynamic_result: 2022-04-08 03:01:04 +0300] # <--- each tag has been recalculated
puma: cluster worker 2: 38624 [some_dynamic_result: 2022-04-08 03:03:25 +0300] # <--- each tag has been recalculated
puma: cluster worker 1: 38624 [some_dynamic_result: 2022-04-08 03:03:25 +0300] # <--- each tag has been recalculated
puma: cluster worker 0: 38624 [some_dynamic_result: 2022-04-08 03:03:25 +0300] # <--- each tag 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.