-
Notifications
You must be signed in to change notification settings - Fork 375
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
Add config support for "on_error" in Elasticsearch tracing #4066
base: master
Are you sure you want to change the base?
Add config support for "on_error" in Elasticsearch tracing #4066
Conversation
This mirrors the functionality that is already present in many other instrumenters. Reasons for wanting this: You might want to ignore some errors in some expected scenarios such as Elasticsearch::Transport::Transport::Errors::NotFound or Elasticsearch::Transport::Transport::Errors::Conflict
9398422
to
4e02912
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4066 +/- ##
=======================================
Coverage 97.72% 97.72%
=======================================
Files 1338 1338
Lines 80248 80269 +21
Branches 4016 4018 +2
=======================================
+ Hits 78420 78442 +22
+ Misses 1828 1827 -1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor feedback on tense.
docs/GettingStarted.md
Outdated
@@ -677,6 +677,7 @@ Datadog.configure_onto(client.transport, **options) | |||
| `service_name` | `DD_TRACE_ELASTICSEARCH_SERVICE_NAME` | `String` | Name of application running the `elasticsearch` instrumentation. May be overridden by `global_default_service_name`. [See _Additional Configuration_ for more details](#additional-configuration) | `elasticsearch` | | |||
| `peer_service` | `DD_TRACE_ELASTICSEARCH_PEER_SERVICE` | `String` | Name of external service the application connects to | `nil` | | |||
| `quantize` | | `Hash` | Hash containing options for quantization. May include `:show` with an Array of keys to not quantize (or `:all` to skip quantization), or `:exclude` with Array of keys to exclude entirely. | `{}` | | |||
| `on_error` | | `Proc` | Custom error handler invoked when a request raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { \|span, error\| span.set_error(error) unless span.nil? }` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `on_error` | | `Proc` | Custom error handler invoked when a request raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { \|span, error\| span.set_error(error) unless span.nil? }` | | |
| `on_error` | | `Proc` | Custom error handler invoked when a request raises an error. Provides `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { \|span, error\| span.set_error(error) unless span.nil? }` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! fixup: 1dc216f
This mirrors the functionality that is already present in many other instrumenters.
Reasons for wanting this:
One might want to ignore some errors in some expected scenarios such as
Elasticsearch::Transport::Transport::Errors::NotFound
or
Elasticsearch::Transport::Transport::Errors::Conflict
What does this PR do?
Adds
on_error
configuration support for Elasticsearch tracing and forwards it toTracing.trace
Motivation:
We have flows where
NotFound
exceptions are expected and we make sure to handle them in the application.We don't want them to show up as errors in the dashboard though.
How to test the change?
Run provided tests with
bundle exec rake test:elasticsearch