docbrown/app/lib/forem_stats_drivers/datadog_driver.rb
Fernando Valverde cf3bde4259
Add mobile push notifications to Forem (#12419)
* First commit with iOS PN working

* RPush cleanup worker + unique jobs config

* Remove rpush tables from schema.rb

* PR feedback

* Feature flag and test for route

* Tests and feature flag PushNotification ::Send

* Update app/controllers/devices_controller.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update spec/routing/devices_routes_spec.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update spec/services/push_notifications/send_spec.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* PR feedback

* Set Rpush driver and url

* More PR feedback

* Apply suggestions from code review

Co-authored-by: Jamie Gaskins <jgaskins@gmail.com>

* PR feedback from Rhymes

* Don’t double render

* Sure

Co-authored-by: Josh Puetz <hi@joshpuetz.com>
Co-authored-by: Josh Puetz <josh@dev.to>
Co-authored-by: Michael Kohl <citizen428@dev.to>
Co-authored-by: Jamie Gaskins <jgaskins@gmail.com>
2021-03-12 14:08:18 -06:00

30 lines
1.1 KiB
Ruby

require "httpclient"
module ForemStatsDrivers
class DatadogDriver
include ActsAsForemStatsDriver
setup_driver do
Datadog.configure do |c|
c.tracer env: Rails.env
c.tracer enabled: ENV["DD_API_KEY"].present?
c.tracer partial_flush: true
c.tracer priority_sampling: true
c.use :elasticsearch
c.use :sidekiq
c.use :redis, service_name: "redis", describes: { url: ENV["REDIS_URL"] }
c.use :redis, service_name: "redis-sessions", describes: { url: ENV["REDIS_SESSIONS_URL"] }
c.use :redis, service_name: "redis-sidekiq", describes: { url: ENV["REDIS_SIDEKIQ_URL"] }
c.use :redis, service_name: "redis-rpush", describes: { url: ENV["REDIS_RPUSH_URL"] }
c.use :rails
c.use :http, split_by_domain: false
c.use :faraday, split_by_domain: true
c.use :excon, split_by_domain: true
c.use :httpclient, split_by_domain: false
c.use :httprb, split_by_domain: true
c.use :rest_client
c.use :concurrent_ruby
end
Datadog::Statsd.new
end
end
end