-
Notifications
You must be signed in to change notification settings - Fork 14
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
Allow capture of error class when job fails #33
Allow capture of error class when job fails #33
Conversation
This gem captures failed jobs with the jobs_failed_total metric, but does not provide a way to add a label for the error class, which can be useful. This commit allows developers to optionally include a label with the error class on the jobs_failed_total metric.
Woops meant to make this on my fork! |
But why not here? 😄 |
Soon! |
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.
I believe implementation could be simpler and less flexible.
Also you need to specify new tag key at metric registration time.
if (config_value = Yabeda::Sidekiq.config.label_for_error_class_on_sidekiq_jobs_failed) | ||
label = if config_value.is_a?(Symbol) || config_value.is_a?(String) | ||
config_value | ||
else | ||
DEFAULT_JOB_FAILED_ERROR_LABEL_KEY | ||
end | ||
sidekiq_jobs_failed_labels[label] = e.class.name | ||
end |
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.
Why is that flexibility needed? Wouldn't just error
tag be enough?
if (config_value = Yabeda::Sidekiq.config.label_for_error_class_on_sidekiq_jobs_failed) | |
label = if config_value.is_a?(Symbol) || config_value.is_a?(String) | |
config_value | |
else | |
DEFAULT_JOB_FAILED_ERROR_LABEL_KEY | |
end | |
sidekiq_jobs_failed_labels[label] = e.class.name | |
end | |
if Yabeda::Sidekiq.config.label_for_error_class_on_sidekiq_jobs_failed | |
sidekiq_jobs_failed_labels[:error] = e.class.name | |
end |
This gem captures failed jobs with the jobs_failed_total metric, but does not provide a way to add a label for the error class, which can be useful. This commit allows developers to optionally include a label with the error class on the jobs_failed_total metric.