Skip to content

Commit

Permalink
Remove duplicate parameter filtering
Browse files Browse the repository at this point in the history
The Active Job and Sidekiq instrumentations called out to our parameter
filtering. It doesn't need to do this. Our Transaction class runs it
through the parameter filtering when it calls `sanitized_params` when
sampling the transaction.

No test updates needed. There were already tests present it filtered out
parameters. It still does that.

[skip changeset] No behavior change, only an optimization.
  • Loading branch information
tombruijn committed Jul 5, 2024
1 parent c153ae7 commit cf812a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
7 changes: 1 addition & 6 deletions lib/appsignal/hooks/active_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,7 @@ def execute(job)
end

if transaction
transaction.set_params_if_nil(
Appsignal::Utils::HashSanitizer.sanitize(
job["arguments"],
Appsignal.config[:filter_parameters]
)
)
transaction.set_params_if_nil(job["arguments"])

transaction_tags = ActiveJobHelpers.transaction_tags_for(job)
transaction_tags["active_job_id"] = job["job_id"]
Expand Down
12 changes: 1 addition & 11 deletions lib/appsignal/integrations/sidekiq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def call(_worker, item, _queue, &block)
raise exception
ensure
if transaction
transaction.set_params_if_nil(filtered_arguments(item))
transaction.set_params_if_nil(parse_arguments(item))
transaction.set_http_or_background_queue_start
Appsignal::Transaction.complete_current! unless exception

Expand Down Expand Up @@ -115,16 +115,6 @@ def formatted_action_name(job)
"#{sidekiq_action_name}#perform"
end

def filtered_arguments(job)
arguments = parse_arguments(job)
return unless arguments

Appsignal::Utils::HashSanitizer.sanitize(
arguments,
Appsignal.config[:filter_parameters]
)
end

def formatted_metadata(item)
{}.tap do |hash|
(item || {}).each do |key, value|
Expand Down

0 comments on commit cf812a4

Please sign in to comment.