Use libhoney explicitly and group initializers (#4699) [deploy]
* Use libhoney explicitly and group initializers * Use Libhoney TestClient during tests * Use test client for Honeycomb during tests as well
This commit is contained in:
parent
5135804a60
commit
0591362756
6 changed files with 32 additions and 17 deletions
4
Envfile
4
Envfile
|
|
@ -117,8 +117,8 @@ variable :FASTLY_API_KEY, :String, default: "Optional"
|
|||
variable :FASTLY_SERVICE_ID, :String, default: "Optional"
|
||||
|
||||
# Honeycomb for monitoring and observability
|
||||
# https://www.honeycomb.io/
|
||||
variable :HONEYCOMB_API_KEY, :String, default: "Optional"
|
||||
# (https://www.honeycomb.io/)
|
||||
variable :HONEYCOMB_API_KEY, :String, default: ""
|
||||
|
||||
# Google analytic
|
||||
# (https://developers.google.com/analytics/devguides/reporting/core/v4)
|
||||
|
|
|
|||
1
Gemfile
1
Gemfile
|
|
@ -56,6 +56,7 @@ gem "inline_svg", "~> 1.5" # Embed SVG documents in your Rails views and style t
|
|||
gem "jbuilder", "~> 2.9" # Create JSON structures via a Builder-style DSL
|
||||
gem "jquery-rails", "~> 4.3" # A gem to automate using jQuery with Rails
|
||||
gem "kaminari", "~> 1.1" # A Scope & Engine based, clean, powerful, customizable and sophisticated paginator
|
||||
gem "libhoney", "~> 1.14" # Ruby gem for sending data to Honeycomb
|
||||
gem "liquid", "~> 4.0" # A secure, non-evaling end user template engine with aesthetic markup
|
||||
gem "nokogiri", "~> 1.10" # HTML, XML, SAX, and Reader parser
|
||||
gem "octokit", "~> 4.14" # Simple wrapper for the GitHub API
|
||||
|
|
|
|||
|
|
@ -930,6 +930,7 @@ DEPENDENCIES
|
|||
jquery-rails (~> 4.3)
|
||||
kaminari (~> 1.1)
|
||||
launchy (~> 2.4)
|
||||
libhoney (~> 1.14)
|
||||
liquid (~> 4.0)
|
||||
memory_profiler (~> 0.9)
|
||||
nakayoshi_fork (~> 0.0.4)
|
||||
|
|
|
|||
28
config/initializers/honeycomb.rb
Normal file
28
config/initializers/honeycomb.rb
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
if Rails.env.test?
|
||||
Honeycomb.configure do |config|
|
||||
config.client = Libhoney::TestClient.new
|
||||
end
|
||||
|
||||
HoneycombClient = Libhoney::TestClient.new
|
||||
else
|
||||
honeycomb_api_key = ApplicationConfig["HONEYCOMB_API_KEY"]
|
||||
|
||||
# Honeycomb automatic Rails integration
|
||||
Honeycomb.configure do |config|
|
||||
config.write_key = honeycomb_api_key
|
||||
config.dataset = "rails"
|
||||
config.notification_events = %w[
|
||||
sql.active_record
|
||||
render_template.action_view
|
||||
render_partial.action_view
|
||||
render_collection.action_view
|
||||
process_action.action_controller
|
||||
send_file.action_controller
|
||||
send_data.action_controller
|
||||
deliver.action_mailer
|
||||
].freeze
|
||||
end
|
||||
|
||||
# here we create an additional Honeycomb client that can be used to send custom events
|
||||
HoneycombClient = Libhoney::Client.new(writekey: honeycomb_api_key, dataset: "dev-ruby")
|
||||
end
|
||||
|
|
@ -1 +0,0 @@
|
|||
HoneycombClient = Libhoney::Client.new(writekey: ENV["HONEYCOMB_API_KEY"], dataset: 'dev-ruby')
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
Honeycomb.configure do |config|
|
||||
config.write_key = ENV["HONEYCOMB_API_KEY"]
|
||||
config.dataset = "rails"
|
||||
config.notification_events = %w[
|
||||
sql.active_record
|
||||
render_template.action_view
|
||||
render_partial.action_view
|
||||
render_collection.action_view
|
||||
process_action.action_controller
|
||||
send_file.action_controller
|
||||
send_data.action_controller
|
||||
deliver.action_mailer
|
||||
].freeze
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue