From e461956a971b389af97134824a8543f6897d8992 Mon Sep 17 00:00:00 2001 From: Maxwell Salzberg Date: Fri, 20 Jan 2012 12:25:05 -0800 Subject: [PATCH] allow custom app_name prefixes for newrelic --- app/models/app_config.rb | 4 ++++ config/application.yml.example | 2 +- config/newrelic.yml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/app_config.rb b/app/models/app_config.rb index 40866429a..4f1deb544 100644 --- a/app/models/app_config.rb +++ b/app/models/app_config.rb @@ -94,6 +94,10 @@ HELP File.exists?(File.join(Rails.root, "config", "app.yml")) || (File.exists?(File.join(Rails.root, "config", "app_config.yml"))) end + def self.new_relic_app_name + self[:new_relic_app_name] || self[:pod_uri].host + end + def self.normalize_pod_url unless self[:pod_url] =~ /^(https?:\/\/)/ # starts with http:// or https:// self[:pod_url] = "http://#{self[:pod_url]}" diff --git a/config/application.yml.example b/config/application.yml.example index 1b1dd6f7a..f9780de6f 100644 --- a/config/application.yml.example +++ b/config/application.yml.example @@ -114,7 +114,7 @@ defaults: &defaults # Miscellaneous NEW_RELIC_LICENSE_KEY: '' - + new_relic_app_name: '' # If set to true Diaspora will work with just the appserver, thin by default, # running, however this makes it quite slow as all the time intensive jobs diff --git a/config/newrelic.yml b/config/newrelic.yml index dda7e7d15..a254b0457 100644 --- a/config/newrelic.yml +++ b/config/newrelic.yml @@ -33,7 +33,7 @@ common: &default_settings # "All UI" then specify a semicolon-separated list of up to three # distinct names. If you comment this out, it defaults to the # capitalized RAILS_ENV (i.e., Production, Staging, etc) - app_name: <%= AppConfig[:pod_uri].host%> + app_name: <%= AppConfig.new_relic_app_name %> # When "true", the agent collects performance data about your # application and reports this data to the New Relic service at