Exclude certain classes from being instrumented

Kibana version: 7.4

Elasticsearch version: 7.4

APM Server version: 7.4

APM Agent language and version: Latest version, Ruby

Browser version: N/A

Using the Ruby agent, I know it's possible to exclude certain URL suffixes (ie. /healthcheck) from being reported (which we use with great success!) but in a few services we have we use Sidekiq which is background job processing. There's a bunch of repetative jobs that just send health information to AWS cloudwatch that I'd like to have the agent not instrument but I can't quite see a config option for classes.

In this example, I'd like to have the 2 boxed jobs not collected by the agent. Is this do'able?

Hi @dnorth98!

You can omit the payloads with a filter. It's not going to stop the events from being registered but it is going to stop them from being sent to APM Server.

Like so (untested):

ElasticAPM.add_filter(:omit_cloudwatch_workers) do |payload|
  if payload.dig(:transaction, :name) =~ /CloudWatchWorker/
    return ElasticAPM::Transport::Filters::SKIP # => :skip
  end

  payload
end
1 Like

Brilliant! I love it. I will test this today and see how it goes.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.