Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Agent release 2.8.1

  • Loading branch information...
commit dc44a05cfb9bdc924c200bff26910abca81d49b2 1 parent a4e5fd1
meixue authored
View
2  lib/new_relic/config.rb
@@ -170,7 +170,7 @@ def local_env
# This will NOT print anything if the environment is unknown because this is
# probably not an environment the agent will be running in.
def log!(msg, level=:info)
- return if !tracers_enabled?
+ return if @settings && !tracers_enabled?
to_stderr msg
log.send level, msg if log
end
View
71 lib/new_relic/recipes.rb
@@ -0,0 +1,71 @@
+# When installed as a plugin this is loaded automatically.
+#
+# When installed as a gem, you need to add
+# require 'new_relic/recipes'
+# to your deploy.rb
+#
+# Defined deploy:notify_rpm which will send information about the deploy to RPM.
+# The task will run on app servers except where no_release is true.
+# If it fails, it will not affect the task execution or do a rollback.
+#
+make_notify_task = lambda do
+
+ namespace :newrelic do
+
+ # on all deployments, notify RPM
+ desc "Record a deployment in New Relic RPM (rpm.newrelic.com)"
+ task :notice_deployment, :roles => :app, :except => {:no_release => true } do
+ rails_env = fetch(:rails_env, "production")
+ begin
+ require File.join(File.dirname(__FILE__), 'commands', 'deployments.rb')
+ # Try getting the changelog from the server. Then fall back to local changelog
+ # if it doesn't work. Problem is that I don't know what directory the .git is
+ # in when using git. I could possibly use the remote cache but i don't know
+ # if that's always there.
+=begin
+ run "cd #{current_release}; #{log_command}" do | io, stream_id, output |
+ changelog = output
+ end
+=end
+ # allow overrides to be defined for revision, description, changelog and appname
+ rev = fetch(:newrelic_revision) if exists?(:newrelic_revision)
+ description = fetch(:newrelic_desc) if exists?(:newrelic_desc)
+ changelog = fetch(:newrelic_changelog) if exists?(:newrelic_changelog)
+ appname = fetch(:newrelic_appname) if exists?(:newrelic_appname)
+ if !changelog
+ logger.debug "Getting log of changes for New Relic Deployment details"
+ from_revision = source.next_revision(current_revision)
+ log_command = "#{source.log(from_revision)}"
+ changelog = `#{log_command}`
+ end
+ new_revision = rev || source.query_revision(source.head()) { |cmd| `#{cmd}` }
+ deploy_options = { :environment => rails_env,
+ :revision => new_revision,
+ :changelog => changelog,
+ :description => description,
+ :appname => appname }
+ logger.debug "Uploading deployment to New Relic"
+ deployment = NewRelic::Commands::Deployments.new deploy_options
+ deployment.run
+ logger.info "Uploaded deployment information to New Relic"
+ rescue ScriptError => e
+ logger.info "error creating New Relic deployment (#{e})\n#{e.backtrace.join("\n")}"
+ rescue NewRelic::Commands::CommandFailure => e
+ logger.info "unable to notify New Relic of the deployment (#{e})... skipping"
+ rescue CommandError
+ logger.info "unable to notify New Relic of the deployment... skipping"
+ end
+ # WIP: For rollbacks, let's update the deployment we created with an indication of the failure:
+ # on_rollback do
+ # run(...)
+ # end
+ end
+ end
+end
+
+instance = Capistrano::Configuration.instance
+if instance
+ instance.load &make_notify_task
+else
+ make_notify_task.call
+end
View
4 lib/new_relic/shim_agent.rb
@@ -1,4 +1,4 @@
-#require 'new_relic/stats'
+require 'new_relic/stats'
# This agent is loaded by the plug when the plug-in is disabled
# It recreates just enough of the API to not break any clients that
@@ -28,7 +28,7 @@ module NewRelic
module Agent
class << self
- @@dummy_stats = MethodTraceStats.new
+ @@dummy_stats = NewRelic::MethodTraceStats.new
def agent
NewRelic::Agent::Agent.instance
end
View
1  lib/new_relic/version.rb
@@ -18,6 +18,7 @@ def self.changes
is symlinked to /usr/bin. Usage: newrelic_cmd deployments --help
* Fix issue invoking api when host is not set in newrelic.yml
* Fix deployments api so it will work from a gem
+ * Fix thin incompatibility in developer mode
2008-12-18 version 2.8.0
* add beta of api in new_relic_api.rb
* instrumented dynamic finders in ActiveRecord
View
6 newrelic_rpm.gemspec
@@ -6,18 +6,18 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Bill Kayser"]
- s.date = %q{2009-01-27}
+ s.date = %q{2009-01-29}
s.default_executable = %q{newrelic_cmd}
s.description = %q{New Relic Ruby Performance Monitoring Agent}
s.email = %q{bkayser@newrelic.com}
s.executables = ["newrelic_cmd"]
s.extra_rdoc_files = ["README", "LICENSE"]
- s.files = ["install.rb", "LICENSE", "README", "newrelic.yml", "Rakefile", "lib/new_relic", "lib/new_relic/agent", "lib/new_relic/agent/agent.rb", "lib/new_relic/agent/chained_call.rb", "lib/new_relic/agent/collection_helper.rb", "lib/new_relic/agent/error_collector.rb", "lib/new_relic/agent/instrumentation", "lib/new_relic/agent/instrumentation/active_record_instrumentation.rb", "lib/new_relic/agent/instrumentation/controller_instrumentation.rb", "lib/new_relic/agent/instrumentation/data_mapper.rb", "lib/new_relic/agent/instrumentation/dispatcher_instrumentation.rb", "lib/new_relic/agent/instrumentation/memcache.rb", "lib/new_relic/agent/instrumentation/merb", "lib/new_relic/agent/instrumentation/merb/controller.rb", "lib/new_relic/agent/instrumentation/merb/dispatcher.rb", "lib/new_relic/agent/instrumentation/merb/errors.rb", "lib/new_relic/agent/instrumentation/rails", "lib/new_relic/agent/instrumentation/rails/action_controller.rb", "lib/new_relic/agent/instrumentation/rails/action_web_service.rb", "lib/new_relic/agent/instrumentation/rails/dispatcher.rb", "lib/new_relic/agent/instrumentation/rails/errors.rb", "lib/new_relic/agent/instrumentation/rails/rails.rb", "lib/new_relic/agent/method_tracer.rb", "lib/new_relic/agent/patch_const_missing.rb", "lib/new_relic/agent/samplers", "lib/new_relic/agent/samplers/cpu.rb", "lib/new_relic/agent/samplers/memory.rb", "lib/new_relic/agent/samplers/mongrel.rb", "lib/new_relic/agent/stats_engine.rb", "lib/new_relic/agent/synchronize.rb", "lib/new_relic/agent/transaction_sampler.rb", "lib/new_relic/agent/worker_loop.rb", "lib/new_relic/agent.rb", "lib/new_relic/commands", "lib/new_relic/commands/deployments.rb", "lib/new_relic/commands/new_relic_commands.rb", "lib/new_relic/config", "lib/new_relic/config/merb.rb", "lib/new_relic/config/rails.rb", "lib/new_relic/config/ruby.rb", "lib/new_relic/config.rb", "lib/new_relic/local_environment.rb", "lib/new_relic/merbtasks.rb", "lib/new_relic/metric_data.rb", "lib/new_relic/metric_spec.rb", "lib/new_relic/metrics.rb", "lib/new_relic/noticed_error.rb", "lib/new_relic/shim_agent.rb", "lib/new_relic/stats.rb", "lib/new_relic/transaction_analysis.rb", "lib/new_relic/transaction_sample.rb", "lib/new_relic/version.rb", "lib/new_relic_api.rb", "lib/newrelic_rpm.rb", "lib/tasks", "lib/tasks/agent_tests.rake", "lib/tasks/all.rb", "lib/tasks/install.rake", "bin/newrelic_cmd", "recipes/newrelic.rb", "test/config", "test/config/newrelic.yml", "test/config/test_config.rb", "test/new_relic", "test/new_relic/agent", "test/new_relic/agent/mock_ar_connection.rb", "test/new_relic/agent/mock_scope_listener.rb", "test/new_relic/agent/model_fixture.rb", "test/new_relic/agent/tc_active_record.rb", "test/new_relic/agent/tc_agent.rb", "test/new_relic/agent/tc_collection_helper.rb", "test/new_relic/agent/tc_controller.rb", "test/new_relic/agent/tc_dispatcher_instrumentation.rb", "test/new_relic/agent/tc_error_collector.rb", "test/new_relic/agent/tc_method_tracer.rb", "test/new_relic/agent/tc_stats_engine.rb", "test/new_relic/agent/tc_synchronize.rb", "test/new_relic/agent/tc_transaction_sample.rb", "test/new_relic/agent/tc_transaction_sample_builder.rb", "test/new_relic/agent/tc_transaction_sampler.rb", "test/new_relic/agent/tc_worker_loop.rb", "test/new_relic/agent/testable_agent.rb", "test/new_relic/tc_config.rb", "test/new_relic/tc_deployments_api.rb", "test/new_relic/tc_environment.rb", "test/new_relic/tc_metric_spec.rb", "test/new_relic/tc_shim_agent.rb", "test/new_relic/tc_stats.rb", "test/test_helper.rb", "test/ui", "test/ui/tc_newrelic_helper.rb", "ui/controllers", "ui/controllers/newrelic_controller.rb", "ui/helpers", "ui/helpers/google_pie_chart.rb", "ui/helpers/newrelic_helper.rb", "ui/views", "ui/views/layouts", "ui/views/layouts/newrelic_default.rhtml", "ui/views/newrelic", "ui/views/newrelic/_explain_plans.rhtml", "ui/views/newrelic/_sample.rhtml", "ui/views/newrelic/_segment.rhtml", "ui/views/newrelic/_segment_row.rhtml", "ui/views/newrelic/_show_sample_detail.rhtml", "ui/views/newrelic/_show_sample_sql.rhtml", "ui/views/newrelic/_show_sample_summary.rhtml", "ui/views/newrelic/_sql_row.rhtml", "ui/views/newrelic/_stack_trace.rhtml", "ui/views/newrelic/_table.rhtml", "ui/views/newrelic/explain_sql.rhtml", "ui/views/newrelic/images", "ui/views/newrelic/images/arrow-close.png", "ui/views/newrelic/images/arrow-open.png", "ui/views/newrelic/images/blue_bar.gif", "ui/views/newrelic/images/gray_bar.gif", "ui/views/newrelic/index.rhtml", "ui/views/newrelic/javascript", "ui/views/newrelic/javascript/transaction_sample.js", "ui/views/newrelic/sample_not_found.rhtml", "ui/views/newrelic/show_sample.rhtml", "ui/views/newrelic/show_source.rhtml", "ui/views/newrelic/stylesheets", "ui/views/newrelic/stylesheets/style.css"]
+ s.files = ["install.rb", "LICENSE", "README", "newrelic.yml", "Rakefile", "lib/new_relic", "lib/new_relic/agent", "lib/new_relic/agent/agent.rb", "lib/new_relic/agent/chained_call.rb", "lib/new_relic/agent/collection_helper.rb", "lib/new_relic/agent/error_collector.rb", "lib/new_relic/agent/instrumentation", "lib/new_relic/agent/instrumentation/active_record_instrumentation.rb", "lib/new_relic/agent/instrumentation/controller_instrumentation.rb", "lib/new_relic/agent/instrumentation/data_mapper.rb", "lib/new_relic/agent/instrumentation/dispatcher_instrumentation.rb", "lib/new_relic/agent/instrumentation/memcache.rb", "lib/new_relic/agent/instrumentation/merb", "lib/new_relic/agent/instrumentation/merb/controller.rb", "lib/new_relic/agent/instrumentation/merb/dispatcher.rb", "lib/new_relic/agent/instrumentation/merb/errors.rb", "lib/new_relic/agent/instrumentation/rails", "lib/new_relic/agent/instrumentation/rails/action_controller.rb", "lib/new_relic/agent/instrumentation/rails/action_web_service.rb", "lib/new_relic/agent/instrumentation/rails/dispatcher.rb", "lib/new_relic/agent/instrumentation/rails/errors.rb", "lib/new_relic/agent/instrumentation/rails/rails.rb", "lib/new_relic/agent/method_tracer.rb", "lib/new_relic/agent/patch_const_missing.rb", "lib/new_relic/agent/samplers", "lib/new_relic/agent/samplers/cpu.rb", "lib/new_relic/agent/samplers/memory.rb", "lib/new_relic/agent/samplers/mongrel.rb", "lib/new_relic/agent/stats_engine.rb", "lib/new_relic/agent/synchronize.rb", "lib/new_relic/agent/transaction_sampler.rb", "lib/new_relic/agent/worker_loop.rb", "lib/new_relic/agent.rb", "lib/new_relic/commands", "lib/new_relic/commands/deployments.rb", "lib/new_relic/commands/new_relic_commands.rb", "lib/new_relic/config", "lib/new_relic/config/merb.rb", "lib/new_relic/config/rails.rb", "lib/new_relic/config/ruby.rb", "lib/new_relic/config.rb", "lib/new_relic/local_environment.rb", "lib/new_relic/merbtasks.rb", "lib/new_relic/metric_data.rb", "lib/new_relic/metric_spec.rb", "lib/new_relic/metrics.rb", "lib/new_relic/noticed_error.rb", "lib/new_relic/recipes.rb", "lib/new_relic/shim_agent.rb", "lib/new_relic/stats.rb", "lib/new_relic/transaction_analysis.rb", "lib/new_relic/transaction_sample.rb", "lib/new_relic/version.rb", "lib/new_relic_api.rb", "lib/newrelic_rpm.rb", "lib/tasks", "lib/tasks/agent_tests.rake", "lib/tasks/all.rb", "lib/tasks/install.rake", "bin/newrelic_cmd", "recipes/newrelic.rb", "test/config", "test/config/newrelic.yml", "test/config/test_config.rb", "test/new_relic", "test/new_relic/agent", "test/new_relic/agent/mock_ar_connection.rb", "test/new_relic/agent/mock_scope_listener.rb", "test/new_relic/agent/model_fixture.rb", "test/new_relic/agent/tc_active_record.rb", "test/new_relic/agent/tc_agent.rb", "test/new_relic/agent/tc_collection_helper.rb", "test/new_relic/agent/tc_controller.rb", "test/new_relic/agent/tc_dispatcher_instrumentation.rb", "test/new_relic/agent/tc_error_collector.rb", "test/new_relic/agent/tc_method_tracer.rb", "test/new_relic/agent/tc_stats_engine.rb", "test/new_relic/agent/tc_synchronize.rb", "test/new_relic/agent/tc_transaction_sample.rb", "test/new_relic/agent/tc_transaction_sample_builder.rb", "test/new_relic/agent/tc_transaction_sampler.rb", "test/new_relic/agent/tc_worker_loop.rb", "test/new_relic/agent/testable_agent.rb", "test/new_relic/tc_config.rb", "test/new_relic/tc_deployments_api.rb", "test/new_relic/tc_environment.rb", "test/new_relic/tc_metric_spec.rb", "test/new_relic/tc_shim_agent.rb", "test/new_relic/tc_stats.rb", "test/test_helper.rb", "test/ui", "test/ui/tc_newrelic_helper.rb", "ui/controllers", "ui/controllers/newrelic_controller.rb", "ui/helpers", "ui/helpers/google_pie_chart.rb", "ui/helpers/newrelic_helper.rb", "ui/views", "ui/views/layouts", "ui/views/layouts/newrelic_default.rhtml", "ui/views/newrelic", "ui/views/newrelic/_explain_plans.rhtml", "ui/views/newrelic/_sample.rhtml", "ui/views/newrelic/_segment.rhtml", "ui/views/newrelic/_segment_row.rhtml", "ui/views/newrelic/_show_sample_detail.rhtml", "ui/views/newrelic/_show_sample_sql.rhtml", "ui/views/newrelic/_show_sample_summary.rhtml", "ui/views/newrelic/_sql_row.rhtml", "ui/views/newrelic/_stack_trace.rhtml", "ui/views/newrelic/_table.rhtml", "ui/views/newrelic/explain_sql.rhtml", "ui/views/newrelic/images", "ui/views/newrelic/images/arrow-close.png", "ui/views/newrelic/images/arrow-open.png", "ui/views/newrelic/images/blue_bar.gif", "ui/views/newrelic/images/gray_bar.gif", "ui/views/newrelic/index.rhtml", "ui/views/newrelic/javascript", "ui/views/newrelic/javascript/transaction_sample.js", "ui/views/newrelic/sample_not_found.rhtml", "ui/views/newrelic/show_sample.rhtml", "ui/views/newrelic/show_source.rhtml", "ui/views/newrelic/stylesheets", "ui/views/newrelic/stylesheets/style.css"]
s.has_rdoc = true
s.homepage = %q{http://www.newrelic.com}
s.require_paths = ["lib"]
s.rubyforge_project = %q{newrelic}
- s.rubygems_version = %q{1.3.1}
+ s.rubygems_version = %q{1.3.0}
s.summary = %q{New Relic Ruby Performance Monitoring Agent}
if s.respond_to? :specification_version then
View
71 recipes/newrelic.rb
@@ -1,67 +1,6 @@
-# To be included in Capistrano deploy.rb files
-#
-# Defined deploy:notify_rpm which will send information about the deploy to RPM.
-# The task will run on app servers except where no_release is true.
-# If it fails, it will not affect the task execution or do a rollback.
-#
+# The capistrano recipes in plugins are automatically
+# loaded from here. From gems, they are available from
+# the lib directory. We have to make them available from
+# both locations
-make_notify_task = lambda do
-
- namespace :newrelic do
-
- # on all deployments, notify RPM
- desc "Record a deployment in New Relic RPM (rpm.newrelic.com)"
- task :notice_deployment, :roles => :app, :except => {:no_release => true } do
- rails_env = fetch(:rails_env, "production")
- begin
- require File.expand_path(File.join(File.dirname(__FILE__),'../lib/new_relic/commands/deployments.rb'))
- # Try getting the changelog from the server. Then fall back to local changelog
- # if it doesn't work. Problem is that I don't know what directory the .git is
- # in when using git.
-=begin
- run "cd #{current_release}; #{log_command}" do | io, stream_id, output |
- changelog = output
- end
-=end
- # allow overrides to be defined for revision, description, changelog and appname
- rev = fetch(:newrelic_revision) if exists?(:newrelic_revision)
- description = fetch(:newrelic_desc) if exists?(:newrelic_desc)
- changelog = fetch(:newrelic_changelog) if exists?(:newrelic_changelog)
- appname = fetch(:newrelic_appname) if exists?(:newrelic_appname)
- if !changelog
- logger.debug "Getting log of changes for New Relic Deployment details"
- from_revision = source.next_revision(current_revision)
- log_command = "#{source.log(from_revision)}"
- changelog = `#{log_command}`
- end
- new_revision = rev || source.query_revision(source.head()) { |cmd| `#{cmd}` }
- deploy_options = { :environment => rails_env,
- :revision => new_revision,
- :changelog => changelog,
- :description => description,
- :appname => appname }
- logger.debug "Uploading deployment to New Relic"
- deployment = NewRelic::Commands::Deployments.new deploy_options
- deployment.run
- logger.info "Uploaded deployment information to New Relic"
- rescue ScriptError => e
- logger.info "error creating New Relic deployment (#{e})\n#{e.backtrace.join("\n")}"
- rescue NewRelic::Commands::CommandFailure => e
- logger.info "unable to notify New Relic of the deployment (#{e})... skipping"
- rescue CommandError
- logger.info "unable to notify New Relic of the deployment... skipping"
- end
- # WIP: For rollbacks, let's update the deployment we created with an indication of the failure:
- # on_rollback do
- # run(...)
- # end
- end
- end
-end
-
-instance = Capistrano::Configuration.instance
-if instance
- instance.load make_notify_task
-else
- make_notify_task.call
-end
+require File.join(File.dirname(__FILE__),'..','lib','new_relic','recipes')
View
2  ui/controllers/newrelic_controller.rb
@@ -150,7 +150,7 @@ def forward_to_file(root_path, content_type='ignored anyway')
:last_modified => last_modified,
:type => 'text/plain'
else
- response.headers['Last-Modified'] = last_modified
+ response.headers['Last-Modified'] = last_modified.to_formatted_s(:rfc822)
expires_in 24.hours
send_file file, :content_type => mime_type_from_extension(file), :disposition => 'inline' #, :filename => File.basename(file)
end
Please sign in to comment.
Something went wrong with that request. Please try again.