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

Prevent action_controller tracing when disabled #2027

Merged
merged 1 commit into from
May 26, 2022
Merged

Prevent action_controller tracing when disabled #2027

merged 1 commit into from
May 26, 2022

Conversation

ahorner
Copy link
Contributor

@ahorner ahorner commented May 17, 2022

In environments where tracing is disabled, Datadog spits out a lot of
unnecessary error logs here, due to the instrumentation assuming that
there's an active trace to maintain.

This fix is in the same vein as #1943 and #1945.

E, [2022-05-17T22:15:02.337370 #2639] ERROR -- ddtrace: [ddtrace] (/home/circleci/tmp/vendor/bundle/ruby/3.1.0/gems/ddtrace-1.0.0/lib/datadog/tracing/contrib/action_pack/action_controller/instrumentation.rb:43:in `rescue in start_processing') undefined method `resource=' for nil:NilClass

              trace.resource = span.resource
                   ^^^^^^^^^^^
E, [2022-05-17T22:15:02.340414 #2639] ERROR -- ddtrace: [ddtrace] (/home/circleci/tmp/vendor/bundle/ruby/3.1.0/gems/ddtrace-1.0.0/lib/datadog/tracing/contrib/action_pack/action_controller/instrumentation.rb:79:in `rescue in finish_processing') undefined method `resource=' for nil:NilClass

                trace.resource = span.resource
                     ^^^^^^^^^^^

In environments where tracing is disabled, Datadog spits out a lot of
unnecessary error logs here, due to the instrumentation assuming that
there's an active trace to maintain.

This fix is in the same vein as #1943 and #1945.

```
E, [2022-05-17T22:15:02.337370 #2639] ERROR -- ddtrace: [ddtrace] (/home/circleci/tmp/vendor/bundle/ruby/3.1.0/gems/ddtrace-1.0.0/lib/datadog/tracing/contrib/action_pack/action_controller/instrumentation.rb:43:in `rescue in start_processing') undefined method `resource=' for nil:NilClass

              trace.resource = span.resource
                   ^^^^^^^^^^^
E, [2022-05-17T22:15:02.340414 #2639] ERROR -- ddtrace: [ddtrace] (/home/circleci/tmp/vendor/bundle/ruby/3.1.0/gems/ddtrace-1.0.0/lib/datadog/tracing/contrib/action_pack/action_controller/instrumentation.rb:79:in `rescue in finish_processing') undefined method `resource=' for nil:NilClass

                trace.resource = span.resource
                     ^^^^^^^^^^^
```
@ahorner ahorner requested a review from a team May 17, 2022 23:22
@ahorner
Copy link
Contributor Author

ahorner commented May 17, 2022

I'm reasonably certain the build failures are unrelated to the contents of this PR; both the 3.1 and 3.2 builds appear to have been killed while installing appraisal gems.

Copy link
Member

@marcotc marcotc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much, @ahorner!

@ivoanjo
Copy link
Member

ivoanjo commented Jul 11, 2022

👋 @ahorner this change has been released in v1.2.0.
Thank you so very much for the awesome bugfix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Was opened by a community member integrations Involves tracing integrations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants