Skip to content

Commit

Permalink
Bump dogstatsd-ruby from 3.3.0 to 5.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
orien committed Feb 14, 2024
1 parent 6b0206b commit e003d8a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ GEM
msgpack
debug_inspector (0.0.3)
diffy (3.4.2)
dogstatsd-ruby (3.3.0)
dogstatsd-ruby (5.6.1)
domain_name (0.6.20240107)
doorkeeper (5.6.8)
railties (>= 5)
Expand Down
17 changes: 10 additions & 7 deletions config/initializers/statsd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ class << Samson
end

raise "use STATSD_HOST and STATSD_PORT" if File.exist?("config/statsd.yml")
Samson.statsd = Datadog::Statsd.new(ENV['STATSD_HOST'] || '127.0.0.1', ENV['STATSD_PORT'] || '8125')
Samson.statsd.namespace = "samson.app"
Samson.statsd = Datadog::Statsd.new(
ENV['STATSD_HOST'] || '127.0.0.1',
ENV['STATSD_PORT'] || '8125',
logger: Rails.logger,
namespace: 'samson.app',
single_thread: Rails.env.test?
)

Samson.statsd.event "Startup", "Samson startup" if ENV['SERVER_MODE']

Expand All @@ -27,11 +32,9 @@ class << Samson
kubernetes = payload.fetch(:kubernetes)
tags << "kubernetes:#{kubernetes}" unless kubernetes.nil?

Samson.statsd.batch do |statsd|
statsd.timing "execute_shell.time", duration, tags: tags
(payload[:parts] || {}).each do |part, time|
statsd.timing "execute_shell.parts", time, tags: tags + ["part:#{part}"]
end
Samson.statsd.timing "execute_shell.time", duration, tags: tags
(payload[:parts] || {}).each do |part, time|
Samson.statsd.timing "execute_shell.parts", time, tags: tags + ["part:#{part}"]
end
Rails.logger.info(payload.merge(total: duration, message: "Job execution finished"))
end
Expand Down

0 comments on commit e003d8a

Please sign in to comment.