-
Notifications
You must be signed in to change notification settings - Fork 373
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
[contrib:rails] reporting controller exceptions as errors in stats #95
Conversation
7e39b72
to
367832c
Compare
span.set_tag(Datadog::Ext::HTTP::STATUS_CODE, payload.fetch(:status, '?').to_s) | ||
status = payload.fetch(:status, '?').to_s | ||
span.status = 1 if status.starts_with?('50') | ||
span.set_tag(Datadog::Ext::HTTP::STATUS_CODE, status) |
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.
is it possible for us to include a stacktrace in either of these clauses? This is consistent with what we do in span.set_error https://github.com/DataDog/dd-trace-rb/blob/master/lib/ddtrace/span.rb#L89
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.
Agree, that was missing. Using set_error
should be enough.
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 changes and it should be OK.
@@ -51,15 +51,17 @@ def self.process_action(_name, start, finish, _id, payload) | |||
if payload[:exception].nil? | |||
# [christian] in some cases :status is not defined, | |||
# rather than firing an error, simply acknowledge we don't know it. | |||
span.set_tag(Datadog::Ext::HTTP::STATUS_CODE, payload.fetch(:status, '?').to_s) | |||
status = payload.fetch(:status, '?').to_s | |||
span.status = 1 if status.starts_with?('50') |
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.
we can have more 5xx errors:
511 Network Authentication Required
520 Web server is returning an unknown error
522 Connection timed out
524 A timeout occurred
I think you can:
status = payload.fetch(:status, '?') # assuming status is integer
span.status = 1 if status.between?(500,599)
span.set_tag(Datadog::Ext::HTTP::STATUS_CODE, status.to_s)
span.set_tag(Datadog::Ext::HTTP::STATUS_CODE, payload.fetch(:status, '?').to_s) | ||
status = payload.fetch(:status, '?').to_s | ||
span.status = 1 if status.starts_with?('50') | ||
span.set_tag(Datadog::Ext::HTTP::STATUS_CODE, status) |
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.
Agree, that was missing. Using set_error
should be enough.
afa385a
to
2aadfa5
Compare
2aadfa5
to
60726ce
Compare
No description provided.