mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-19 19:55:16 +00:00
Add honeybadger to compare to sentry
This commit is contained in:
parent
9d35bd3ad3
commit
c289d710f0
9 changed files with 70 additions and 5 deletions
2
Gemfile
2
Gemfile
|
|
@ -39,6 +39,8 @@ gem "solid_cable"
|
|||
gem "stackprof"
|
||||
gem "sentry-ruby"
|
||||
gem "sentry-rails"
|
||||
# Trying out sentry alternative
|
||||
gem "honeybadger"
|
||||
|
||||
gem "good_job"
|
||||
|
||||
|
|
|
|||
|
|
@ -213,6 +213,9 @@ GEM
|
|||
groupdate (6.6.0)
|
||||
activesupport (>= 7.1)
|
||||
hashie (5.0.0)
|
||||
honeybadger (5.28.0)
|
||||
logger
|
||||
ostruct
|
||||
http (5.2.0)
|
||||
addressable (~> 2.8)
|
||||
base64 (~> 0.1)
|
||||
|
|
@ -554,6 +557,7 @@ DEPENDENCIES
|
|||
flamegraph
|
||||
geocoder
|
||||
good_job
|
||||
honeybadger
|
||||
http
|
||||
importmap-rails
|
||||
jbuilder
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
class ApplicationController < ActionController::Base
|
||||
before_action :set_paper_trail_whodunnit
|
||||
before_action :honeybadger_context, if: :current_user
|
||||
before_action :initialize_cache_counters
|
||||
before_action :try_rack_mini_profiler_enable
|
||||
after_action :track_action
|
||||
|
|
@ -17,6 +18,14 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
private
|
||||
|
||||
def honeybadger_context
|
||||
Honeybadger.context(
|
||||
user_id: current_user.id,
|
||||
user_agent: request.user_agent,
|
||||
ip_address: request.remote_ip,
|
||||
)
|
||||
end
|
||||
|
||||
def track_action
|
||||
ahoy.track "Ran action", request.path_parameters
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ class SessionsController < ApplicationController
|
|||
|
||||
if params[:error].present?
|
||||
Rails.logger.error "Slack OAuth error: #{params[:error]}"
|
||||
redirect_to root_path, alert: "Failed to authenticate with Slack"
|
||||
uuid = Honeybadger.notify("Slack OAuth error: #{params[:error]}")
|
||||
redirect_to root_path, alert: "Failed to authenticate with Slack. Error ID: #{uuid}"
|
||||
return
|
||||
end
|
||||
|
||||
|
|
@ -64,7 +65,8 @@ class SessionsController < ApplicationController
|
|||
|
||||
if params[:error].present?
|
||||
Rails.logger.error "GitHub OAuth error: #{params[:error]}"
|
||||
redirect_to my_settings_path, alert: "Failed to authenticate with GitHub"
|
||||
uuid = Honeybadger.notify("GitHub OAuth error: #{params[:error]}")
|
||||
redirect_to my_settings_path, alert: "Failed to authenticate with GitHub. Error ID: #{uuid}"
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
|||
30
config/honeybadger.yml
Normal file
30
config/honeybadger.yml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
# For more options, see https://docs.honeybadger.io/lib/ruby/gem-reference/configuration
|
||||
|
||||
api_key: 'hbp_IET1u9vKrC7IWjt45arAsfguTrGSFR1bSxEq'
|
||||
|
||||
# The environment your app is running in.
|
||||
env: "<%= Rails.env %>"
|
||||
|
||||
# The absolute path to your project folder.
|
||||
root: "<%= Rails.root.to_s %>"
|
||||
|
||||
# Honeybadger won't report errors in these environments.
|
||||
development_environments:
|
||||
- test
|
||||
- development
|
||||
- cucumber
|
||||
|
||||
# By default, Honeybadger won't report errors in the development_environments.
|
||||
# You can override this by explicitly setting report_data to true or false.
|
||||
# report_data: true
|
||||
|
||||
# The current Git revision of your project. Defaults to the last commit hash.
|
||||
# revision: null
|
||||
|
||||
# Enable verbose debug logging (useful for troubleshooting).
|
||||
debug: false
|
||||
|
||||
# Enable Honeybadger Insights
|
||||
insights:
|
||||
enabled: true
|
||||
|
|
@ -113,6 +113,11 @@
|
|||
describing what you did to get here? Please make sure the current URL
|
||||
is visible in the screenshot.<br><br>
|
||||
</p>
|
||||
<p class="error-id">
|
||||
<b>Error ID:</b><span class="error-id-text"
|
||||
onclick="navigator.clipboard.writeText(this.textContent); this.textContent = 'copied!'"><!-- HONEYBADGER ERROR --></span>
|
||||
(click to copy)
|
||||
</p>
|
||||
</article>
|
||||
</main>
|
||||
|
||||
|
|
|
|||
|
|
@ -113,6 +113,11 @@
|
|||
describing what you did to get here? Please make sure the current URL
|
||||
is visible in the screenshot.<br><br>
|
||||
</p>
|
||||
<p class="error-id">
|
||||
<b>Error ID:</b><span class="error-id-text"
|
||||
onclick="navigator.clipboard.writeText(this.textContent); this.textContent = 'copied!'"><!-- HONEYBADGER ERROR --></span>
|
||||
(click to copy)
|
||||
</p>
|
||||
</article>
|
||||
</main>
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -112,6 +112,11 @@
|
|||
describing what you did to get here? Please make sure the current URL
|
||||
is visible in the screenshot.<br><br>
|
||||
</p>
|
||||
<p class="error-id">
|
||||
<b>Error ID:</b><span class="error-id-text"
|
||||
onclick="navigator.clipboard.writeText(this.textContent); this.textContent = 'copied!'"><!-- HONEYBADGER ERROR --></span>
|
||||
(click to copy)
|
||||
</p>
|
||||
</article>
|
||||
</main>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue