class RooOnRails::Checks::Heroku::DrainsMetrics
Checks
that the app is configured to send its logs to the Heroku-Datadog metrics bridge.
Input context
-
heroku.api_client: a connected PlatformAPI client
-
heroku.app.{env}: an existing app name.
-
heroku.metric_bridge_token.{env}: the password for the metrics bridge
Public Instance Methods
call()
click to toggle source
# File lib/roo_on_rails/checks/heroku/drains_metrics.rb, line 24 def call url = client.log_drain.list(app_name). map { |h| h['url'] }. find { |u| u.include? MetricsBridgeConfigured::BRIDGE_APP } fail! 'No matching drain found' if url.nil? final_fail! 'Misconfigured drain found' if url != drain_uri pass "Drain is connected to #{bold app_name}" end
intro()
click to toggle source
# File lib/roo_on_rails/checks/heroku/drains_metrics.rb, line 20 def intro 'Checking for metrics drain...' end
Private Instance Methods
app_name()
click to toggle source
# File lib/roo_on_rails/checks/heroku/drains_metrics.rb, line 48 def app_name context.heroku.app[env] end
client()
click to toggle source
# File lib/roo_on_rails/checks/heroku/drains_metrics.rb, line 52 def client context.heroku.api_client end
drain_uri()
click to toggle source
# File lib/roo_on_rails/checks/heroku/drains_metrics.rb, line 40 def drain_uri 'https://%s:%s@%s.herokuapp.com' % [ app_name, context.heroku.metric_bridge_token![env], MetricsBridgeConfigured::BRIDGE_APP ] end
fix()
click to toggle source
# File lib/roo_on_rails/checks/heroku/drains_metrics.rb, line 36 def fix client.log_drain.create(app_name, url: drain_uri) end