Describe the bug
Sentry.capture_message can't send a message from Rake.
This is a similar to #1324. I think message doesn't send because of process exit before send a message. A exception can be sent because sentry-ruby override display_error_message and specify background: false inside it.
|
def display_error_message(ex) |
|
Sentry.capture_exception(ex, hint: { background: false }) do |scope| |
|
task_name = top_level_tasks.join(' ') |
|
scope.set_transaction_name(task_name) |
|
scope.set_tag("rake_task", task_name) |
|
end if Sentry.initialized? && !Sentry.configuration.skip_rake_integration |
So I think this only happens in case of Sentry.capture_message` used.
To Reproduce
Add a following rake task and run it.
namespace :dummy do
desc 'Send a message Sentry'
task test_sentry: :environment do
Sentry.capture_message("Raise an exception for Sentry from Rake")
end
end
$ bin/rails dummy:test_sentry
Expected behavior
Message send our sentry project.
Actual behavior
No message is being logged.
Environment
- Ruby Version: 2.7.2
- SDK Version: 4.6.1
- Rails 6.0.3.7
Describe the bug
Sentry.capture_messagecan't send a message from Rake.This is a similar to #1324. I think message doesn't send because of process exit before send a message. A exception can be sent because
sentry-rubyoverridedisplay_error_messageand specifybackground: falseinside it.sentry-ruby/sentry-ruby/lib/sentry/rake.rb
Lines 7 to 12 in bae8c5b
So I think this only happens in case of Sentry.capture_message` used.
To Reproduce
Add a following rake task and run it.
Expected behavior
Message send our sentry project.
Actual behavior
No message is being logged.
Environment