newrelic-manticore 0.1.1.rc1-java → 0.1.1.rc2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Changelog.md +4 -0
- data/lib/new_relic/manticore/instrumentation.rb +47 -16
- data/lib/newrelic/manticore/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a90206bab165ef353e02a1584fce0aff9c3194737eb25e4add978320da5cbe65
|
4
|
+
data.tar.gz: 2d8fde246e4b9269e310910e4a2a25ba68b8a3f66b2039bb5ba000a4efd0743c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a61432c09b74eb8828ce728d3e21c83f2b79b965a9c468f9ad29836235f65e517900e217ad46fdc1f62c57821b2805f5a8a6c17ec60fac690e2f7c985bfac1a8
|
7
|
+
data.tar.gz: 8df4a94cccf09d2129c6646f9c856a98dba70288a7cbeada550be95f5681e52793577ad627c31747b6cda7a2e78535ca199a1f6426f8acbbb87c42783ff40af5
|
data/.rubocop.yml
CHANGED
data/Changelog.md
CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [0.1.1] - 2018-10-09
|
8
|
+
### Fixed
|
9
|
+
Time spent inside Manticore requests inside database calls where not included in the exclusive time stats of the database request
|
10
|
+
|
7
11
|
## [0.1.0] - 2018-10-09
|
8
12
|
### Added
|
9
13
|
Basic manticore instrumentation
|
@@ -10,6 +10,25 @@ require "new_relic/manticore/wrapped_response"
|
|
10
10
|
|
11
11
|
module NewRelic
|
12
12
|
module Manticore
|
13
|
+
# We do not want to create a segment if there is no newrelic
|
14
|
+
# transaction or if we are inside a database segment.
|
15
|
+
#
|
16
|
+
# An external call segment inside a database segment would
|
17
|
+
# deduct the time needed in manticore from the database call,
|
18
|
+
# which we want to be the total time needed for the database
|
19
|
+
# operation
|
20
|
+
def self.create_segment?
|
21
|
+
state = NewRelic::Agent::TransactionState.tl_get
|
22
|
+
return false unless state && state.current_transaction
|
23
|
+
|
24
|
+
existing_segments = state.current_transaction.segments
|
25
|
+
|
26
|
+
existing_segments.empty? ||
|
27
|
+
!existing_segments.last.is_a?(
|
28
|
+
::NewRelic::Agent::Transaction::DatastoreSegment
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
13
32
|
# rubocop:disable Metrics/BlockLength
|
14
33
|
DependencyDetection.defer do
|
15
34
|
@name = :manticore
|
@@ -31,38 +50,50 @@ module NewRelic
|
|
31
50
|
)
|
32
51
|
|
33
52
|
::Manticore::Client.class_eval do
|
53
|
+
# This is called for parallel requests that are executed in
|
54
|
+
# a batch
|
55
|
+
#
|
56
|
+
# rubocop:disable Metrics/MethodLength
|
34
57
|
def execute_with_newrelic_trace!
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
58
|
+
if NewRelic::Manticore.create_segment?
|
59
|
+
segment = NewRelic::Agent::External.start_segment(
|
60
|
+
library: "Manticore",
|
61
|
+
uri: @async_requests.first.request.uri.to_s,
|
62
|
+
procedure: "Parallel batch"
|
63
|
+
)
|
64
|
+
segment.add_request_headers(PARALLEL_REQUEST_DUMMY)
|
65
|
+
end
|
41
66
|
execute_without_newrelic_trace!
|
42
67
|
ensure
|
43
|
-
segment.finish if segment
|
68
|
+
segment.finish if defined?(segment) && segment
|
44
69
|
end
|
70
|
+
# rubocop:enable Metrics/MethodLength
|
45
71
|
|
46
72
|
alias_method :execute_without_newrelic_trace!, :execute!
|
47
73
|
alias_method :execute!, :execute_with_newrelic_trace!
|
48
74
|
end
|
49
75
|
|
50
76
|
::Manticore::Response.class_eval do
|
77
|
+
# This is called for every request, also parallel and async
|
78
|
+
# requests.
|
79
|
+
#
|
51
80
|
# rubocop:disable Metrics/MethodLength
|
52
81
|
def call_with_newrelic_trace
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
82
|
+
if NewRelic::Manticore.create_segment?
|
83
|
+
segment = create_newrelic_segment
|
84
|
+
|
85
|
+
segment.add_request_headers(WrappedRequest.new(@request))
|
86
|
+
on_complete do |response|
|
87
|
+
begin
|
88
|
+
segment.read_response_headers(WrappedResponse.new(response))
|
89
|
+
ensure
|
90
|
+
segment.finish
|
91
|
+
end
|
61
92
|
end
|
62
93
|
end
|
63
94
|
call_without_newrelic_trace
|
64
95
|
rescue StandardError => e
|
65
|
-
segment.finish if segment
|
96
|
+
segment.finish if defined?(segment) && segment
|
66
97
|
raise e
|
67
98
|
end
|
68
99
|
# rubocop:enable Metrics/MethodLength
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic-manticore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.1.
|
4
|
+
version: 0.1.1.rc2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Dominik Goltermann
|
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
197
|
version: 1.3.1
|
198
198
|
requirements: []
|
199
199
|
rubyforge_project:
|
200
|
-
rubygems_version: 2.6
|
200
|
+
rubygems_version: 2.7.6
|
201
201
|
signing_key:
|
202
202
|
specification_version: 4
|
203
203
|
summary: Newrelic support for manticore
|