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

Rename error_handler settings to on_error #3341

Merged
merged 15 commits into from
Dec 20, 2023
Merged

Conversation

TonyCTHsu
Copy link
Contributor

@TonyCTHsu TonyCTHsu commented Dec 19, 2023

2.0 Upgrade Guide notes

The error_handler settings have been replaced by on_error to align with the options for Datadog::Tracing.trace(options).

Changing the name in your configuration from error_handler to on_error is all that is required for most integrations.

Complete details are below.

integration changes
active_job Remove error_handler, it was never used.
delayed_job Rename error_handler to on_error
excon 1. Remove error_handler
2. Add on_error and error_status_codes
faraday 1. Remove error_handler
2. Add on_error and error_status_codes
grpc 1. Remove error_handler, server_error_handler and client_error_handler
2. Add on_error.
pg Rename error_handler to on_error
que Rename error_handler to on_error
resque Rename error_handler to on_error
shoryuken Rename error_handler to on_error
sidekiq Rename error_handler to on_error
sneakers Rename error_handler to on_error

For GRPC: on_error would be invoke on both server and client side instrumentation. Merge your server_error_handler and client_error_handler to on_error. The implementation for on_error should distinguish between the server and client.

Datadog.configure do |c|
  c.tracing.instrument :grpc, 
     on_error: proc do |span, error|
        if span.name == 'grpc.service'
           # Do something for server instrumentation
        end
        if span.name == 'grpc.client'
           # Do something for client instrumentation
        end
     end
end

For faraday and excon:

  • Remove error_handler settings
  • Configure error_status_codes to control tagging span with error, the default is 400...600 (previous only server servers are tagged.)
  • Configure on_error to control behaviour when exception is raised. For example: Faraday::ConnectionFailed/Excon::Error::Timeout

@TonyCTHsu TonyCTHsu changed the base branch from master to 2.0 December 19, 2023 14:59
@github-actions github-actions bot added integrations Involves tracing integrations tracing labels Dec 19, 2023
@TonyCTHsu TonyCTHsu marked this pull request as ready for review December 19, 2023 15:40
@TonyCTHsu TonyCTHsu requested review from a team as code owners December 19, 2023 15:40
@codecov-commenter
Copy link

codecov-commenter commented Dec 19, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c5692b8) 98.06% compared to head (807abc2) 98.09%.
Report is 4 commits behind head on 2.0.

Additional details and impacted files
@@            Coverage Diff             @@
##              2.0    #3341      +/-   ##
==========================================
+ Coverage   98.06%   98.09%   +0.03%     
==========================================
  Files        1241     1248       +7     
  Lines       72027    72129     +102     
  Branches     3395     3397       +2     
==========================================
+ Hits        70632    70757     +125     
+ Misses       1395     1372      -23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ekump
Copy link
Contributor

ekump commented Dec 19, 2023

Upgrade note suggestions:

Rename the error_handler settings to on_error to align with the options for Datadog::Tracing.trace(options) . The on_error handler is invoke when the instrumented method raises an exception.

The error_handler settings have been replaced by on_error to align with the options for Datadog::Tracing.trace(options).

For most integrations, change your configurations options from error_handler to on_error.

I would move this line above the table and change it to:

Changing the handler name in your configuration from error_handler to on_error is all that is required for most integrations. Complete details are below.

For GRPC: on_error would be invoke on both server and client side instrumentation. Merge your server_error_handler and client_error_handler to on_error. The implementation for on_error should distinguish between the span.

For GRPC: on_error will be invoked on both server and client side instrumentation. Merge your server_error_handler and client_error_handler logic to on_error. The implementation for on_error should distinguish between the span.

I'm not exactly sure what "The implementation for on_error should distinguish between the span." means?

@TonyCTHsu TonyCTHsu merged commit 2b837a1 into 2.0 Dec 20, 2023
151 checks passed
@TonyCTHsu TonyCTHsu deleted the tonycthsu/rename-on-error branch December 20, 2023 19:35
@TonyCTHsu TonyCTHsu added this to the 2.0 milestone Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.0 integrations Involves tracing integrations tracing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants