newrelic-praxis 1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +94 -0
- data/Rakefile +2 -0
- data/lib/newrelic-praxis.rb +5 -0
- data/lib/newrelic-praxis/instrumentation/praxis.rb +22 -0
- data/lib/newrelic-praxis/instrumentation/praxis_blueprints.rb +22 -0
- data/lib/newrelic-praxis/instrumentation/praxis_mapper.rb +28 -0
- data/lib/newrelic-praxis/praxis/action_event.rb +48 -0
- data/lib/newrelic-praxis/praxis/action_subscriber.rb +70 -0
- data/lib/newrelic-praxis/praxis_blueprints/render_event.rb +23 -0
- data/lib/newrelic-praxis/praxis_blueprints/render_subscriber.rb +40 -0
- data/lib/newrelic-praxis/praxis_mapper/finalize_subscriber.rb +42 -0
- data/lib/newrelic-praxis/praxis_mapper/helper.rb +23 -0
- data/lib/newrelic-praxis/praxis_mapper/load_event.rb +13 -0
- data/lib/newrelic-praxis/praxis_mapper/load_subscriber.rb +42 -0
- data/lib/newrelic-praxis/version.rb +5 -0
- data/newrelic-praxis.gemspec +31 -0
- data/screenshot.png +0 -0
- metadata +165 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9d41c5e9b007c877cda2b88973c6a5ea76d93d42
|
4
|
+
data.tar.gz: cda91b0f9bfc6a08d77582971ec752ac55b4f3eb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 787db604f4dfc0b2b7b27044422aa479bdce66dfc7515f8978b89cc0497d92a98f2e5846a585c61aaf0d0fe286d73951f2a54d75b1bb151f26d3ea8966499733
|
7
|
+
data.tar.gz: e55d5598f6c32a433489567055b12f66988f05702fa4dfcba8dc4b42eec9babdb3a950af279400d3fb1363a1f62f229cb0e7ab5e17e021fe538b9c8875c1bd48
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 RightScale
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
# Praxis New Relic Support
|
2
|
+
|
3
|
+
New Relic instrumentation for Praxis, Praxis Blueprints, and Praxis Mapper.
|
4
|
+
|
5
|
+

|
6
|
+
|
7
|
+
## Getting Started
|
8
|
+
|
9
|
+
Add the gem to your Gemfile:
|
10
|
+
```ruby
|
11
|
+
gem 'newrelic-praxis'
|
12
|
+
```
|
13
|
+
|
14
|
+
Require the gem and start the New Relic agent normally.
|
15
|
+
|
16
|
+
For example, you could use a simple initializer like `config/initializers/init_newrelic.rb`:
|
17
|
+
```ruby
|
18
|
+
require 'newrelic_rpm'
|
19
|
+
require 'newrelic-praxis'
|
20
|
+
|
21
|
+
NewRelic::Agent.manual_start
|
22
|
+
```
|
23
|
+
|
24
|
+
## What Is Instrumented
|
25
|
+
|
26
|
+
This gem provides separate instrumentation for Praxis, Praxis Blueprints, and Praxis Mapper. It uses the existing [notifications](http://praxis-framework.io/reference/plugins/notifications/) provided by Praxis where available, and injects additional New Relic-specific instrumentation to Praxis Mapper.
|
27
|
+
|
28
|
+
### Praxis
|
29
|
+
|
30
|
+
With this gem, you'll have three different traces with each request:
|
31
|
+
|
32
|
+
* `Praxis::Application#call` -- your full Praxis app, starting from the `run Praxis::Application.instance` in your `config.ru`. This will include any Rack middleware you've specified in the application configuration, not any prior to that `run`.
|
33
|
+
* `Praxis::Router#call` -- request handling inside Praxis. This includes all of the request stages (i.e. param/payload parsing, validation, the action, and etc.), with their `before`, `after`, and `around` filters.
|
34
|
+
* `ControllerClass#action_method` -- traces *just* the action code in a Controller, without including any filters. This is done by subscribing to the `'praxis.request_stage.execute'` event with `ActiveSupport::Notifications`.
|
35
|
+
|
36
|
+
|
37
|
+
### Praxis::Blueprint
|
38
|
+
|
39
|
+
Reports rendering time for all `Praxis::MediaType` views (and any other `Praxis::Blueprint` subclasses) as `:ClassName/:view_name Template` in New Relic, along with any relevant nesting when rendering related objects.
|
40
|
+
|
41
|
+
This uses the `'praxis.blueprint.render` notification.
|
42
|
+
|
43
|
+
|
44
|
+
### Praxis::Mapper
|
45
|
+
|
46
|
+
Provides three different types of instrumentaiton for `Praxis::Mapper`:
|
47
|
+
|
48
|
+
* `:ModelClass/Load` -- includes the full time and SQL statements associated with executing `IdentityMap.load(ModelClass)` query. This will include any subloads specified by `load`.
|
49
|
+
* `PraxisMapper/Finalize`-- includes the full time and SQL statements associated with executing `IdentityMap#finalize!` to retrieve any records staged by queries using `track`.
|
50
|
+
* `PraxisMapper :ModelClass select` -- Any SQL statements executed (using the Sequel query type) are instrumented as a Datastore in New Relic.
|
51
|
+
|
52
|
+
Additionally, any database interaction outside of Praxis::Mapper (i.e. `ModelClass.all` in Sequel), will use any other instrumentation supported by New Relic.
|
53
|
+
|
54
|
+
|
55
|
+
## Configuration
|
56
|
+
|
57
|
+
Simply requiring the gem, as in the `init_newrelic.rb` example above, is sufficient add all of the instrumentation when the New Relic agent starts.
|
58
|
+
|
59
|
+
You can disable specific portions of the instrumentation with the following configuration flags in your New Relic configuration (typically `newrelic.yml`):
|
60
|
+
|
61
|
+
* `disable_praxis_instrumentation` -- disables the `ControllerClass#action_method` tracing. `Praxis::Application#call` and `Praxis::Router#call` are provided by New Relic as part of its Rack instrumentation.
|
62
|
+
* `disable_praxis_blueprints_instrumentation` -- disables `:ClassName/:view_name Template` tracing for Praxis::Blueprint.
|
63
|
+
* `disable_praxis_mapper_instrumentation` -- disables all tracing for `Praxis::Mapper`.
|
64
|
+
|
65
|
+
*Note:* Disabling `Praxis::Mapper` instrumentation has no effect any other database instrumentation that may be present (i.e., the Sequel support provided by New Relic). This can be either a feature if you wish to remove the database traces from this gem and use another set, or a bug if you wish to completely disable all query tracing. Consult the New Relic documentation in the latter case for how to disable other instrumentation that may be installed.
|
66
|
+
|
67
|
+
|
68
|
+
## Mailing List
|
69
|
+
Join our Google Groups for discussion, support and announcements.
|
70
|
+
* [praxis-support](http://groups.google.com/d/forum/praxis-support) (support for people using
|
71
|
+
Praxis)
|
72
|
+
* [praxis-announce](http://groups.google.com/d/forum/praxis-announce) (announcements)
|
73
|
+
* [praxis-development](http://groups.google.com/d/forum/praxis-development) (discussion about the
|
74
|
+
development of Praxis itself)
|
75
|
+
|
76
|
+
And follow us on twitter: [@praxisapi](http://twitter.com/praxisapi)
|
77
|
+
|
78
|
+
|
79
|
+
## Contributions
|
80
|
+
Contributions to make this gem better are welcome. Please refer to
|
81
|
+
[CONTRIBUTING](https://github.com/rightscale/praxis/blob/master/CONTRIBUTING.md)
|
82
|
+
for further details on what contributions are accepted and how to go about
|
83
|
+
contributing.
|
84
|
+
|
85
|
+
|
86
|
+
## Requirements
|
87
|
+
Praxis requires Ruby 2.1.0 or greater.
|
88
|
+
|
89
|
+
|
90
|
+
## License
|
91
|
+
|
92
|
+
This software is released under the [MIT License](http://www.opensource.org/licenses/MIT). Please see [LICENSE](LICENSE) for further details.
|
93
|
+
|
94
|
+
Copyright (c) 2015 RightScale
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
DependencyDetection.defer do
|
2
|
+
named :praxis
|
3
|
+
|
4
|
+
depends_on do
|
5
|
+
defined?(::Praxis) && defined?(::Praxis::Controller)
|
6
|
+
end
|
7
|
+
|
8
|
+
depends_on do
|
9
|
+
!NewRelic::Agent.config[:disable_praxis_instrumentation]
|
10
|
+
end
|
11
|
+
|
12
|
+
executes do
|
13
|
+
::NewRelic::Agent.logger.info 'Installing Praxis instrumentation'
|
14
|
+
end
|
15
|
+
|
16
|
+
executes do
|
17
|
+
require 'newrelic-praxis/praxis/action_event'
|
18
|
+
require 'newrelic-praxis/praxis/action_subscriber'
|
19
|
+
|
20
|
+
NewRelic::Agent::Instrumentation::Praxis::ActionSubscriber.subscribe 'praxis.request_stage.execute'.freeze
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
DependencyDetection.defer do
|
2
|
+
named :praxis_blueprints
|
3
|
+
|
4
|
+
depends_on do
|
5
|
+
defined?(::Praxis) && defined?(::Praxis::Blueprint)
|
6
|
+
end
|
7
|
+
|
8
|
+
depends_on do
|
9
|
+
!NewRelic::Agent.config[:disable_praxis_blueprints_instrumentation]
|
10
|
+
end
|
11
|
+
|
12
|
+
executes do
|
13
|
+
::NewRelic::Agent.logger.info 'Installing Praxis::Blueprint instrumentation'
|
14
|
+
end
|
15
|
+
|
16
|
+
executes do
|
17
|
+
require 'newrelic-praxis/praxis_blueprints/render_event'
|
18
|
+
require 'newrelic-praxis/praxis_blueprints/render_subscriber'
|
19
|
+
|
20
|
+
NewRelic::Agent::Instrumentation::Praxis::Blueprint::RenderSubscriber.subscribe 'praxis.blueprint.render'.freeze
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
DependencyDetection.defer do
|
2
|
+
named :praxis_mapper
|
3
|
+
|
4
|
+
depends_on do
|
5
|
+
defined?(::Praxis) && defined?(::Praxis::Mapper)
|
6
|
+
end
|
7
|
+
|
8
|
+
depends_on do
|
9
|
+
!NewRelic::Agent.config[:disable_praxis_mapper_instrumentation]
|
10
|
+
end
|
11
|
+
|
12
|
+
executes do
|
13
|
+
::NewRelic::Agent.logger.info 'Installing Praxis::Mapper instrumentation'
|
14
|
+
end
|
15
|
+
|
16
|
+
executes do
|
17
|
+
require 'newrelic-praxis/praxis_mapper/helper'
|
18
|
+
require 'newrelic-praxis/praxis_mapper/load_event'
|
19
|
+
require 'newrelic-praxis/praxis_mapper/load_subscriber'
|
20
|
+
require 'newrelic-praxis/praxis_mapper/finalize_subscriber'
|
21
|
+
|
22
|
+
NewRelic::Agent::Instrumentation::Praxis::Mapper::LoadSubscriber.subscribe 'praxis.mapper.load'.freeze
|
23
|
+
NewRelic::Agent::Instrumentation::Praxis::Mapper::FinalizeSubscriber.subscribe 'praxis.mapper.finalize'.freeze
|
24
|
+
|
25
|
+
NewRelic::Agent::Instrumentation::Praxis::Mapper.instrument_praxis_mapper
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module NewRelic::Agent::Instrumentation
|
2
|
+
module Praxis
|
3
|
+
|
4
|
+
class ActionEvent < Event
|
5
|
+
attr_accessor :parent
|
6
|
+
attr_reader :queue_start, :request, :controller
|
7
|
+
|
8
|
+
def initialize(name, start, ending, transaction_id, payload, request)
|
9
|
+
# We have a different initialize parameter list, so be explicit
|
10
|
+
super(name, start, ending, transaction_id, payload)
|
11
|
+
|
12
|
+
@controller = payload[:controller]
|
13
|
+
@request = controller.request
|
14
|
+
|
15
|
+
@queue_start = QueueTime.parse_frontend_timestamp(request.env, self.time)
|
16
|
+
end
|
17
|
+
|
18
|
+
def metric_action
|
19
|
+
self.request.action.name
|
20
|
+
end
|
21
|
+
|
22
|
+
def metric_name
|
23
|
+
"Controller/#{controller.class.name}/#{metric_action}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def ignored?
|
27
|
+
_is_filtered?(ControllerInstrumentation::NR_DO_NOT_TRACE_KEY)
|
28
|
+
end
|
29
|
+
|
30
|
+
def apdex_ignored?
|
31
|
+
_is_filtered?(ControllerInstrumentation::NR_IGNORE_APDEX_KEY)
|
32
|
+
end
|
33
|
+
|
34
|
+
# hardcoded to true for Praxis, as it makes no sense for APIs
|
35
|
+
def enduser_ignored?
|
36
|
+
true
|
37
|
+
end
|
38
|
+
|
39
|
+
def _is_filtered?(key)
|
40
|
+
IgnoreActions.is_filtered?(
|
41
|
+
key,
|
42
|
+
self.controller.class,
|
43
|
+
self.metric_action)
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module NewRelic
|
2
|
+
module Agent
|
3
|
+
module Instrumentation
|
4
|
+
module Praxis
|
5
|
+
|
6
|
+
class ActionSubscriber < EventedSubscriber
|
7
|
+
|
8
|
+
def start(name, id, payload) #THREAD_LOCAL_ACCESS
|
9
|
+
state = TransactionState.tl_get
|
10
|
+
|
11
|
+
controller = payload[:controller]
|
12
|
+
request = controller.request
|
13
|
+
|
14
|
+
event = ActionEvent.new(name, Time.now, nil, id, payload, request)
|
15
|
+
push_event(event)
|
16
|
+
|
17
|
+
if state.is_execution_traced? && !event.ignored?
|
18
|
+
start_transaction(state, event)
|
19
|
+
else
|
20
|
+
# if this transaction is ignored, make sure child
|
21
|
+
# transaction are also ignored
|
22
|
+
state.current_transaction.ignore! if state.current_transaction
|
23
|
+
NewRelic::Agent.instance.push_trace_execution_flag(false)
|
24
|
+
end
|
25
|
+
rescue => e
|
26
|
+
log_notification_error(e, name, 'start')
|
27
|
+
end
|
28
|
+
|
29
|
+
def finish(name, id, payload) #THREAD_LOCAL_ACCESS
|
30
|
+
event = pop_event(id)
|
31
|
+
event.payload.merge!(payload)
|
32
|
+
|
33
|
+
state = TransactionState.tl_get
|
34
|
+
|
35
|
+
request = event.request
|
36
|
+
attributes = {:'request.parameters' => request.params_hash}
|
37
|
+
attributes.merge!(
|
38
|
+
:'request.api_version' => request.version
|
39
|
+
)
|
40
|
+
|
41
|
+
NewRelic::Agent.add_custom_attributes(attributes)
|
42
|
+
|
43
|
+
if state.is_execution_traced? && !event.ignored?
|
44
|
+
stop_transaction(state, event)
|
45
|
+
else
|
46
|
+
NewRelic::Agent.instance.pop_trace_execution_flag
|
47
|
+
end
|
48
|
+
rescue => e
|
49
|
+
log_notification_error(e, name, 'finish')
|
50
|
+
end
|
51
|
+
|
52
|
+
def start_transaction(state, event)
|
53
|
+
Transaction.start(state, :controller,
|
54
|
+
:transaction_name => event.metric_name,
|
55
|
+
:apdex_start_time => event.queue_start
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
def stop_transaction(state, event=nil)
|
60
|
+
txn = state.current_transaction
|
61
|
+
txn.ignore_apdex! if event.apdex_ignored?
|
62
|
+
txn.ignore_enduser! if event.enduser_ignored?
|
63
|
+
Transaction.stop(state)
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module NewRelic::Agent::Instrumentation
|
2
|
+
module Praxis
|
3
|
+
module Blueprint
|
4
|
+
class RenderEvent < Event
|
5
|
+
|
6
|
+
def metric_name
|
7
|
+
view_name = self.payload[:view].name
|
8
|
+
blueprint_name = self.payload[:blueprint].class.name
|
9
|
+
|
10
|
+
# mark views rendered with list of fields
|
11
|
+
if self.payload[:fields] && self.payload[:fields].any?
|
12
|
+
view_name = "#{view_name}*"
|
13
|
+
end
|
14
|
+
|
15
|
+
"View/#{blueprint_name}/#{view_name}/Rendering"
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module NewRelic
|
2
|
+
module Agent
|
3
|
+
module Instrumentation
|
4
|
+
module Praxis
|
5
|
+
module Blueprint
|
6
|
+
class RenderSubscriber < EventedSubscriber
|
7
|
+
def start(name, id, payload) #THREAD_LOCAL_ACCESS
|
8
|
+
event = RenderEvent.new(name, Time.now, nil, id, payload)
|
9
|
+
push_event(event)
|
10
|
+
|
11
|
+
state = TransactionState.tl_get
|
12
|
+
|
13
|
+
if state.is_execution_traced?
|
14
|
+
stack = state.traced_method_stack
|
15
|
+
event.frame = stack.push_frame(state, :praxis_blueprints, event.time)
|
16
|
+
end
|
17
|
+
rescue => e
|
18
|
+
log_notification_error(e, name, 'start')
|
19
|
+
end
|
20
|
+
|
21
|
+
def finish(name, id, payload) #THREAD_LOCAL_ACCESS
|
22
|
+
event = pop_event(id)
|
23
|
+
event.payload.merge!(payload)
|
24
|
+
|
25
|
+
state = TransactionState.tl_get
|
26
|
+
|
27
|
+
if state.is_execution_traced?
|
28
|
+
stack = state.traced_method_stack
|
29
|
+
stack.pop_frame(state, event.frame, event.metric_name, event.end)
|
30
|
+
end
|
31
|
+
rescue => e
|
32
|
+
log_notification_error(e, name, 'finish')
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module NewRelic
|
2
|
+
module Agent
|
3
|
+
module Instrumentation
|
4
|
+
module Praxis
|
5
|
+
module Mapper
|
6
|
+
|
7
|
+
class FinalizeSubscriber < EventedSubscriber
|
8
|
+
|
9
|
+
def start(name, id, payload) #THREAD_LOCAL_ACCESS
|
10
|
+
event = Event.new(name, Time.now, nil, id, payload)
|
11
|
+
push_event(event)
|
12
|
+
|
13
|
+
state = TransactionState.tl_get
|
14
|
+
|
15
|
+
if state.is_execution_traced?
|
16
|
+
stack = state.traced_method_stack
|
17
|
+
event.frame = stack.push_frame(state, :praxis_mapper, event.time)
|
18
|
+
end
|
19
|
+
rescue => e
|
20
|
+
log_notification_error(e, name, 'start')
|
21
|
+
end
|
22
|
+
|
23
|
+
def finish(name, id, payload) #THREAD_LOCAL_ACCESS
|
24
|
+
event = pop_event(id)
|
25
|
+
event.payload.merge!(payload)
|
26
|
+
|
27
|
+
state = TransactionState.tl_get
|
28
|
+
|
29
|
+
if state.is_execution_traced?
|
30
|
+
stack = state.traced_method_stack
|
31
|
+
stack.pop_frame(state, event.frame, 'Custom/PraxisMapper/Finalize', event.end)
|
32
|
+
end
|
33
|
+
rescue => e
|
34
|
+
log_notification_error(e, name, 'finish')
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module NewRelic::Agent::Instrumentation
|
2
|
+
module Praxis
|
3
|
+
module Mapper
|
4
|
+
|
5
|
+
def self.instrument_praxis_mapper
|
6
|
+
::Praxis::Mapper::Query::Sequel.class_eval do
|
7
|
+
|
8
|
+
alias_method :_execute_without_newrelic, :_execute
|
9
|
+
def _execute(ds=nil)
|
10
|
+
rows = nil
|
11
|
+
NewRelic::Agent::Datastores.wrap("PraxisMapper", "select", self.model.name) do
|
12
|
+
NewRelic::Agent.disable_all_tracing do
|
13
|
+
rows = _execute_without_newrelic(ds)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
rows
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module NewRelic
|
2
|
+
module Agent
|
3
|
+
module Instrumentation
|
4
|
+
module Praxis
|
5
|
+
module Mapper
|
6
|
+
|
7
|
+
class LoadSubscriber < EventedSubscriber
|
8
|
+
|
9
|
+
def start(name, id, payload) #THREAD_LOCAL_ACCESS
|
10
|
+
event = LoadEvent.new(name, Time.now, nil, id, payload)
|
11
|
+
push_event(event)
|
12
|
+
|
13
|
+
state = TransactionState.tl_get
|
14
|
+
|
15
|
+
if state.is_execution_traced?
|
16
|
+
stack = state.traced_method_stack
|
17
|
+
event.frame = stack.push_frame(state, :praxis_mapper, event.time)
|
18
|
+
end
|
19
|
+
rescue => e
|
20
|
+
log_notification_error(e, name, 'start')
|
21
|
+
end
|
22
|
+
|
23
|
+
def finish(name, id, payload) #THREAD_LOCAL_ACCESS
|
24
|
+
event = pop_event(id)
|
25
|
+
event.payload.merge!(payload)
|
26
|
+
|
27
|
+
state = TransactionState.tl_get
|
28
|
+
|
29
|
+
if state.is_execution_traced?
|
30
|
+
stack = state.traced_method_stack
|
31
|
+
stack.pop_frame(state, event.frame, event.metric_name, event.end)
|
32
|
+
end
|
33
|
+
rescue => e
|
34
|
+
log_notification_error(e, name, 'finish')
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
require 'newrelic-praxis/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "newrelic-praxis"
|
8
|
+
spec.version = Praxis::NewRelic::VERSION
|
9
|
+
spec.authors = ["Josep M. Blanquer","Dane Jensen"]
|
10
|
+
spec.summary = %q{New Relic plugin for Praxis.}
|
11
|
+
spec.email = ["blanquer@gmail.com","dane.jensen@gmail.com"]
|
12
|
+
|
13
|
+
spec.homepage = "https://github.com/rightscale/newrelic-praxis"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">=2.1"
|
16
|
+
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
spec.files = `git ls-files -z`.split("\x0")
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'praxis', [">= 0.18"]
|
22
|
+
spec.add_runtime_dependency 'praxis-blueprints', [">= 2.2"]
|
23
|
+
spec.add_runtime_dependency 'praxis-mapper', [">= 4.1"]
|
24
|
+
|
25
|
+
spec.add_runtime_dependency 'newrelic_rpm', [">= 3.13"]
|
26
|
+
spec.add_runtime_dependency 'activesupport', [">= 3"]
|
27
|
+
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
29
|
+
spec.add_development_dependency "rake", "~> 0"
|
30
|
+
|
31
|
+
end
|
data/screenshot.png
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: newrelic-praxis
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.0'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Josep M. Blanquer
|
8
|
+
- Dane Jensen
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-09-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: praxis
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0.18'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0.18'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: praxis-blueprints
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '2.2'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '2.2'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: praxis-mapper
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '4.1'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '4.1'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: newrelic_rpm
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '3.13'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '3.13'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: activesupport
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '3'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '3'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: bundler
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '1.6'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '1.6'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: rake
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
description:
|
113
|
+
email:
|
114
|
+
- blanquer@gmail.com
|
115
|
+
- dane.jensen@gmail.com
|
116
|
+
executables: []
|
117
|
+
extensions: []
|
118
|
+
extra_rdoc_files: []
|
119
|
+
files:
|
120
|
+
- ".gitignore"
|
121
|
+
- CHANGELOG.md
|
122
|
+
- Gemfile
|
123
|
+
- LICENSE
|
124
|
+
- README.md
|
125
|
+
- Rakefile
|
126
|
+
- lib/newrelic-praxis.rb
|
127
|
+
- lib/newrelic-praxis/instrumentation/praxis.rb
|
128
|
+
- lib/newrelic-praxis/instrumentation/praxis_blueprints.rb
|
129
|
+
- lib/newrelic-praxis/instrumentation/praxis_mapper.rb
|
130
|
+
- lib/newrelic-praxis/praxis/action_event.rb
|
131
|
+
- lib/newrelic-praxis/praxis/action_subscriber.rb
|
132
|
+
- lib/newrelic-praxis/praxis_blueprints/render_event.rb
|
133
|
+
- lib/newrelic-praxis/praxis_blueprints/render_subscriber.rb
|
134
|
+
- lib/newrelic-praxis/praxis_mapper/finalize_subscriber.rb
|
135
|
+
- lib/newrelic-praxis/praxis_mapper/helper.rb
|
136
|
+
- lib/newrelic-praxis/praxis_mapper/load_event.rb
|
137
|
+
- lib/newrelic-praxis/praxis_mapper/load_subscriber.rb
|
138
|
+
- lib/newrelic-praxis/version.rb
|
139
|
+
- newrelic-praxis.gemspec
|
140
|
+
- screenshot.png
|
141
|
+
homepage: https://github.com/rightscale/newrelic-praxis
|
142
|
+
licenses:
|
143
|
+
- MIT
|
144
|
+
metadata: {}
|
145
|
+
post_install_message:
|
146
|
+
rdoc_options: []
|
147
|
+
require_paths:
|
148
|
+
- lib
|
149
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '2.1'
|
154
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
requirements: []
|
160
|
+
rubyforge_project:
|
161
|
+
rubygems_version: 2.4.5.1
|
162
|
+
signing_key:
|
163
|
+
specification_version: 4
|
164
|
+
summary: New Relic plugin for Praxis.
|
165
|
+
test_files: []
|