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

[contrib:rails] reporting controller exceptions as errors in stats #95

Merged
merged 2 commits into from
Mar 24, 2017

Conversation

ufoot
Copy link
Contributor

@ufoot ufoot commented Mar 23, 2017

No description provided.

@ufoot ufoot requested a review from palazzem March 23, 2017 17:55
@ufoot ufoot force-pushed the christian/rails500error branch from 7e39b72 to 367832c Compare March 23, 2017 17:56
@ufoot ufoot requested a review from talwai March 23, 2017 17:57
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)
Copy link
Contributor

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

Copy link
Contributor

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.

@ufoot ufoot added this to the 0.6.0 milestone Mar 23, 2017
Copy link
Contributor

@palazzem palazzem left a 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')
Copy link
Contributor

@palazzem palazzem Mar 24, 2017

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)
Copy link
Contributor

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.

@ufoot ufoot force-pushed the christian/rails500error branch from afa385a to 2aadfa5 Compare March 24, 2017 10:21
@ufoot ufoot force-pushed the christian/rails500error branch from 2aadfa5 to 60726ce Compare March 24, 2017 10:57
@ufoot ufoot merged commit 60726ce into master Mar 24, 2017
@ufoot ufoot deleted the christian/rails500error branch March 28, 2017 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants