Skip to content

Commit

Permalink
fix: Silence healthcheck in log and sentry (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
armandfardeau authored Aug 28, 2023
1 parent 274e19b commit e407e6d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
config.log_formatter = ::Logger::Formatter.new

config.lograge.enabled = true
config.lograge.ignore_actions = ["HealthCheck::HealthCheckController#index"]
config.lograge.formatter = Lograge::Formatters::Json.new
config.lograge.custom_options = lambda do |event|
{
Expand Down
12 changes: 12 additions & 0 deletions lib/decidim_app/sentry_setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ def init
config.breadcrumbs_logger = [:active_support_logger, :http_logger]

config.traces_sample_rate = sample_rate.to_f

config.traces_sampler = lambda do |sampling_context|
transaction_context = sampling_context[:transaction_context]
op = transaction_context[:op]
transaction_name = transaction_context[:name]

if op =~ /http/ && transaction_name == "/health_check"
0.0
else
sample_rate.to_f
end
end
end

Sentry.set_tags('server.hostname': hostname) if hostname.present?
Expand Down

0 comments on commit e407e6d

Please sign in to comment.