newrelic_rpm 9.1.0 → 9.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -65
- data/.simplecov +1 -0
- data/Brewfile +1 -0
- data/CHANGELOG.md +14 -0
- data/Guardfile +1 -0
- data/bin/newrelic +1 -0
- data/bin/newrelic_cmd +1 -0
- data/lib/new_relic/agent/configuration/default_source.rb +3 -27
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +3 -3
- data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/bunny.rb +1 -1
- data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +1 -0
- data/lib/new_relic/agent/instrumentation/elasticsearch/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +1 -0
- data/lib/new_relic/agent/instrumentation/elasticsearch.rb +1 -1
- data/lib/new_relic/agent/instrumentation/fiber/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/fiber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc/client/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc/client/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc/client/request_wrapper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc_client.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc_server.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +3 -1
- data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +3 -1
- data/lib/new_relic/agent/instrumentation/memcache.rb +2 -2
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +1 -0
- data/lib/new_relic/agent/method_tracer.rb +1 -1
- data/lib/new_relic/agent/new_relic_service.rb +0 -1
- data/lib/new_relic/agent/sampler.rb +1 -0
- data/lib/new_relic/agent/transaction/abstract_segment.rb +45 -39
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +7 -8
- data/lib/new_relic/version.rb +1 -1
- data/lib/tasks/coverage_report.rake +1 -1
- data/lib/tasks/instrumentation_generator/instrumentation.thor +8 -8
- data/lib/tasks/instrumentation_generator/templates/chain.tt +1 -1
- data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +1 -1
- data/lib/tasks/multiverse.rb +1 -0
- data/lib/tasks/newrelic.rb +1 -0
- data/newrelic.yml +3 -3
- metadata +73 -4
- data/lib/new_relic/agent/range_extensions.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1eb606235173b437a2991d23d5f23b7715ab8025263f134f11454dcadf0bac9e
|
4
|
+
data.tar.gz: 4e468d079bd47f57a7dd2185039dc15f29a139e278b5d133a5a0b08e301f85f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11835787018b19326041e1f10f8a72befeb8ba9345e793ceb30e4cbd57b6ffa678da13f833fe05f17148b8beb6e9e77f4dc2ab7eda573ecc4aa62060e71ee05b
|
7
|
+
data.tar.gz: 1f0e60f9d9aef77edd656a6cc55b7e735cfbaf6a7006ed0724303b52d9cbb71bc740899de335ff45bece28f551bb0053a3077fee65863d5c355666c323150ac0
|
data/.rubocop.yml
CHANGED
@@ -6,7 +6,7 @@ require:
|
|
6
6
|
# Default performance configurations: https://github.com/rubocop/rubocop-performance/blob/master/config/default.yml
|
7
7
|
- rubocop-performance
|
8
8
|
# Default rake configurations: https://github.com/rubocop/rubocop-rake/blob/master/config/default.yml
|
9
|
-
|
9
|
+
- rubocop-rake
|
10
10
|
|
11
11
|
AllCops:
|
12
12
|
TargetRubyVersion: 2.7
|
@@ -239,10 +239,6 @@ Layout/ClosingParenthesisIndentation:
|
|
239
239
|
Layout/CommentIndentation:
|
240
240
|
Enabled: true
|
241
241
|
|
242
|
-
# Disabling for now
|
243
|
-
Layout/ConditionPosition:
|
244
|
-
Enabled: false
|
245
|
-
|
246
242
|
Layout/DefEndAlignment:
|
247
243
|
Enabled: true
|
248
244
|
EnforcedStyleAlignWith: start_of_line
|
@@ -261,19 +257,9 @@ Layout/EmptyComment:
|
|
261
257
|
AllowBorderComment: true
|
262
258
|
AllowMarginComment: true
|
263
259
|
|
264
|
-
# Disabling for now
|
265
|
-
Layout/EmptyLineAfterMagicComment:
|
266
|
-
Enabled: false
|
267
|
-
|
268
260
|
Layout/EmptyLineAfterMultilineCondition:
|
269
261
|
Enabled: false
|
270
262
|
|
271
|
-
# Disabling for now
|
272
|
-
Layout/EmptyLineBetweenDefs:
|
273
|
-
Enabled: false
|
274
|
-
# AllowAdjacentOneLineDefs: false
|
275
|
-
# NumberOfEmptyLines: 1
|
276
|
-
|
277
263
|
Layout/EmptyLines:
|
278
264
|
Enabled: true
|
279
265
|
|
@@ -362,10 +348,6 @@ Layout/HashAlignment:
|
|
362
348
|
Layout/HeredocArgumentClosingParenthesis:
|
363
349
|
Enabled: false
|
364
350
|
|
365
|
-
# Disabling for now
|
366
|
-
Layout/HeredocIndentation:
|
367
|
-
Enabled: false
|
368
|
-
|
369
351
|
Layout/IndentationConsistency:
|
370
352
|
Enabled: true
|
371
353
|
EnforcedStyle: normal
|
@@ -505,11 +487,6 @@ Layout/SpaceBeforeFirstArg:
|
|
505
487
|
Layout/SpaceBeforeSemicolon:
|
506
488
|
Enabled: true
|
507
489
|
|
508
|
-
# Disabling for now
|
509
|
-
Layout/SpaceInLambdaLiteral:
|
510
|
-
Enabled: false
|
511
|
-
# EnforcedStyle: require_no_space
|
512
|
-
|
513
490
|
Layout/SpaceInsideArrayLiteralBrackets:
|
514
491
|
Enabled: true
|
515
492
|
EnforcedStyle: no_space
|
@@ -533,10 +510,6 @@ Layout/SpaceInsideParens:
|
|
533
510
|
Enabled: true
|
534
511
|
EnforcedStyle: no_space
|
535
512
|
|
536
|
-
# Disabling for now
|
537
|
-
Layout/SpaceInsidePercentLiteralDelimiters:
|
538
|
-
Enabled: false
|
539
|
-
|
540
513
|
Layout/SpaceInsideRangeLiteral:
|
541
514
|
Enabled: true
|
542
515
|
|
@@ -563,40 +536,24 @@ Lint/AmbiguousAssignment:
|
|
563
536
|
Lint/AmbiguousBlockAssociation:
|
564
537
|
Enabled: false
|
565
538
|
|
566
|
-
# Disabling for now
|
567
|
-
Lint/AmbiguousOperator:
|
568
|
-
Enabled: false
|
569
|
-
|
570
539
|
Lint/AmbiguousOperatorPrecedence:
|
571
540
|
Enabled: false
|
572
541
|
|
573
542
|
Lint/AmbiguousRange:
|
574
543
|
Enabled: false
|
575
544
|
|
576
|
-
# Disabling for now
|
577
|
-
Lint/AmbiguousRegexpLiteral:
|
578
|
-
Enabled: false
|
579
|
-
|
580
|
-
# Disabling for now
|
581
545
|
Lint/AssignmentInCondition:
|
582
546
|
Enabled: false
|
583
|
-
# AllowSafeAssignment: true
|
584
547
|
|
585
548
|
Lint/BigDecimalNew:
|
586
549
|
Enabled: true
|
587
550
|
|
588
|
-
# Disabling for now
|
589
551
|
Lint/BinaryOperatorWithIdenticalOperands:
|
590
552
|
Enabled: false
|
591
553
|
|
592
|
-
# Disabling for now
|
593
|
-
Lint/BooleanSymbol:
|
594
|
-
Enabled: false
|
595
|
-
|
596
554
|
Lint/CircularArgumentReference:
|
597
555
|
Enabled: true
|
598
556
|
|
599
|
-
# Disabling for now
|
600
557
|
Lint/ConstantDefinitionInBlock:
|
601
558
|
Enabled: false
|
602
559
|
|
@@ -606,10 +563,6 @@ Lint/ConstantResolution:
|
|
606
563
|
Lint/Debugger:
|
607
564
|
Enabled: true
|
608
565
|
|
609
|
-
# Disabling for now
|
610
|
-
Lint/DeprecatedClassMethods:
|
611
|
-
Enabled: false
|
612
|
-
|
613
566
|
Lint/DeprecatedConstants:
|
614
567
|
Enabled: true
|
615
568
|
|
@@ -622,20 +575,12 @@ Lint/DisjunctiveAssignmentInConstructor:
|
|
622
575
|
Lint/DuplicateBranch:
|
623
576
|
Enabled: false
|
624
577
|
|
625
|
-
# Disabling for now
|
626
|
-
Lint/DuplicateCaseCondition:
|
627
|
-
Enabled: false
|
628
|
-
|
629
578
|
Lint/DuplicateElsifCondition:
|
630
579
|
Enabled: true
|
631
580
|
|
632
581
|
Lint/DuplicateHashKey:
|
633
582
|
Enabled: true
|
634
583
|
|
635
|
-
# Disabling for now
|
636
|
-
Lint/DuplicateMethods:
|
637
|
-
Enabled: false
|
638
|
-
|
639
584
|
Lint/DuplicateRegexpCharacterClassElement:
|
640
585
|
Enabled: true
|
641
586
|
|
@@ -660,11 +605,6 @@ Lint/EmptyClass:
|
|
660
605
|
Lint/EmptyConditionalBody:
|
661
606
|
Enabled: false
|
662
607
|
|
663
|
-
# Disabling for now
|
664
|
-
Lint/EmptyEnsure:
|
665
|
-
Enabled: false
|
666
|
-
# AutoCorrect: true
|
667
|
-
|
668
608
|
Lint/EmptyExpression:
|
669
609
|
Enabled: true
|
670
610
|
|
@@ -681,10 +621,6 @@ Lint/EmptyWhen:
|
|
681
621
|
Enabled: true
|
682
622
|
AllowComments: true
|
683
623
|
|
684
|
-
# Disabling for now
|
685
|
-
Lint/EnsureReturn:
|
686
|
-
Enabled: false
|
687
|
-
|
688
624
|
Lint/ErbNewArguments:
|
689
625
|
Enabled: true
|
690
626
|
|
data/.simplecov
CHANGED
data/Brewfile
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# New Relic Ruby Agent Release Notes
|
2
2
|
|
3
|
+
## v9.2.0
|
4
|
+
|
5
|
+
Version 9.2.0 of the agent introduces some performance improvements for working with high numbers of nested actions, and deprecates instrumentation for the `memcached` and `memcache-client` gems (with `dalli` still being supported).
|
6
|
+
|
7
|
+
- **Feature: Enhance performance for handling high numbers of nested actions**
|
8
|
+
|
9
|
+
With [Issue#1910](https://github.com/newrelic/newrelic-ruby-agent/issues/1910) community members [@parkerfinch](https://github.com/parkerfinch) and [@travisbell](https://github.com/travisbell) informed us of some CPU spikes and process hangs seen only when using the agent's thread instrumentation, which was enabled by default with v9.0. When thread instrumentation is enabled, instrumented actions taking place within threads are seen and reported on by the agent whereas they would have previously gone unnoticed. This is a great improvement to the agent's usefulness in an async context, and also makes it easier for higher numbers of nested actions to be observed.
|
10
|
+
For example, if an instrumented background job framework (Sidekiq, Resque) kicks off a job that the agent notices and then that job in turn performs actions such as database queries that the agent also instruments, nested actions are seen. However, with very high (10,000+) numbers of actions nested within a single instrumented outer action, the agent would struggle to efficiently crunch through all of the collected data at the time when the outer action finished.
|
11
|
+
The agent should now be much more efficient when any observed action with lots of nested actions is finished. Our performance testing was conducted with hundreds of thousands of nested actions taking place, and we hope that the benefits of thread tracing can now be enjoyed without any drawbacks. Thanks very much [@parkerfinch](https://github.com/parkerfinch) and [@travisbell](https://github.com/travisbell)! [PR#1927](https://github.com/newrelic/newrelic-ruby-agent/pull/1927)
|
12
|
+
|
13
|
+
- **Feature: Deprecate memcached and memcache-client instrumentation**
|
14
|
+
|
15
|
+
Instrumentation for the memcached and memcache-client libraries is deprecated and will be removed during the next major release.
|
16
|
+
|
3
17
|
## v9.1.0
|
4
18
|
|
5
19
|
Version 9.1.0 of the agent delivers support for two new [errors inbox](https://docs.newrelic.com/docs/errors-inbox/errors-inbox/) features: error fingerprinting and user tracking, identifies the Amazon Timestream data store, removes Distributed Tracing warnings from agent logs when using Sidekiq, fixes bugs, and is tested against the recently released JRuby 9.4.2.0.
|
data/Guardfile
CHANGED
data/bin/newrelic
CHANGED
data/bin/newrelic_cmd
CHANGED
@@ -14,30 +14,6 @@ module NewRelic
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
# Combines potentially two properties into one.
|
18
|
-
# Given the example:
|
19
|
-
# :disable_net_http and :prepend_net_instrumentation
|
20
|
-
# if :disable_net_http is true, then returned value is "disabled"
|
21
|
-
# if :prepend_net_instrumentation is false, then returned value is "chain"
|
22
|
-
# otherwise, "auto" is returned.
|
23
|
-
#
|
24
|
-
# Intent is:
|
25
|
-
# - if user sets disable_xxx property, then don't instrument
|
26
|
-
# - if user set prepend to `false` then we use method_alias chaining
|
27
|
-
# - auto, when returned means, try to use prepend unless conflicting gems discovered
|
28
|
-
#
|
29
|
-
def self.instrumentation_value_of(disable_key, prepend_key = nil)
|
30
|
-
proc do
|
31
|
-
if NewRelic::Agent.config[disable_key]
|
32
|
-
'disabled'
|
33
|
-
elsif prepend_key && !NewRelic::Agent.config[prepend_key]
|
34
|
-
'chain'
|
35
|
-
else
|
36
|
-
'auto'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
17
|
def self.instrumentation_value_from_boolean(key)
|
42
18
|
proc do
|
43
19
|
NewRelic::Agent.config[key] ? 'auto' : 'disabled'
|
@@ -1373,7 +1349,7 @@ module NewRelic
|
|
1373
1349
|
:description => 'Controls auto-instrumentation of Grape at start up. May be one of [auto|prepend|chain|disabled].'
|
1374
1350
|
},
|
1375
1351
|
:'instrumentation.grpc_client' => {
|
1376
|
-
:default =>
|
1352
|
+
:default => 'auto',
|
1377
1353
|
:documentation_default => 'auto',
|
1378
1354
|
:public => true,
|
1379
1355
|
:type => String,
|
@@ -1390,7 +1366,7 @@ module NewRelic
|
|
1390
1366
|
:description => %Q(Specifies a list of hostname patterns separated by commas that will match gRPC hostnames that traffic is to be ignored by New Relic for. New Relic's gRPC client instrumentation will ignore traffic streamed to a host matching any of these patterns, and New Relic's gRPC server instrumentation will ignore traffic for a server running on a host whose hostname matches any of these patterns. By default, no traffic is ignored when gRPC instrumentation is itself enabled. For example, "private.com$,exception.*")
|
1391
1367
|
},
|
1392
1368
|
:'instrumentation.grpc_server' => {
|
1393
|
-
:default =>
|
1369
|
+
:default => 'auto',
|
1394
1370
|
:documentation_default => 'auto',
|
1395
1371
|
:public => true,
|
1396
1372
|
:type => String,
|
@@ -1443,7 +1419,7 @@ module NewRelic
|
|
1443
1419
|
:description => 'Controls auto-instrumentation of memcached gem for Memcache at start up. May be one of [auto|prepend|chain|disabled].'
|
1444
1420
|
},
|
1445
1421
|
:'instrumentation.memcache_client' => {
|
1446
|
-
:default =>
|
1422
|
+
:default => 'auto',
|
1447
1423
|
:documentation_default => 'auto',
|
1448
1424
|
:public => true,
|
1449
1425
|
:type => String,
|
@@ -27,9 +27,9 @@ DependencyDetection.defer do
|
|
27
27
|
actions = [:authorize, :purchase, :credit, :void, :capture, :recurring, :store, :unstore, :update]
|
28
28
|
actions.each do |operation|
|
29
29
|
if implemented_methods.include?(operation)
|
30
|
-
add_method_tracer operation, [->
|
31
|
-
->
|
32
|
-
->
|
30
|
+
add_method_tracer operation, [->(*) { "ActiveMerchant/gateway/#{gateway_name}/#{operation}" },
|
31
|
+
->(*) { "ActiveMerchant/gateway/#{gateway_name}" },
|
32
|
+
->(*) { "ActiveMerchant/operation/#{operation}" }]
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -26,7 +26,7 @@ DependencyDetection.defer do
|
|
26
26
|
prepend_instrument Bunny::Queue, NewRelic::Agent::Instrumentation::Bunny::Prepend::Queue
|
27
27
|
prepend_instrument Bunny::Consumer, NewRelic::Agent::Instrumentation::Bunny::Prepend::Consumer
|
28
28
|
else
|
29
|
-
chain_instrument NewRelic::Agent::Instrumentation::Bunny
|
29
|
+
chain_instrument NewRelic::Agent::Instrumentation::Bunny::Chain
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# This file is distributed under New Relic's license terms.
|
2
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
3
|
# frozen_string_literal: true
|
4
|
+
|
4
5
|
require_relative 'instrumentation'
|
5
6
|
|
6
7
|
module NewRelic::Agent::Instrumentation
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# This file is distributed under New Relic's license terms.
|
2
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
3
|
# frozen_string_literal: true
|
4
|
+
|
4
5
|
require_relative '../../datastores/nosql_obfuscator'
|
5
6
|
|
6
7
|
module NewRelic::Agent::Instrumentation
|
@@ -25,7 +25,7 @@ DependencyDetection.defer do
|
|
25
25
|
if use_prepend?
|
26
26
|
prepend_instrument to_instrument, NewRelic::Agent::Instrumentation::Elasticsearch::Prepend
|
27
27
|
else
|
28
|
-
chain_instrument NewRelic::Agent::Instrumentation::Elasticsearch
|
28
|
+
chain_instrument NewRelic::Agent::Instrumentation::Elasticsearch::Chain
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -19,7 +19,7 @@ DependencyDetection.defer do
|
|
19
19
|
if use_prepend?
|
20
20
|
prepend_instrument Fiber, NewRelic::Agent::Instrumentation::MonitoredFiber::Prepend
|
21
21
|
else
|
22
|
-
chain_instrument NewRelic::Agent::Instrumentation::MonitoredFiber
|
22
|
+
chain_instrument NewRelic::Agent::Instrumentation::MonitoredFiber::Chain
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require_relative 'request_wrapper'
|
6
6
|
require_relative '../helper'
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require_relative 'grpc/client/chain'
|
6
6
|
require_relative 'grpc/client/prepend'
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require_relative 'grpc/server/chain'
|
6
6
|
require_relative 'grpc/server/rpc_server_prepend'
|
@@ -58,7 +58,9 @@ module NewRelic
|
|
58
58
|
end.class_eval do
|
59
59
|
include NewRelic::Agent::Instrumentation::Memcache::Tracer
|
60
60
|
|
61
|
-
# TODO:
|
61
|
+
# TODO: MAJOR VERSION
|
62
|
+
# Dalli - 3.1.0 renamed send_multiget to pipelined_get, but the method is otherwise the same
|
63
|
+
# Once we no longer support Dalli < 3.1.0, remove this conditional logic
|
62
64
|
if Gem::Version.new(::Dalli::VERSION) >= Gem::Version.new('3.1.0')
|
63
65
|
alias_method(:pipelined_get_without_newrelic_trace, :pipelined_get)
|
64
66
|
def pipelined_get(keys)
|
@@ -84,7 +84,9 @@ module NewRelic::Agent::Instrumentation
|
|
84
84
|
extend Helper
|
85
85
|
include NewRelic::Agent::Instrumentation::Memcache::Tracer
|
86
86
|
|
87
|
-
# TODO:
|
87
|
+
# TODO: MAJOR VERSION
|
88
|
+
# Dalli - 3.1.0 renamed send_multiget to pipelined_get, but the method is otherwise the same
|
89
|
+
# Once we no longer support Dalli < 3.1.0, remove this conditional logic
|
88
90
|
if Gem::Version.new(::Dalli::VERSION) >= Gem::Version.new('3.1.0')
|
89
91
|
def pipelined_get(keys)
|
90
92
|
send_multiget_with_newrelic_tracing(keys) { super }
|
@@ -58,7 +58,7 @@ DependencyDetection.defer do
|
|
58
58
|
prepend_instrument client_class, instrumenting_module, 'MemcachedDalli'
|
59
59
|
end
|
60
60
|
else
|
61
|
-
chain_instrument NewRelic::Agent::Instrumentation::Memcache::Dalli
|
61
|
+
chain_instrument NewRelic::Agent::Instrumentation::Memcache::Dalli, 'MemcachedDalli'
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
@@ -81,7 +81,7 @@ DependencyDetection.defer do
|
|
81
81
|
prepend_instrument client_class, instrumenting_module, 'MemcachedDalliCAS'
|
82
82
|
end
|
83
83
|
else
|
84
|
-
chain_instrument NewRelic::Agent::Instrumentation::Memcache::DalliCAS
|
84
|
+
chain_instrument NewRelic::Agent::Instrumentation::Memcache::DalliCAS, 'MemcachedDalliCAS'
|
85
85
|
end
|
86
86
|
end
|
87
87
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# This file is distributed under New Relic's license terms.
|
2
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
3
|
# frozen_string_literal: true
|
4
|
+
|
4
5
|
require_relative 'sidekiq/client'
|
5
6
|
require_relative 'sidekiq/server'
|
6
7
|
require_relative 'sidekiq/extensions/delayed_class'
|
@@ -134,7 +134,7 @@ module NewRelic
|
|
134
134
|
# Foo._nr_default_metric_name_code('bar') #=> "Custom/#{Foo.name}/bar"
|
135
135
|
def _nr_default_metric_name(method_name)
|
136
136
|
class_name = _nr_derived_class_name
|
137
|
-
->
|
137
|
+
->(*) { "Custom/#{class_name}/#{method_name}" }
|
138
138
|
end
|
139
139
|
|
140
140
|
# Checks to see if the method we are attempting to trace
|
@@ -462,7 +462,6 @@ module NewRelic
|
|
462
462
|
Net::HTTPRequestURITooLong,
|
463
463
|
Net::HTTPUnsupportedMediaType,
|
464
464
|
Net::HTTPExpectationFailed,
|
465
|
-
Net::HTTPUnsupportedMediaType,
|
466
465
|
Net::HTTPRequestHeaderFieldsTooLarge
|
467
466
|
handle_unrecoverable_server_exception(response, endpoint)
|
468
467
|
when Net::HTTPConflict,
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# This file is distributed under New Relic's license terms.
|
2
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
3
|
# frozen_string_literal: true
|
4
|
+
|
4
5
|
#
|
5
6
|
# A Sampler is used to capture meaningful metrics in a background thread
|
6
7
|
# periodically. They will be invoked about once a minute, each time the agent
|
@@ -2,7 +2,6 @@
|
|
2
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
3
|
# frozen_string_literal: true
|
4
4
|
|
5
|
-
require 'new_relic/agent/range_extensions'
|
6
5
|
require 'new_relic/agent/guid_generator'
|
7
6
|
|
8
7
|
module NewRelic
|
@@ -105,38 +104,6 @@ module NewRelic
|
|
105
104
|
@start_time.to_f..@end_time.to_f
|
106
105
|
end
|
107
106
|
|
108
|
-
def timings_overlap?(timing1, timing2)
|
109
|
-
(timing1.first >= timing2.first && timing1.first <= timing2.last) ||
|
110
|
-
(timing2.first >= timing1.first && timing2.first <= timing1.last)
|
111
|
-
end
|
112
|
-
|
113
|
-
def merge_timings(timing1, timing2)
|
114
|
-
[([timing1.first, timing2.first].min),
|
115
|
-
([timing1.last, timing2.last].max)]
|
116
|
-
end
|
117
|
-
|
118
|
-
# @children_timings is an array of array, with each inner array
|
119
|
-
# holding exactly 2 values, a child segment's start time and finish
|
120
|
-
# time (in that order). When it's time to record, these timings are
|
121
|
-
# converted into an array of range objects (using the same start and
|
122
|
-
# end values as the original array). Any two range objects that
|
123
|
-
# intersect and merged into a larger range. This checking for a
|
124
|
-
# intersections and merging of ranges is expensive, so the operation
|
125
|
-
# is only done at recording time.
|
126
|
-
def children_time_ranges
|
127
|
-
@children_time_ranges ||= begin
|
128
|
-
overlapped = @children_timings.each_with_object([]) do |timing, timings|
|
129
|
-
i = timings.index { |t| timings_overlap?(t, timing) }
|
130
|
-
if i
|
131
|
-
timings[i] = merge_timings(timing, timings[i])
|
132
|
-
else
|
133
|
-
timings << timing
|
134
|
-
end
|
135
|
-
end
|
136
|
-
overlapped.map { |t| Range.new(t.first, t.last) }
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
107
|
def children_time_ranges?
|
141
108
|
!@children_timings.empty?
|
142
109
|
end
|
@@ -299,12 +266,6 @@ module NewRelic
|
|
299
266
|
end
|
300
267
|
|
301
268
|
def record_exclusive_duration
|
302
|
-
overlapping_duration = if children_time_ranges?
|
303
|
-
RangeExtensions.compute_overlap(time_range, children_time_ranges)
|
304
|
-
else
|
305
|
-
0.0
|
306
|
-
end
|
307
|
-
|
308
269
|
@exclusive_duration = duration - children_time - overlapping_duration
|
309
270
|
transaction.total_time += @exclusive_duration
|
310
271
|
params[:exclusive_duration_millis] = @exclusive_duration * 1000 if transaction.async?
|
@@ -314,6 +275,51 @@ module NewRelic
|
|
314
275
|
transaction.metrics
|
315
276
|
end
|
316
277
|
|
278
|
+
def ranges_intersect?(r1, r2)
|
279
|
+
r1.begin > r2.begin ? r2.cover?(r1.begin) : r1.cover?(r2.begin)
|
280
|
+
end
|
281
|
+
|
282
|
+
def range_overlap(range)
|
283
|
+
return 0.0 unless ranges_intersect?(range, time_range)
|
284
|
+
|
285
|
+
[range.end, time_range.end].min - [range.begin, time_range.begin].max
|
286
|
+
end
|
287
|
+
|
288
|
+
# Child segments operating concurrently with this segment may have
|
289
|
+
# start and end times that overlap with this segment's own times. The
|
290
|
+
# amount of overlap needs to be removed from the `children_time` total
|
291
|
+
# when calculating an `@exclusive_duration` value to be added to the
|
292
|
+
# transaction's total time.
|
293
|
+
#
|
294
|
+
# If there aren't any child segments, return 0.0. Otherwise, take the
|
295
|
+
# `@children_timings` array of arrays (each array holds a child
|
296
|
+
# segment's start time and end time), sort it by the first elements
|
297
|
+
# (start times), and use the start and finish times to create Range
|
298
|
+
# objects. Combine all of the child segment ranges that overlap with
|
299
|
+
# one another into new bigger ranges. Then take those bigger ranges
|
300
|
+
# and calculate how much overlap there is between them and this
|
301
|
+
# segment's own time range. Keep a running sum of all of the overlap
|
302
|
+
# amounts and then return it.
|
303
|
+
def overlapping_duration
|
304
|
+
sum = 0.0
|
305
|
+
return sum unless children_time_ranges?
|
306
|
+
|
307
|
+
@children_timings.sort_by!(&:first)
|
308
|
+
range = Range.new(*@children_timings.first)
|
309
|
+
(1..(@children_timings.size - 1)).each do |i|
|
310
|
+
possible = Range.new(*@children_timings[i])
|
311
|
+
|
312
|
+
if ranges_intersect?(range, possible)
|
313
|
+
range = range.begin..possible.end
|
314
|
+
else
|
315
|
+
sum += range_overlap(range)
|
316
|
+
range = possible
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
sum += range_overlap(range)
|
321
|
+
end
|
322
|
+
|
317
323
|
def transaction_state
|
318
324
|
@transaction_state ||= if @transaction
|
319
325
|
transaction.state
|
@@ -119,14 +119,13 @@ module NewRelic
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def check_required_fields_present(payload)
|
122
|
-
if
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
!payload.timestamp.nil?
|
122
|
+
if !payload.version.nil? &&
|
123
|
+
!payload.parent_account_id.nil? &&
|
124
|
+
!payload.parent_app_id.nil? &&
|
125
|
+
!payload.parent_type.nil? &&
|
126
|
+
(!payload.transaction_id.nil? || !payload.id.nil?) &&
|
127
|
+
!payload.trace_id.nil? &&
|
128
|
+
!payload.timestamp.nil?
|
130
129
|
|
131
130
|
true
|
132
131
|
else
|
data/lib/new_relic/version.rb
CHANGED
@@ -97,14 +97,14 @@ class Instrumentation < Thor
|
|
97
97
|
|
98
98
|
def config_block(name)
|
99
99
|
<<~CONFIG
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
100
|
+
:'instrumentation.#{name.downcase}' => {
|
101
|
+
:default => 'auto',
|
102
|
+
:public => true,
|
103
|
+
:type => String,
|
104
|
+
:dynamic_name => true,
|
105
|
+
:allowed_from_server => false,
|
106
|
+
:description => 'Controls auto-instrumentation of the #{name} library at start up. May be one of [auto|prepend|chain|disabled].'
|
107
|
+
},
|
108
108
|
CONFIG
|
109
109
|
end
|
110
110
|
|
@@ -23,7 +23,7 @@ DependencyDetection.defer do
|
|
23
23
|
if use_prepend?
|
24
24
|
prepend_instrument ::<%= @class_name %>, NewRelic::Agent::Instrumentation::<%= @class_name %>::Prepend
|
25
25
|
else
|
26
|
-
chain_instrument NewRelic::Agent::Instrumentation::<%= @class_name
|
26
|
+
chain_instrument NewRelic::Agent::Instrumentation::<%= @class_name %>::Chain
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/lib/tasks/multiverse.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# This file is distributed under New Relic's license terms.
|
2
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
3
|
# frozen_string_literal: true
|
4
|
+
|
4
5
|
#
|
5
6
|
# Rake task for running Ruby agent multiverse tests. This file may be required
|
6
7
|
# from third party gems. It is also used by the agent itself to run multiverse.
|
data/lib/tasks/newrelic.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# This file is distributed under New Relic's license terms.
|
2
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
3
|
# frozen_string_literal: true
|
4
|
+
|
4
5
|
#
|
5
6
|
# If you are looking to instrument rake tasks in a Rails environment, but the
|
6
7
|
# task doesn't depend on :environment, this task may be included to ensure that
|
data/newrelic.yml
CHANGED
@@ -545,7 +545,7 @@ common: &default_settings
|
|
545
545
|
# slow_sql.enabled: false
|
546
546
|
|
547
547
|
# If true, the agent collects explain plans in slow SQL queries. If this setting
|
548
|
-
# is omitted, the transaction_tracer.
|
548
|
+
# is omitted, the transaction_tracer.explain_enabled setting will be applied as
|
549
549
|
# the default setting for explain plans in slow SQL as well.
|
550
550
|
# slow_sql.explain_enabled: false
|
551
551
|
|
@@ -639,13 +639,13 @@ common: &default_settings
|
|
639
639
|
# transaction_tracer.enabled: true
|
640
640
|
|
641
641
|
# Threshold (in seconds) above which the agent will collect explain plans.
|
642
|
-
# Relevant only when
|
642
|
+
# Relevant only when explain_enabled is true.
|
643
643
|
# transaction_tracer.explain_threshold: 0.5
|
644
644
|
|
645
645
|
# If true, enables the collection of explain plans in transaction traces.
|
646
646
|
# This setting will also apply to explain plans in slow SQL traces if
|
647
647
|
# slow_sql.explain enabled is not set separately.
|
648
|
-
# transaction_tracer.
|
648
|
+
# transaction_tracer.explain_enabled: true
|
649
649
|
|
650
650
|
# Maximum number of transaction trace nodes to record in a single transaction
|
651
651
|
# trace.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanna McClure
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2023-
|
14
|
+
date: 2023-04-17 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -83,6 +83,76 @@ dependencies:
|
|
83
83
|
- - '='
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: 12.3.3
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: rubocop
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - '='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 1.44.1
|
93
|
+
type: :development
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - '='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 1.44.1
|
100
|
+
- !ruby/object:Gem::Dependency
|
101
|
+
name: rubocop-ast
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - '='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 1.24.1
|
107
|
+
type: :development
|
108
|
+
prerelease: false
|
109
|
+
version_requirements: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - '='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: 1.24.1
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: rubocop-minitest
|
116
|
+
requirement: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - '='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 0.27.0
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - '='
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: 0.27.0
|
128
|
+
- !ruby/object:Gem::Dependency
|
129
|
+
name: rubocop-performance
|
130
|
+
requirement: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - '='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: 1.16.0
|
135
|
+
type: :development
|
136
|
+
prerelease: false
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - '='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 1.16.0
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: rubocop-rake
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - '='
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: 0.6.0
|
149
|
+
type: :development
|
150
|
+
prerelease: false
|
151
|
+
version_requirements: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - '='
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: 0.6.0
|
86
156
|
- !ruby/object:Gem::Dependency
|
87
157
|
name: simplecov
|
88
158
|
requirement: !ruby/object:Gem::Requirement
|
@@ -439,7 +509,6 @@ files:
|
|
439
509
|
- lib/new_relic/agent/pipe_service.rb
|
440
510
|
- lib/new_relic/agent/prepend_supportability.rb
|
441
511
|
- lib/new_relic/agent/priority_sampled_buffer.rb
|
442
|
-
- lib/new_relic/agent/range_extensions.rb
|
443
512
|
- lib/new_relic/agent/rules_engine.rb
|
444
513
|
- lib/new_relic/agent/rules_engine/replacement_rule.rb
|
445
514
|
- lib/new_relic/agent/rules_engine/segment_terms_rule.rb
|
@@ -600,7 +669,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
600
669
|
- !ruby/object:Gem::Version
|
601
670
|
version: 1.3.1
|
602
671
|
requirements: []
|
603
|
-
rubygems_version: 3.
|
672
|
+
rubygems_version: 3.4.10
|
604
673
|
signing_key:
|
605
674
|
specification_version: 4
|
606
675
|
summary: New Relic Ruby Agent
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# This file is distributed under New Relic's license terms.
|
2
|
-
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
module NewRelic
|
6
|
-
module Agent
|
7
|
-
module RangeExtensions
|
8
|
-
module_function
|
9
|
-
|
10
|
-
def intersects?(r1, r2)
|
11
|
-
r1.begin > r2.begin ? r2.cover?(r1.begin) : r1.cover?(r2.begin)
|
12
|
-
end
|
13
|
-
|
14
|
-
# Computes the amount of overlap between range and an array of ranges.
|
15
|
-
# For efficiency, it assumes that range intersects with each of the
|
16
|
-
# ranges in the ranges array.
|
17
|
-
def compute_overlap(range, ranges)
|
18
|
-
ranges.inject(0) do |memo, other|
|
19
|
-
next memo unless intersects?(range, other)
|
20
|
-
|
21
|
-
memo += ([range.end, other.end].min) -
|
22
|
-
([range.begin, other.begin].max)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|