Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove DT warnings for sidekiq #1834

Merged
merged 5 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# New Relic Ruby Agent Release Notes

## dev

Upcoming version removes Distributed Tracing warnings from agent logs when using Sidekiq.


- **Removes Distributed Tracing related warnings from agent logs when headers are not present in Sidekiq**

Previously, the agent would log a warning to `newrelic_agent.log` every time it attempted to accept empty Distributed Tracing headers from Sidekiq jobs which could result in an excessive number of warnings. Now the agent will no longer create these warnings when using Sidekiq. [PR#1834](https://github.com/newrelic/newrelic-ruby-agent/pull/1834)

## v9.0.0

Version 9.0.0 of the agent removes several deprecated configuration options and API methods, enables Thread tracing by default, adds Fiber instrumentation, removes support for Ruby versions 2.2 and 2.3, removes instrumentation for several deprecated gems, changes how the API method `set_transaction_name` works, and updates `rails_defer_initialization` to be an environment variable only configuration option.
Expand Down
2 changes: 1 addition & 1 deletion lib/new_relic/agent/instrumentation/sidekiq/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def call(worker, msg, queue, *_)
NewRelic::Agent::Transaction.merge_untrusted_agent_attributes(msg['args'], :'job.sidekiq.args',
NewRelic::Agent::AttributeFilter::DST_NONE)

::NewRelic::Agent::DistributedTracing::accept_distributed_trace_headers(trace_headers, "Other") if ::NewRelic::Agent.config[:'distributed_tracing.enabled']
::NewRelic::Agent::DistributedTracing::accept_distributed_trace_headers(trace_headers, "Other") if ::NewRelic::Agent.config[:'distributed_tracing.enabled'] && trace_headers&.any?
yield
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ def test_captures_sidekiq_internal_errors
Sidekiq::CLI.instance.handle_exception(exception)
end

def test_accept_dt_headers_not_called_if_headers_nil
NewRelic::Agent::DistributedTracing.stubs(:insert_distributed_trace_headers)
NewRelic::Agent::DistributedTracing.expects(:accept_distributed_trace_headers).never
in_transaction do
run_jobs
end
end

def assert_metric_and_call_count(name, expected_call_count)
metric_data = $collector.calls_for('metric_data')

Expand Down