Skip to content

Commit 828c952

Browse files
committed
started work on puma integration
1 parent 9f5088d commit 828c952

71 files changed

Lines changed: 883 additions & 191 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lefthook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pre-commit:
2121
run: scripts/generate_typescript_structs.rb
2222

2323
- name: codegen-sync
24-
glob: '{schemas/log_sources/**/*,scripts/templates/generate_log_structs/**/*,scripts/generate_log_structs.rb}'
24+
glob: '{schemas/log_sources/**/*,scripts/templates/generate_log_structs/**/*,scripts/generate_sorbet_log_structs.rb}'
2525
run: scripts/check_generated.sh
2626

2727
- name: cspell

lib/log_struct/concerns/error_handling.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def error_handling_mode_for(source)
2626
when Source::Security
2727
config.error_handling_modes.security_errors
2828
when Source::Rails, Source::App, Source::Job, Source::Storage, Source::Mailer,
29-
Source::Shrine, Source::CarrierWave, Source::Sidekiq, Source::Dotenv
29+
Source::Shrine, Source::CarrierWave, Source::Sidekiq, Source::Dotenv, Source::Puma
3030
config.error_handling_modes.standard_errors
3131
else
3232
# Ensures the case statement is exhaustive

lib/log_struct/config_struct/integrations.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ class Integrations < T::Struct
8484
# Enable dotenv-rails integration (convert to structured logs)
8585
# Default: true
8686
prop :enable_dotenv, T::Boolean, default: true
87+
88+
# Enable Puma integration (convert server lifecycle logs)
89+
# Default: true
90+
prop :enable_puma, T::Boolean, default: true
8791
end
8892
end
8993
end

lib/log_struct/enums/event.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ class Event < T::Enum
3939
Save = new(:save)
4040
Restore = new(:restore)
4141

42+
# Server lifecycle (e.g., Puma)
43+
Boot = new(:boot)
44+
Started = new(:started)
45+
Listening = new(:listening)
46+
Shutdown = new(:shutdown)
47+
Goodbye = new(:goodbye)
48+
Exiting = new(:exiting)
49+
4250
# Security events
4351
IPSpoof = new(:ip_spoof)
4452
CSRFViolation = new(:csrf_violation)

lib/log_struct/enums/log_field.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,17 @@ class LogField < T::Enum
138138
# Ahoy-specific fields
139139
AhoyEvent = new(:ahoy_event)
140140
Properties = new(:properties)
141+
142+
# Puma / server lifecycle fields
143+
Mode = new(:mode)
144+
PumaVersion = new(:puma_version)
145+
PumaCodename = new(:puma_codename)
146+
RubyVersion = new(:ruby_version)
147+
MinThreads = new(:min_threads)
148+
MaxThreads = new(:max_threads)
149+
Environment = new(:environment)
150+
ListeningAddresses = new(:listening_addresses)
151+
Address = new(:addr)
141152
end
142153
end
143154
end

lib/log_struct/enums/source.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class Source < T::Enum
2323
CarrierWave = new(:carrierwave)
2424
Sidekiq = new(:sidekiq)
2525
Dotenv = new(:dotenv)
26+
Puma = new(:puma)
2627
end
2728
end
2829
end

lib/log_struct/integrations.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
require_relative "integrations/ahoy"
1818
require_relative "integrations/active_model_serializers"
1919
require_relative "integrations/dotenv"
20+
require_relative "integrations/puma"
2021

2122
module LogStruct
2223
module Integrations
@@ -56,6 +57,7 @@ def self.setup_integrations
5657
Integrations::ActiveStorage.setup(config) if config.integrations.enable_activestorage
5758
Integrations::CarrierWave.setup(config) if config.integrations.enable_carrierwave
5859
Integrations::Sorbet.setup(config) if config.integrations.enable_sorbet_error_handlers
60+
Integrations::Puma.setup(config) if config.integrations.enable_puma
5961
end
6062
end
6163
end

0 commit comments

Comments
 (0)