Module: NewRelic

Defined in:
lib/new_relic/rack.rb,
lib/newrelic_rpm.rb,
lib/newrelic_rpm.rb,
lib/new_relic/agent.rb,
lib/new_relic/build.rb,
lib/new_relic/coerce.rb,
lib/new_relic/helper.rb,
lib/new_relic/okjson.rb,
lib/new_relic/command.rb,
lib/new_relic/control.rb,
lib/new_relic/metrics.rb,
lib/new_relic/version.rb,
lib/new_relic/timer_lib.rb,
lib/new_relic/agent/agent.rb,
lib/new_relic/agent/stats.rb,
lib/new_relic/metric_data.rb,
lib/new_relic/agent/thread.rb,
lib/new_relic/agent/sampler.rb,
lib/new_relic/agent/database.rb,
lib/new_relic/latest_changes.rb,
lib/new_relic/agent/autostart.rb,
lib/new_relic/agent/shim_agent.rb,
lib/new_relic/agent/null_logger.rb,
lib/new_relic/agent/sql_sampler.rb,
lib/new_relic/agent/system_info.rb,
lib/new_relic/agent/transaction.rb,
lib/new_relic/agent/worker_loop.rb,
lib/new_relic/collection_helper.rb,
lib/new_relic/control/profiling.rb,
lib/new_relic/local_environment.rb,
lib/new_relic/agent/agent_logger.rb,
lib/new_relic/agent/audit_logger.rb,
lib/new_relic/agent/pipe_service.rb,
lib/new_relic/agent/rules_engine.rb,
lib/new_relic/agent/stats_engine.rb,
lib/new_relic/control/frameworks.rb,
lib/new_relic/environment_report.rb,
lib/new_relic/transaction_sample.rb,
lib/new_relic/agent/configuration.rb,
lib/new_relic/agent/method_tracer.rb,
lib/new_relic/rack/developer_mode.rb,
lib/new_relic/transaction_analysis.rb,
lib/new_relic/agent/busy_calculator.rb,
lib/new_relic/agent/error_collector.rb,
lib/new_relic/agent/instrumentation.rb,
lib/new_relic/agent/thread_profiler.rb,
lib/new_relic/agent/transaction/pop.rb,
lib/new_relic/control/class_methods.rb,
lib/new_relic/delayed_job_injection.rb,
lib/new_relic/agent/transaction_info.rb,
lib/new_relic/control/server_methods.rb,
lib/new_relic/agent/cross_app_monitor.rb,
lib/new_relic/agent/cross_app_tracing.rb,
lib/new_relic/agent/new_relic_service.rb,
lib/new_relic/control/frameworks/merb.rb,
lib/new_relic/control/frameworks/ruby.rb,
lib/new_relic/control/instrumentation.rb,
lib/new_relic/agent/browser_monitoring.rb,
lib/new_relic/agent/sampler_collection.rb,
lib/new_relic/control/frameworks/rails.rb,
lib/new_relic/control/instance_methods.rb,
lib/new_relic/agent/transaction_sampler.rb,
lib/new_relic/control/frameworks/rails3.rb,
lib/new_relic/control/frameworks/rails4.rb,
lib/new_relic/agent/beacon_configuration.rb,
lib/new_relic/agent/instrumentation/rack.rb,
lib/new_relic/agent/pipe_channel_manager.rb,
lib/new_relic/agent/samplers/cpu_sampler.rb,
lib/new_relic/control/frameworks/sinatra.rb,
lib/new_relic/transaction_sample/segment.rb,
lib/new_relic/agent/configuration/manager.rb,
lib/new_relic/agent/http_clients/uri_util.rb,
lib/new_relic/agent/stats_engine/samplers.rb,
lib/new_relic/control/frameworks/external.rb,
lib/new_relic/agent/configuration/defaults.rb,
lib/new_relic/agent/instrumentation/sinatra.rb,
lib/new_relic/agent/samplers/memory_sampler.rb,
lib/new_relic/agent/samplers/object_sampler.rb,
lib/new_relic/agent/stats_engine/stats_hash.rb,
lib/new_relic/agent/instrumentation/memcache.rb,
lib/new_relic/agent/stats_engine/gc_profiler.rb,
lib/new_relic/agent/configuration/yaml_source.rb,
lib/new_relic/agent/stats_engine/metric_stats.rb,
lib/new_relic/agent/stats_engine/transactions.rb,
lib/new_relic/transaction_sample/fake_segment.rb,
lib/new_relic/agent/instrumentation/queue_time.rb,
lib/new_relic/agent/transaction_sample_builder.rb,
lib/new_relic/agent/configuration/mask_defaults.rb,
lib/new_relic/agent/configuration/server_source.rb,
lib/new_relic/agent/http_clients/excon_wrappers.rb,
lib/new_relic/agent/instrumentation/data_mapper.rb,
lib/new_relic/agent/instrumentation/acts_as_solr.rb,
lib/new_relic/agent/instrumentation/metric_frame.rb,
lib/new_relic/agent/samplers/delayed_job_sampler.rb,
lib/new_relic/transaction_sample/summary_segment.rb,
lib/new_relic/agent/instrumentation/active_record.rb,
lib/new_relic/agent/instrumentation/rails3/errors.rb,
lib/new_relic/agent/instrumentation/rails4/errors.rb,
lib/new_relic/agent/http_clients/net_http_wrappers.rb,
lib/new_relic/agent/http_clients/typhoeus_wrappers.rb,
lib/new_relic/transaction_analysis/segment_summary.rb,
lib/new_relic/transaction_sample/composite_segment.rb,
lib/new_relic/agent/instrumentation/sinatra/ignorer.rb,
lib/new_relic/agent/configuration/environment_source.rb,
lib/new_relic/agent/instrumentation/evented_subscriber.rb,
lib/new_relic/agent/instrumentation/active_record_helper.rb,
lib/new_relic/agent/instrumentation/action_view_subscriber.rb,
lib/new_relic/agent/instrumentation/active_record_subscriber.rb,
lib/new_relic/agent/instrumentation/rails3/action_controller.rb,
lib/new_relic/agent/instrumentation/rails4/action_controller.rb,
lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb,
lib/new_relic/agent/instrumentation/browser_monitoring_timings.rb,
lib/new_relic/agent/instrumentation/controller_instrumentation.rb,
lib/new_relic/agent/instrumentation/action_controller_subscriber.rb

Overview

This file is distributed under New Relic’s license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.

Defined Under Namespace

Modules: Agent, Coerce, CollectionHelper, DelayedJobInjection, Helper, Instrumentation, LanguageSupport, LatestChanges, Metrics, OkJson, Rack, TransactionAnalysis, VERSION Classes: ChainedCall, Command, Control, EnvironmentReport, LocalEnvironment, MerbBootLoader, MetricData, MetricSpec, NoticedError, Railtie, TransactionSample, UrlRule, VersionNumber

Constant Summary collapse

MYSQL_EXPLAIN_COLUMNS =

columns for a mysql explain plan

[
 "Id",
 "Select Type",
 "Table",
 "Type",
 "Possible Keys",
 "Key",
 "Key Length",
 "Ref",
 "Rows",
 "Extra"
].freeze
COLLAPSE_SEGMENTS_THRESHOLD =

the number of segments that need to exist before we roll them up into one segment with multiple executions

2

Class Method Summary collapse

Class Method Details

.json_dumpObject

.json_loadObject

.load_okjsonObject

Load the fallback JSON library



62
63
64
65
66
# File 'lib/new_relic/helper.rb', line 62

def self::load_okjson
  require 'new_relic/okjson'
  define_method( :json_dump, &::NewRelic::OkJson.method(:encode) )
  define_method( :json_load, &::NewRelic::OkJson.method(:decode) )
end

.load_stdlib_jsonObject

Load the JSON library from the standard library.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/new_relic/helper.rb', line 45

def self::load_stdlib_json
  # Don't even try to use 1.9.1's json.
  return false if RUBY_VERSION == '1.9.1'

  require 'json'
  define_method( :json_dump, &::JSON.method(:dump) )
  define_method( :json_load, &::JSON.method(:parse) )

  return true
rescue LoadError
  NewRelic::Agent.logger.debug "%p while loading JSON library: %s" % [ err, err.message ] if
    defined?( NewRelic::Agent ) && NewRelic::Agent.respond_to?( :logger )
  return false
end