Skip to content

Commit

Permalink
Merge pull request #1899 from ruby-agent/dev
Browse files Browse the repository at this point in the history
Merge dev to release for 6.4 release
  • Loading branch information
rklein authored and GitHub Enterprise committed May 21, 2019
2 parents 7bb7531 + ffa92be commit 10f881e
Show file tree
Hide file tree
Showing 49 changed files with 429 additions and 1,514 deletions.
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ branches:
- dev
- release

notifications:
webhooks: http://notifitron.herokuapp.com/
on_success: always
on_failure: always

rvm:
# Run slowest builds first to try and optimize overall cycle time.
- jruby-9.2.6.0
Expand Down
44 changes: 44 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
# New Relic Ruby Agent Release Notes #

## v6.4.0

* **Custom Metadata Collection**

The agent now collects environment variables prefixed by `NEW_RELIC_METADATA_`. These
may be added to transaction events to provide context between your Kubernetes cluster
and your services. For details on the behavior, see
[this blog post](https://blog.newrelic.com/engineering/monitoring-application-performance-in-kubernetes/).

* **Bugfix for faster ActiveRecord connection resolution**

Version 6.3.0 of the agent backported the faster ActiveRecord connection resolution
from Rails 6.0 to previous versions, but the implementation caused certain other gems
which measured ActiveRecord performance to stop working. This version of the agent
changes the implementation of this performance improvement so no such conflicts occur.

* **Bugfix for Grape instrumentation error**

Previous versions of the agent would fail to install Grape instrumentation in Grape
versions 1.2.0 and up if the API being instrumented subclassed `Grape::API::Instance`
rather than `Grape::API`. A warning would also print to the newrelic_agent log:
```
WARN : Error in Grape instrumentation
WARN : NoMethodError: undefined method `name' for nil:NilClass
```

This version of the agent successfully installs instrumentation for subclasses
of `Grape::API::Instance`, and these log messages should no longer appear.

* **Bugfix for streaming responses**

Previous versions of the agent would attempt to insert JavaScript instrumentation into
any streaming response that did not make use of `ActionController::Live`. This resulted
in an empty, non-streamed response being sent to the client.

This version of the agent will not attempt to insert JavaScript instrumentation into
a response which includes the header `Transfer-Encoding=chunked`, which indicates a
streaming response.

This should exclude JavaScript instrumentation for all streamed responses. To include
this instrumentation manually, see
[Manually instrument via agent API](https://docs.newrelic.com/docs/agents/ruby-agent/features/new-relic-browser-ruby-agent#manual_instrumentation)
in our documentation.

## v6.3.0

* **Official Rails 6.0 support**
Expand Down
23 changes: 2 additions & 21 deletions lib/new_relic/agent/commands/agent_command_router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# like the ThreadProfiler, so it's simpler to just keep it together here.

require 'new_relic/agent/commands/agent_command'
require 'new_relic/agent/commands/xray_session_collection'
require 'new_relic/agent/threading/backtrace_service'

module NewRelic
Expand All @@ -18,20 +17,17 @@ module Commands
class AgentCommandRouter
attr_reader :handlers

attr_accessor :thread_profiler_session, :backtrace_service,
:xray_session_collection
attr_accessor :thread_profiler_session, :backtrace_service

def initialize(event_listener=nil)
@handlers = Hash.new { |*| Proc.new { |cmd| self.unrecognized_agent_command(cmd) } }

@backtrace_service = Threading::BacktraceService.new(event_listener)

@thread_profiler_session = ThreadProfilerSession.new(@backtrace_service)
@xray_session_collection = XraySessionCollection.new(@backtrace_service, event_listener)

@handlers['start_profiler'] = Proc.new { |cmd| thread_profiler_session.handle_start_command(cmd) }
@handlers['stop_profiler'] = Proc.new { |cmd| thread_profiler_session.handle_stop_command(cmd) }
@handlers['active_xray_sessions'] = Proc.new { |cmd| xray_session_collection.handle_active_xray_sessions(cmd) }

if event_listener
event_listener.subscribe(:before_shutdown, &method(:on_before_shutdown))
Expand All @@ -45,20 +41,10 @@ def new_relic_service
def check_for_and_handle_agent_commands
commands = get_agent_commands

stop_xray_sessions unless active_xray_command?(commands)

results = invoke_commands(commands)
new_relic_service.agent_command_results(results) unless results.empty?
end

def stop_xray_sessions
self.xray_session_collection.stop_all_sessions
end

def active_xray_command?(commands)
commands.any? {|command| command.name == 'active_xray_sessions'}
end

def on_before_shutdown(*args)
if self.thread_profiler_session.running?
self.thread_profiler_session.stop(true)
Expand All @@ -67,7 +53,6 @@ def on_before_shutdown(*args)

def harvest!
profiles = []
profiles += harvest_from_xray_session_collection
profiles += harvest_from_thread_profiler_session
log_profiles(profiles)
profiles
Expand All @@ -76,14 +61,10 @@ def harvest!
# We don't currently support merging thread profiles that failed to send
# back into the AgentCommandRouter, so we just no-op this method.
# Same with reset! - we don't support asynchronous cancellation of a
# running thread profile or X-Ray session currently.
# running thread profile currently.
def merge!(*args); end
def reset!; end

def harvest_from_xray_session_collection
self.xray_session_collection.harvest_thread_profiles
end

def harvest_from_thread_profiler_session
if self.thread_profiler_session.ready_to_harvest?
self.thread_profiler_session.stop(true)
Expand Down
55 changes: 0 additions & 55 deletions lib/new_relic/agent/commands/xray_session.rb

This file was deleted.

161 changes: 0 additions & 161 deletions lib/new_relic/agent/commands/xray_session_collection.rb

This file was deleted.

30 changes: 1 addition & 29 deletions lib/new_relic/agent/configuration/default_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1171,35 +1171,7 @@ def self.convert_to_constant_list(raw_value)
:allowed_from_server => true,
:description => 'If <code>true</code>, enables use of the <a href="https://docs.newrelic.com/docs/apm/applications-menu/events/thread-profiler-tool">thread profiler</a>.'
},
:'xray_session.enabled' => {
:default => true,
:public => true,
:type => Boolean,
:allowed_from_server => true,
:description => 'If <code>true</code>, enables <a href="https://docs.newrelic.com/docs/apm/transactions-menu/x-ray-sessions/x-ray-sessions">X-Ray sessions</a>.'
},
:'xray_session.allow_traces' => {
:default => true,
:public => false,
:type => Boolean,
:allowed_from_server => true,
:description => 'Enable or disable X-Ray sessions recording transaction traces.'
},
:'xray_session.allow_profiles' => {
:default => true,
:public => false,
:type => Boolean,
:allowed_from_server => true,
:description => 'Enable or disable X-Ray sessions taking thread profiles.'
},
:'xray_session.max_samples' => {
:default => 10,
:public => false,
:type => Integer,
:allowed_from_server => true,
:description => 'Maximum number of transaction traces to buffer for active X-Ray sessions'
},
:'xray_session.max_profile_overhead' => {
:'thread_profiler.max_profile_overhead' => {
:default => 0.05,
:public => false,
:type => Float,
Expand Down

0 comments on commit 10f881e

Please sign in to comment.