newrelic_rpm 9.16.0 → 9.16.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23ad23d616fbcea334710ab3d67003e1775aedbadaecd7d50932c22543419ef4
4
- data.tar.gz: f26ff6b168dc8975354fa1bf7f73f02400d01e2feca735f71b510f92978b3edf
3
+ metadata.gz: 4188543c2c5d39ce13735a832e955f9ec211bdce6e83b29a37414cd78d23ff84
4
+ data.tar.gz: 84431c682fb000ddcd0b520c39b3a8b358535fb580af32d41520d26471b02944
5
5
  SHA512:
6
- metadata.gz: 4519cf295a06513f04810805b8428d0cebdbd8aa4731c4e831de0d873c014978396dee436a966c726866246a26b6ced9dcea5fd1bba2c839b6d69b66b00f51d7
7
- data.tar.gz: 5e32b59dea295c346c88de6c0cc317d7d2d8981fbe7fed6d2d0d72a6cfb2bd6b2eb5ae006871603757e957e85fe0404b618d4e4cee7afae0189ffebb1770945f
6
+ metadata.gz: 6994d2922b5a327883c2143b3deb22e01eafb8b0e78bca60a71c6a8726ed29e48b391fdb2e2e60ee86681ffe88c8782c5cd4975ab169247fd9b61527e0090149
7
+ data.tar.gz: c10cf492bd247b12fe47203e8fb5a8d17e067a7d2807e39ec144dda958101e0d334fcd29234d3657cf2d6d73bd3f67f9cb89847252d08be178caadc236e46d70
data/.build_ignore CHANGED
@@ -19,7 +19,6 @@ lefthook.yml
19
19
  log/
20
20
  README.md
21
21
  test/
22
- trivy.yaml
23
22
  lib/tasks/bump_version.rb
24
23
  lib/tasks/coverage_report.rb
25
24
  lib/tasks/multiverse.rake
data/CHANGELOG.md CHANGED
@@ -1,12 +1,18 @@
1
1
  # New Relic Ruby Agent Release Notes
2
2
 
3
+ ## v9.16.1
4
+
5
+ - **Bugfix: Add support for Trilogy database adapter**
6
+
7
+ The agent now fully supports Trilogy, a client library for MySQL-compatible database servers, and correctly lists MySQL as the corresponding database in the UI. [PR#2966](https://github.com/newrelic/newrelic-ruby-agent/pull/2966).
8
+
3
9
  ## v9.16.0
4
10
 
5
- Version 9.16.0 introduces instrumentation for the aws-sdk-lambda gem, allows users to opt-in to adding labels to logs, updates View Component instrumentation, and fixes a bug with explain plans on Rails 7.2+.
11
+ Version 9.16.0 introduces the following features and bug fixes:
6
12
 
7
13
  - **Feature: Instrumentation for aws-sdk-lambda**
8
14
 
9
- If the aws-sdk-lambda gem is present and used to invoke remote AWS Lambda functions, timing and error details for the invocations will be reported to New Relic. [PR#2926](https://github.com/newrelic/newrelic-ruby-agent/pull/2926).
15
+ When the aws-sdk-lambda gem is available and used to invoke remote AWS Lambda functions, the timing and error details of the invocations will be reported to New Relic. [PR#2926](https://github.com/newrelic/newrelic-ruby-agent/pull/2926).
10
16
 
11
17
  - **Feature: Add new configuration options to attach custom tags (labels) to logs**
12
18
 
@@ -5,13 +5,64 @@
5
5
  module NewRelic
6
6
  module Agent
7
7
  module Aws
8
- def self.create_arn(service, resource, region)
9
- return unless NewRelic::Agent.config[:'cloud.aws.account_id']
8
+ CHARACTERS = %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 2 3 4 5 6 7].freeze
9
+ HEX_MASK = '7fffffffff80'
10
10
 
11
- "arn:aws:#{service}:#{region}:#{NewRelic::Agent.config[:'cloud.aws.account_id']}:#{resource}"
11
+ def self.create_arn(service, resource, region, account_id)
12
+ # if any of the values are nil, we can't create an ARN
13
+ return unless service && resource && region && account_id
14
+
15
+ "arn:aws:#{service}:#{region}:#{account_id}:#{resource}"
12
16
  rescue => e
13
17
  NewRelic::Agent.logger.warn("Failed to create ARN: #{e}")
14
18
  end
19
+
20
+ def self.get_account_id(config)
21
+ # if it is set in the agent config, use that first
22
+ return NewRelic::Agent.config[:'cloud.aws.account_id'] if NewRelic::Agent.config[:'cloud.aws.account_id']
23
+
24
+ access_key_id = config.credentials.credentials.access_key_id if config&.credentials&.credentials&.respond_to?(:access_key_id)
25
+ return unless access_key_id
26
+
27
+ NewRelic::Agent::Aws.convert_access_key_to_account_id(access_key_id)
28
+ rescue => e
29
+ NewRelic::Agent.logger.debug("Failed to create account id: #{e}")
30
+ end
31
+
32
+ def self.convert_access_key_to_account_id(access_key)
33
+ decoded_key = Integer(decode_to_hex(access_key[4..-1]), 16)
34
+ mask = Integer(HEX_MASK, 16)
35
+ (decoded_key & mask) >> 7
36
+ end
37
+
38
+ def self.decode_to_hex(access_key)
39
+ bytes = access_key.delete('=').each_char.map { |c| CHARACTERS.index(c) }
40
+
41
+ bytes.each_slice(8).map do |section|
42
+ convert_section(section)
43
+ end.flatten[0...6].join
44
+ end
45
+
46
+ def self.convert_section(section)
47
+ buffer = 0
48
+ section.each do |chunk|
49
+ buffer = (buffer << 5) + chunk
50
+ end
51
+
52
+ chunk_count = (section.length * 5.0 / 8.0).floor
53
+
54
+ if section.length < 8
55
+ buffer >>= (5 - (chunk_count * 8)) % 5
56
+ end
57
+
58
+ decoded = []
59
+ chunk_count.times do |i|
60
+ shift = 8 * (chunk_count - 1 - i)
61
+ decoded << ((buffer >> shift) & 255).to_s(16)
62
+ end
63
+
64
+ decoded
65
+ end
15
66
  end
16
67
  end
17
68
  end
@@ -646,7 +646,7 @@ module NewRelic
646
646
  :public => true,
647
647
  :type => Boolean,
648
648
  :allowed_from_server => true,
649
- :description => 'If `true`, enables the collection of explain plans in transaction traces. This setting will also apply to explain plans in slow SQL traces if [`slow_sql.explain_enabled`](#slow_sql-explain_enabled) is not set separately.'
649
+ :description => "If `true`, enables the collection of explain plans in transaction traces. This setting will also apply to explain plans in slow SQL traces if [`slow_sql.explain_enabled`](#slow_sql-explain_enabled) isn't set separately."
650
650
  },
651
651
  :'transaction_tracer.explain_threshold' => {
652
652
  :default => 0.5,
@@ -1911,7 +1911,7 @@ module NewRelic
1911
1911
  :description => <<~DESCRIPTION
1912
1912
  An array of strings to specify which keys inside a Stripe event's `user_data` hash should be reported
1913
1913
  to New Relic. Each string in this array will be turned into a regular expression via `Regexp.new` to
1914
- permit advanced matching. Setting the value to `["."]` will report all `user_data`.
1914
+ enable advanced matching. Setting the value to `["."]` will report all `user_data`.
1915
1915
  DESCRIPTION
1916
1916
  },
1917
1917
  :'stripe.user_data.exclude' => {
@@ -1924,8 +1924,8 @@ module NewRelic
1924
1924
  :description => <<~DESCRIPTION
1925
1925
  An array of strings to specify which keys and/or values inside a Stripe event's `user_data` hash should
1926
1926
  not be reported to New Relic. Each string in this array will be turned into a regular expression via
1927
- `Regexp.new` to permit advanced matching. For each hash pair, if either the key or value is matched the
1928
- pair will not be reported. By default, no `user_data` is reported. Use this option only if the
1927
+ `Regexp.new` to permit advanced matching. For each hash pair, if either the key or value is matched the pair
1928
+ isn't reported. By default, no `user_data` is reported. Use this option only if the
1929
1929
  `stripe.user_data.include` option is also used.
1930
1930
  DESCRIPTION
1931
1931
  },
@@ -2069,7 +2069,7 @@ module NewRelic
2069
2069
  :transform => proc { |bool| NewRelic::Agent::ServerlessHandler.env_var_set? || bool },
2070
2070
  :description => 'If `true`, the agent will operate in a streamlined mode suitable for use with short-lived ' \
2071
2071
  'serverless functions. NOTE: Only AWS Lambda functions are supported currently and this ' \
2072
- "option is not intended for use without [New Relic's Ruby Lambda layer](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/get-started/monitoring-aws-lambda-serverless-monitoring/) offering."
2072
+ "option isn't intended for use without [New Relic's Ruby Lambda layer](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/get-started/monitoring-aws-lambda-serverless-monitoring/) offering."
2073
2073
  },
2074
2074
  # Sidekiq
2075
2075
  :'sidekiq.args.include' => {
@@ -2689,7 +2689,7 @@ module NewRelic
2689
2689
  :public => true,
2690
2690
  :type => Boolean,
2691
2691
  :allowed_from_server => false,
2692
- :description => "If `true`, the security agent is loaded (the agent performs a Ruby 'require')"
2692
+ :description => "If `true`, the security agent loads (the agent performs a Ruby 'require')"
2693
2693
  },
2694
2694
  :'security.enabled' => {
2695
2695
  :default => false,
@@ -2857,7 +2857,7 @@ module NewRelic
2857
2857
  :type => Integer,
2858
2858
  :external => true,
2859
2859
  :allowed_from_server => true,
2860
- :description => 'Specifies the length of time (in minutes) that the IAST scan will run.'
2860
+ :description => 'Indicates the duration (in minutes) for which the IAST scan will be performed.'
2861
2861
  },
2862
2862
  :'security.scan_schedule.schedule' => {
2863
2863
  :default => '',
@@ -2874,7 +2874,7 @@ module NewRelic
2874
2874
  :public => true,
2875
2875
  :type => Boolean,
2876
2876
  :allowed_from_server => false,
2877
- :description => 'If `true`, allows IAST to continuously gather trace data in the background. Collected data will be used by the security agent to perform an IAST scan at the scheduled time.'
2877
+ :description => 'If `true`, allows IAST to continuously gather trace data in the background. The security agent uses collected data to perform an IAST scan at the scheduled time.'
2878
2878
  },
2879
2879
  :'security.scan_controllers.iast_scan_request_rate_limit' => {
2880
2880
  :default => 3600,
@@ -277,6 +277,7 @@ module NewRelic
277
277
  MYSQL_PREFIX = 'mysql'.freeze
278
278
  MYSQL2_PREFIX = 'mysql2'.freeze
279
279
  SQLITE_PREFIX = 'sqlite'.freeze
280
+ TRILOGY_PREFIX = 'trilogy'.freeze
280
281
 
281
282
  def symbolized_adapter(adapter)
282
283
  if adapter.start_with?(POSTGRES_PREFIX) || adapter == POSTGIS_PREFIX
@@ -289,6 +290,8 @@ module NewRelic
289
290
  :mysql2
290
291
  elsif adapter.start_with?(SQLITE_PREFIX)
291
292
  :sqlite
293
+ elsif adapter == TRILOGY_PREFIX
294
+ :trilogy
292
295
  else
293
296
  adapter.to_sym
294
297
  end
@@ -170,6 +170,9 @@ module NewRelic
170
170
 
171
171
  'sqlite3' => 'SQLite',
172
172
 
173
+ # https://rubygems.org/gems/trilogy
174
+ 'trilogy' => 'MySQL',
175
+
173
176
  # https://rubygems.org/gems/activerecord-jdbcpostgresql-adapter
174
177
  'jdbcmysql' => 'MySQL',
175
178
 
@@ -63,10 +63,9 @@ module NewRelic::Agent::Instrumentation
63
63
  def generate_segment(action, options = {})
64
64
  function = function_name(options)
65
65
  region = aws_region
66
- account_id = aws_account_id
67
66
  arn = aws_arn(function, region)
68
67
  segment = NewRelic::Agent::Tracer.start_segment(name: "Lambda/#{action}/#{function}")
69
- segment.add_agent_attribute('cloud.account.id', account_id)
68
+ segment.add_agent_attribute('cloud.account.id', nr_account_id)
70
69
  segment.add_agent_attribute('cloud.platform', CLOUD_PLATFORM)
71
70
  segment.add_agent_attribute('cloud.region', region)
72
71
  segment.add_agent_attribute('cloud.resource_id', arn) if arn
@@ -77,18 +76,18 @@ module NewRelic::Agent::Instrumentation
77
76
  (options.fetch(:function_name, nil) if options.respond_to?(:fetch)) || NewRelic::UNKNOWN
78
77
  end
79
78
 
80
- def aws_account_id
81
- return unless self.respond_to?(:config)
82
-
83
- config&.account_id || NewRelic::Agent.config[:'cloud.aws.account_id']
84
- end
85
-
86
79
  def aws_region
87
80
  config&.region if self.respond_to?(:config)
88
81
  end
89
82
 
90
83
  def aws_arn(function, region)
91
- NewRelic::Agent::Aws.create_arn(AWS_SERVICE, "function:#{function}", region)
84
+ NewRelic::Agent::Aws.create_arn(AWS_SERVICE, "function:#{function}", region, nr_account_id)
85
+ end
86
+
87
+ def nr_account_id
88
+ return @nr_account_id if defined?(@nr_account_id)
89
+
90
+ @nr_account_id = NewRelic::Agent::Aws.get_account_id(config)
92
91
  end
93
92
  end
94
93
  end
@@ -49,10 +49,16 @@ module NewRelic::Agent::Instrumentation
49
49
  @nr_captured_request = yield
50
50
  end
51
51
 
52
+ def nr_account_id
53
+ return @nr_account_id if defined?(@nr_account_id)
54
+
55
+ @nr_account_id = NewRelic::Agent::Aws.get_account_id(config)
56
+ end
57
+
52
58
  def get_arn(params)
53
59
  return unless params[:table_name]
54
60
 
55
- NewRelic::Agent::Aws.create_arn(PRODUCT.downcase, "table/#{params[:table_name]}", config&.region)
61
+ NewRelic::Agent::Aws.create_arn(PRODUCT.downcase, "table/#{params[:table_name]}", config&.region, nr_account_id)
56
62
  end
57
63
  end
58
64
  end
@@ -132,8 +132,8 @@ module NewRelic
132
132
  def agent # :nodoc:
133
133
  return @agent if @agent
134
134
 
135
- NewRelic::Agent.logger.warn("Agent unavailable as it hasn't been started.")
136
- NewRelic::Agent.logger.warn(caller.join("\n"))
135
+ NewRelic::Agent.logger.debug("Agent unavailable as it hasn't been started.")
136
+ NewRelic::Agent.logger.debug(caller.join("\n"))
137
137
  nil
138
138
  end
139
139
 
@@ -7,7 +7,7 @@ module NewRelic
7
7
  module VERSION # :nodoc:
8
8
  MAJOR = 9
9
9
  MINOR = 16
10
- TINY = 0
10
+ TINY = 1
11
11
 
12
12
  STRING = "#{MAJOR}.#{MINOR}.#{TINY}"
13
13
  end
data/newrelic.yml CHANGED
@@ -205,9 +205,8 @@ common: &default_settings
205
205
  # monitoring scripts. For now, auto-injection only works with Rails 5.2+.
206
206
  # browser_monitoring.content_security_policy_nonce: true
207
207
 
208
- # Manual override for the path to your local CA bundle. This CA bundle will be
209
- # used to validate the SSL certificate presented by New Relic's data collection
210
- # service.
208
+ # Manual override for the path to your local CA bundle. This CA bundle validates
209
+ # the SSL certificate presented by New Relic's data collection service.
211
210
  # ca_bundle_path: nil
212
211
 
213
212
  # Enable or disable the capture of memcache keys from transaction traces.
@@ -323,7 +322,6 @@ common: &default_settings
323
322
  # If true, disables agent middleware for Sinatra. This middleware is responsible
324
323
  # for advanced feature support such as cross application tracing, page load
325
324
  # timing, and error collection.
326
- #
327
325
  # disable_sinatra_auto_middleware: false
328
326
 
329
327
  # If true, disables view instrumentation.
@@ -723,8 +721,8 @@ common: &default_settings
723
721
 
724
722
  # If true, the agent will operate in a streamlined mode suitable for use with
725
723
  # short-lived serverless functions. NOTE: Only AWS Lambda functions are
726
- # supported currently and this option is not intended for use without New
727
- # Relic's Ruby Lambda layer offering.
724
+ # supported currently and this option isn't intended for use without New Relic's
725
+ # Ruby Lambda layer offering.
728
726
  # serverless_mode.enabled: false
729
727
 
730
728
  # An array of strings that will collectively serve as a denylist for filtering
@@ -803,17 +801,17 @@ common: &default_settings
803
801
  # not be reported to New Relic. Each string in this array will be turned into a
804
802
  # regular expression via
805
803
  # Regexp.new to permit advanced matching. For each hash pair, if either the key
806
- # or value is matched the
807
- # pair will not be reported. By default, no user_data is reported, so this
808
- # option should only be used if
809
- # the stripe.user_data.include option is being used.
804
+ # or value is matched the pair
805
+ # isn't reported. By default, no user_data is reported. Use this option only if
806
+ # the
807
+ # stripe.user_data.include option is also used.
810
808
  # stripe.user_data.exclude: []
811
809
 
812
810
  # An array of strings to specify which keys inside a Stripe event's user_data
813
811
  # hash should be reported
814
812
  # to New Relic. Each string in this array will be turned into a regular
815
813
  # expression via Regexp.new to
816
- # permit advanced matching. Setting the value to ["."] will report all
814
+ # enable advanced matching. Setting the value to ["."] will report all
817
815
  # user_data.
818
816
  # stripe.user_data.include: []
819
817
 
@@ -877,7 +875,7 @@ common: &default_settings
877
875
 
878
876
  # If true, enables the collection of explain plans in transaction traces. This
879
877
  # setting will also apply to explain plans in slow SQL traces if
880
- # slow_sql.explain_enabled is not set separately.
878
+ # slow_sql.explain_enabled isn't set separately.
881
879
  # transaction_tracer.explain_enabled: true
882
880
 
883
881
  # Threshold (in seconds) above which the agent will collect explain plans.
@@ -951,12 +949,12 @@ common: &default_settings
951
949
  # NOTE: All "security.*" configuration parameters are related only to the
952
950
  # security agent, and all other configuration parameters that may
953
951
  # have "security" in the name somewhere are related to the APM agent.
954
-
955
- # If true, the security agent is loaded (a Ruby 'require' is performed)
952
+
953
+ # If true, the security agent loads (the agent performs a Ruby 'require')
956
954
  # security.agent.enabled: false
957
955
 
958
956
  # The port the application is listening on. This setting is mandatory for
959
- # Passenger servers. Other servers are detected by default.
957
+ # Passenger servers. The agent detects other servers by default.
960
958
  # security.application_info.port: nil
961
959
 
962
960
  # If true, the security agent is started (the agent runs in its event loop)
@@ -964,7 +962,7 @@ common: &default_settings
964
962
 
965
963
  # Defines API paths the security agent should ignore in IAST scans. Accepts an
966
964
  # array of regex patterns matching the URI to ignore. The regex pattern should
967
- # provide a complete match for the URL without the endpoint. For example,
965
+ # find a complete match for the URL without the endpoint. For example,
968
966
  # [".*account.*"], [".*/\api\/v1\/.*?\/login"]
969
967
  # security.exclude_from_iast_scan.api: []
970
968
 
@@ -985,8 +983,8 @@ common: &default_settings
985
983
  # If true, disables system command injection detection in IAST scans.
986
984
  # security.exclude_from_iast_scan.iast_detection_category.command_injection: false
987
985
 
988
- # If true, disables the detection of low-severity insecure settings (e.g., hash,
989
- # crypto, cookie, random generators, trust boundary).
986
+ # If true, disables the detection of low-severity insecure settings. For
987
+ # example, hash, crypto, cookie, random generators, trust boundary).
990
988
  # security.exclude_from_iast_scan.iast_detection_category.insecure_settings: false
991
989
 
992
990
  # If true, disables file operation-related IAST detections (File Access &
@@ -1015,8 +1013,8 @@ common: &default_settings
1015
1013
  # If true, disables XPATH injection detection in IAST scans.
1016
1014
  # security.exclude_from_iast_scan.iast_detection_category.xpath_injection: false
1017
1015
 
1018
- # Unique test identifier when runnning IAST in CI/CD environment to
1019
- # differentiate between different test runs, e.g., a build number.
1016
+ # A unique test identifier when runnning IAST in a CI/CD environment to
1017
+ # differentiate between different test runs. For example, a build number.
1020
1018
  # security.iast_test_identifier: nil
1021
1019
 
1022
1020
  # Defines the mode for the security agent to operate in. Currently only IAST is
@@ -1031,20 +1029,20 @@ common: &default_settings
1031
1029
  # disables Reflected Cross-Site Scripting (RXSS) vulnerability detection.
1032
1030
  # security.scan_controllers.report_http_response_body: true
1033
1031
 
1034
- # The number of application instances for a specific entity on which IAST
1035
- # analysis is performed.
1032
+ # The number of application instances for a specific entity to perform IAST
1033
+ # analysis on.
1036
1034
  # security.scan_controllers.scan_instance_count: 0
1037
1035
 
1038
- # If true, allows IAST to continuously gather trace data in the background.
1039
- # Collected data will be used by the security agent to perform an IAST scan at
1040
- # the scheduled time.
1036
+ # If true, allows IAST to continuously gather trace data in the background. The
1037
+ # security agent uses collected data to perform an IAST scan at the scheduled
1038
+ # time.
1041
1039
  # security.scan_schedule.always_sample_traces: false
1042
1040
 
1043
1041
  # Specifies the delay time (in minutes) before the IAST scan begins after the
1044
1042
  # application starts.
1045
1043
  # security.scan_schedule.delay: 0
1046
1044
 
1047
- # Specifies the length of time (in minutes) that the IAST scan will run.
1045
+ # Indicates the duration (in minutes) for which the IAST scan will be performed.
1048
1046
  # security.scan_schedule.duration: 0
1049
1047
 
1050
1048
  # Specifies a cron expression that sets when the IAST scan should run.
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.16.0
4
+ version: 9.16.1
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: 2024-11-19 00:00:00.000000000 Z
14
+ date: 2024-12-04 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler