newrelic_rpm 9.12.0 → 9.17.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.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +217 -1
  3. data/CONTRIBUTING.md +2 -2
  4. data/README.md +16 -20
  5. data/lib/boot/strap.rb +4 -3
  6. data/lib/new_relic/agent/agent.rb +4 -0
  7. data/lib/new_relic/agent/agent_helpers/connect.rb +3 -0
  8. data/lib/new_relic/agent/agent_helpers/harvest.rb +3 -0
  9. data/lib/new_relic/agent/agent_helpers/shutdown.rb +3 -0
  10. data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +1 -0
  11. data/lib/new_relic/agent/agent_helpers/startup.rb +7 -0
  12. data/lib/new_relic/agent/aws.rb +6 -0
  13. data/lib/new_relic/agent/configuration/default_source.rb +363 -31
  14. data/lib/new_relic/agent/configuration/environment_source.rb +5 -1
  15. data/lib/new_relic/agent/configuration/manager.rb +23 -0
  16. data/lib/new_relic/agent/configuration/yaml_source.rb +6 -1
  17. data/lib/new_relic/agent/database/obfuscation_helpers.rb +11 -11
  18. data/lib/new_relic/agent/database.rb +41 -1
  19. data/lib/new_relic/agent/distributed_tracing.rb +2 -2
  20. data/lib/new_relic/agent/health_check.rb +136 -0
  21. data/lib/new_relic/agent/instrumentation/active_merchant.rb +0 -13
  22. data/lib/new_relic/agent/instrumentation/active_record.rb +1 -8
  23. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +5 -1
  24. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +9 -16
  25. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger.rb +0 -2
  26. data/lib/new_relic/agent/instrumentation/active_support_logger.rb +0 -2
  27. data/lib/new_relic/agent/instrumentation/async_http.rb +1 -2
  28. data/lib/new_relic/agent/instrumentation/aws_sdk_firehose/chain.rb +21 -0
  29. data/lib/new_relic/agent/instrumentation/aws_sdk_firehose/instrumentation.rb +66 -0
  30. data/lib/new_relic/agent/instrumentation/aws_sdk_firehose/prepend.rb +15 -0
  31. data/lib/new_relic/agent/instrumentation/aws_sdk_firehose.rb +22 -0
  32. data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis/chain.rb +21 -0
  33. data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis/instrumentation.rb +91 -0
  34. data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis/prepend.rb +15 -0
  35. data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis.rb +22 -0
  36. data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/chain.rb +33 -0
  37. data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/instrumentation.rb +93 -0
  38. data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/prepend.rb +23 -0
  39. data/lib/new_relic/agent/instrumentation/aws_sdk_lambda.rb +23 -0
  40. data/lib/new_relic/agent/instrumentation/aws_sqs.rb +0 -2
  41. data/lib/new_relic/agent/instrumentation/bunny.rb +3 -4
  42. data/lib/new_relic/agent/instrumentation/concurrent_ruby.rb +0 -2
  43. data/lib/new_relic/agent/instrumentation/curb.rb +3 -4
  44. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +0 -23
  45. data/lib/new_relic/agent/instrumentation/dynamodb/instrumentation.rb +1 -1
  46. data/lib/new_relic/agent/instrumentation/dynamodb.rb +0 -2
  47. data/lib/new_relic/agent/instrumentation/elasticsearch.rb +0 -2
  48. data/lib/new_relic/agent/instrumentation/ethon.rb +0 -4
  49. data/lib/new_relic/agent/instrumentation/excon.rb +0 -16
  50. data/lib/new_relic/agent/instrumentation/fiber.rb +0 -2
  51. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +0 -3
  52. data/lib/new_relic/agent/instrumentation/grape.rb +1 -1
  53. data/lib/new_relic/agent/instrumentation/httpclient.rb +0 -1
  54. data/lib/new_relic/agent/instrumentation/httprb.rb +0 -1
  55. data/lib/new_relic/agent/instrumentation/httpx.rb +0 -4
  56. data/lib/new_relic/agent/instrumentation/logger.rb +1 -3
  57. data/lib/new_relic/agent/instrumentation/logstasher.rb +0 -2
  58. data/lib/new_relic/agent/instrumentation/memcache.rb +0 -1
  59. data/lib/new_relic/agent/instrumentation/opensearch/chain.rb +21 -0
  60. data/lib/new_relic/agent/instrumentation/opensearch/instrumentation.rb +66 -0
  61. data/lib/new_relic/agent/instrumentation/opensearch/prepend.rb +13 -0
  62. data/lib/new_relic/agent/instrumentation/opensearch.rb +23 -0
  63. data/lib/new_relic/agent/instrumentation/padrino.rb +3 -3
  64. data/lib/new_relic/agent/instrumentation/rake.rb +0 -1
  65. data/lib/new_relic/agent/instrumentation/rdkafka/chain.rb +72 -0
  66. data/lib/new_relic/agent/instrumentation/rdkafka/instrumentation.rb +70 -0
  67. data/lib/new_relic/agent/instrumentation/rdkafka/prepend.rb +67 -0
  68. data/lib/new_relic/agent/instrumentation/rdkafka.rb +25 -0
  69. data/lib/new_relic/agent/instrumentation/redis.rb +7 -6
  70. data/lib/new_relic/agent/instrumentation/resque.rb +7 -5
  71. data/lib/new_relic/agent/instrumentation/roda.rb +4 -4
  72. data/lib/new_relic/agent/instrumentation/ruby_kafka/chain.rb +55 -0
  73. data/lib/new_relic/agent/instrumentation/ruby_kafka/instrumentation.rb +67 -0
  74. data/lib/new_relic/agent/instrumentation/ruby_kafka/prepend.rb +60 -0
  75. data/lib/new_relic/agent/instrumentation/ruby_kafka.rb +25 -0
  76. data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb +1 -1
  77. data/lib/new_relic/agent/instrumentation/sidekiq.rb +0 -14
  78. data/lib/new_relic/agent/instrumentation/sinatra.rb +3 -19
  79. data/lib/new_relic/agent/instrumentation/thread.rb +0 -2
  80. data/lib/new_relic/agent/instrumentation/tilt.rb +0 -4
  81. data/lib/new_relic/agent/instrumentation/typhoeus.rb +0 -1
  82. data/lib/new_relic/agent/instrumentation/view_component/instrumentation.rb +11 -5
  83. data/lib/new_relic/agent/instrumentation/view_component.rb +0 -2
  84. data/lib/new_relic/agent/javascript_instrumentor.rb +2 -3
  85. data/lib/new_relic/agent/local_log_decorator.rb +12 -2
  86. data/lib/new_relic/agent/log_event_aggregator.rb +28 -2
  87. data/lib/new_relic/agent/messaging.rb +11 -5
  88. data/lib/new_relic/agent/new_relic_service.rb +8 -2
  89. data/lib/new_relic/agent/serverless_handler.rb +241 -12
  90. data/lib/new_relic/agent/serverless_handler_event_sources.json +155 -0
  91. data/lib/new_relic/agent/serverless_handler_event_sources.rb +49 -0
  92. data/lib/new_relic/agent/span_event_primitive.rb +4 -2
  93. data/lib/new_relic/agent/system_info.rb +14 -0
  94. data/lib/new_relic/agent/threading/backtrace_node.rb +10 -1
  95. data/lib/new_relic/agent/transaction/message_broker_segment.rb +3 -0
  96. data/lib/new_relic/agent/transaction/request_attributes.rb +13 -1
  97. data/lib/new_relic/agent/transaction/trace_context.rb +1 -1
  98. data/lib/new_relic/agent.rb +95 -2
  99. data/lib/new_relic/control/frameworks/grape.rb +14 -0
  100. data/lib/new_relic/control/frameworks/padrino.rb +14 -0
  101. data/lib/new_relic/control/frameworks/rails4.rb +1 -3
  102. data/lib/new_relic/dependency_detection.rb +11 -13
  103. data/lib/new_relic/environment_report.rb +2 -2
  104. data/lib/new_relic/helper.rb +15 -0
  105. data/lib/new_relic/language_support.rb +3 -1
  106. data/lib/new_relic/local_environment.rb +1 -4
  107. data/lib/new_relic/version.rb +1 -1
  108. data/lib/sequel/extensions/new_relic_instrumentation.rb +1 -1
  109. data/lib/tasks/helpers/newrelicyml.rb +73 -11
  110. data/lib/tasks/instrumentation_generator/instrumentation.thor +1 -1
  111. data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +11 -8
  112. data/newrelic.yml +224 -79
  113. data/test/agent_helper.rb +8 -1
  114. metadata +32 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c551a88ec42cceb53ade85126fe41272598c367b11d70e5167d374556b6fe8d
4
- data.tar.gz: 912ff4f8d33e2ba318b4ec74fa8a3e0680c21fda3521a2382658855219ec81d6
3
+ metadata.gz: c16c3149d187e88f60c408712fa5da2209c4cac08769477b951df4dfb780e95b
4
+ data.tar.gz: d6a0c36115e0b2f9db2ceeb806435737865615dc9043b669376bab20f443dce9
5
5
  SHA512:
6
- metadata.gz: 61472afe9cf52eea1a86e4394b613666372c6a0086ea1173c28d8341ff417cf980feb6fd7a25f23ec2e78bb02cc4a32efeb5102f1f42175300d0a0f8ba7eea1b
7
- data.tar.gz: e3de1701d6f580a18ceb05c1607d3eada9081012e6bc8edec503b2e945d7128312224c63604dd40debb8554fcc13621a731251f4e349dbcdef909cf09c60c867
6
+ metadata.gz: fc16046f04498bc268cfe08839f9a98580fede0d249c87bd9000d00a8560b0a99ffb2d504f018bc4a752a2008e1339a106a8dc38e46687ed2ddbf76aef839abf
7
+ data.tar.gz: 1b704cc45064a6ccbea20474f1537379b113bdf38788d2a0f7b283e885e0d9cc54c3ea5f935a8d41a81017a416f14adec7a814351c89dbf89d6072c044fb31ff
data/CHANGELOG.md CHANGED
@@ -1,5 +1,221 @@
1
1
  # New Relic Ruby Agent Release Notes
2
2
 
3
+ ## v9.17.0
4
+
5
+ - **Feature: Support Ruby 3.4.0**
6
+
7
+ The agent now supports Ruby 3.4.0. We've made incremental changes throughout the preview stage to reach compatibility. This release includes an update to the Thread Profiler for compatibility with Ruby 3.4.0's new backtrace format. [Issue#2992](https://github.com/newrelic/newrelic-ruby-agent/issues/2992) [PR#2997](https://github.com/newrelic/newrelic-ruby-agent/pull/2997)
8
+
9
+ - **Feature: Add instrumentation for aws-sdk-firehose**
10
+
11
+ The agent now has instrumentation for the [aws-sdk-firehose](https://rubygems.org/gems/aws-sdk-firehose) gem. [PR#2973](https://github.com/newrelic/newrelic-ruby-agent/pull/2973)
12
+
13
+ - **Feature: Kubernetes APM auto-attach - new agent version precedent**
14
+
15
+ Previously, when a customer installed the Ruby agent via [Kubernetes APM auto-attach](https://docs.newrelic.com/docs/kubernetes-pixie/kubernetes-integration/installation/k8s-agent-operator/) and also had the Ruby agent listed in their `Gemfile`, the agent version in `Gemfile` would take precedence. Now, the agent version installed by auto-attach takes priority. [PR#3018](https://github.com/newrelic/newrelic-ruby-agent/pull/3018)
16
+
17
+ - **Feature: Add health checks when the agent runs within Agent Control**
18
+
19
+ When the agent is started within an [Agent Control](https://docs-preview.newrelic.com/docs/new-relic-agent-control) environment, a health check file will be created at the configured file location for every agent process. By default, this location is: '/newrelic/apm/health'. The health check files will be updated at the configured frequency, which defaults to every five seconds. [PR#2995](https://github.com/newrelic/newrelic-ruby-agent/pull/2995)
20
+
21
+ - **Feature: Add Redshift as recognized ActiveRecord adapter**
22
+
23
+ When the agent does not recognize an ActiveRecord adapter, the host, port, and database name information is not added to the datastore span. Redshift will now be treated like PostgreSQL, and the agent will save the host, port, and database name on the span. [PR#3032](https://github.com/newrelic/newrelic-ruby-agent/pull/3032)
24
+
25
+ - **Feature: Add instrumentation for aws-sdk-kinesis**
26
+
27
+ The agent now has instrumentation for the [aws-sdk-kinesis](https://rubygems.org/gems/aws-sdk-kinesis) gem. It will record message broker segments for `get_records`, `put_record`, and `put_records` operations. All other operations will record standard segments. [PR#2974](https://github.com/newrelic/newrelic-ruby-agent/pull/2974)
28
+
29
+ - **Bugfix: Stop emitting inaccurate debug-level log about deprecated configuration options**
30
+
31
+ In the previous major release, we dropped support for `disable_<library_name>` configuration options in favor of `instrumentation.<library_name>`. Previously, a DEBUG level log warning appeared whenever `disable_*` options were set to `true`, even for libraries (e.g. Action Dispatch) without equivalent `instrumentation.*` options:
32
+
33
+ >DEBUG : [DEPRECATED] configuration disable_<library_name> for <library_name> will be removed in the next major release. Use instrumentation.<library_name> with one of ["auto", "disabled", "prepend", "chain"]
34
+
35
+ This inaccurate warning has been removed. If you are disabling instrumentation using `instrumentation.<library_name>: disabled` or `NEW_RELIC_INSTRUMENTATION_<LIBRARY_NAME>=disabled`, please verify the option exists by consulting our [configuration documentation](https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration/#instrumentation). If the option does not exist, check the ['Disabling' section](https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration/#disabling) to see if there is a related option. We apologize for the confusion. [PR#3005](https://github.com/newrelic/newrelic-ruby-agent/pull/3005)
36
+
37
+ - **Bugfix: Do not attempt to decorate logs with `nil` messages**
38
+
39
+ The agent no longer attempts to add New Relic linking metadata to logs with `nil` messages. Thank you, [@arlando](https://github.com/arlando) for bringing this to our attention! [Issue#2985](https://github.com/newrelic/newrelic-ruby-agent/issues/2985) [PR#2986](https://github.com/newrelic/newrelic-ruby-agent/pull/2986)
40
+
41
+ - **Bugfix: Stop renaming final Grape segment**
42
+
43
+ Previously, the agent renamed the final segment in Grape transactions to `"Middleware/Grape/#{class_name}/call"`. This was a part of an old instrumentation pattern that is no longer relevant. Many thanks to [@seriousdev-gh](https://github.com/seriousdev-gh) for bringing this issue to our attention and along with a great reproduction and suggested fix. [PR#2987](https://github.com/newrelic/newrelic-ruby-agent/pull/2987).
44
+
45
+ ## v9.16.1
46
+
47
+ - **Bugfix: Add support for Trilogy database adapter**
48
+
49
+ 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).
50
+
51
+ ## v9.16.0
52
+
53
+ Version 9.16.0 introduces the following features and bug fixes:
54
+
55
+ - **Feature: Instrumentation for aws-sdk-lambda**
56
+
57
+ 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).
58
+
59
+ - **Feature: Add new configuration options to attach custom tags (labels) to logs**
60
+
61
+ The Ruby agent now allows you to opt-in to adding your custom tags (labels) to agent-forwarded logs. With custom tags on logs, platform engineers can easily filter, search, and correlate log data for faster and more efficient troubleshooting, improved performance, and optimized resource utilization. [PR#2925](https://github.com/newrelic/newrelic-ruby-agent/pull/2925)
62
+
63
+ - **Feature: Update View Component instrumentation+**
64
+
65
+ The `.identifier` method will be formally exposed as part of the View Component public API. The agent will now use this method for building metric names when available, ensuring ongoing compatibility with all View Component versions. [PR#2956](https://github.com/newrelic/newrelic-ruby-agent/pull/2956)
66
+
67
+ - **Bugfix: Record explain plan traces on Rails 7.2+**
68
+
69
+ Rails 7.2 removed adapter-specific connection methods (ex. `ActiveRecord::Base.postgresql_connection`) and replaced them with `ActiveRecord::Base.with_connection`. Our explain plan feature relies on making a connection to the database to create an explain plan trace. Due to a bug in our tests, we missed this regression. Now, the agent uses the new method to fetch explain plans on Rails 7.2+. Thank you, [@gsar](https://github.com/gsar) and [@gstark](https://github.com/gstark) for bringing this to our attention! [Issue#2922](https://github.com/newrelic/newrelic-ruby-agent/issues/2922) [PR#2940](https://github.com/newrelic/newrelic-ruby-agent/pull/2940)
70
+
71
+ ## v9.15.0
72
+
73
+ Version 9.15.0 updates View Component instrumentation to use a default metric name when one is unavailable, adds a configuration option to associate the AWS account ID with the DynamoDB calls from the AWS SDK, resolves a bug in rdkafka instrumentation when using the karafka-rdkafka gem, resolves a bug in the ruby-kafka instrumentation, fixes a bug with Grape instrumentation, and addresses a bug preventing the agent from running in serverless mode in an AWS Lambda layer.
74
+
75
+ - **Feature: New configuration option cloud.aws.account_id**
76
+
77
+ A new configuration option has been added, `cloud.aws.account_id`, that will allow New Relic to provide more details about certain calls made using the AWS SDK. For example, relationships between AWS services instrumented with New Relic's CloudWatch Metric Streams will have relationships formed in the service map with APM applications. Currently, the DynamoDB instrumentation is the only instrumentation that will make use of this configuration option, but this will be used in future instrumentation as well. [PR#2904](https://github.com/newrelic/newrelic-ruby-agent/pull/2904)
78
+
79
+ - **Feature: Use default `View/component` metric name for unidentified View Components**
80
+
81
+ Previously, when a View Component metric name could not be identified, the agent would set the name as `nil`. Now, the agent defaults to using `View/component` as the metric name when one can not be identified. [PR#2907](https://github.com/newrelic/newrelic-ruby-agent/pull/2907)
82
+
83
+ - **Bugfix: Instrumentation errors when using the karafka-rdkafka gem**
84
+
85
+ Due to version differences between the rdkafka gem and karafka-rdkafka gem, the agent could encounter an error when it tried to install rdkafka instrumentation. This has now been resolved. Thank you to @krisdigital for bringing this issue to our attention. [PR#2880](https://github.com/newrelic/newrelic-ruby-agent/pull/2880)
86
+
87
+ - **Bugfix: Stop calling deprecated all_specs method to check for the presence of newrelic-grape**
88
+
89
+ In 9.14.0, we released a fix for calls to the deprecated `Bundler.rubygems.all_specs`, but the fix fell short for the agent's Grape instrumentation and deprecation warnings could still be raised. The condition has been simplified and deprecation warnings should no longer be raised. Thank you, [@excelsior](https://github.com/excelsior) for bringing this to our attention. [Issue#2885](https://github.com/newrelic/newrelic-ruby-agent/issues/2885) [PR#2906](https://github.com/newrelic/newrelic-ruby-agent/pull/2906)
90
+
91
+ - **Bugfix: Instrumentation errors when using the ruby-kafka gem**
92
+
93
+ Kafka::Consumer#each_message takes keyword arguments, while the prepended method is defined with a single splat positional argument. In Ruby >= 3.0, this signature mismatch raises an ArgumentError. Thank you [@patrickarnett](https://github.com/patrickarnett) for providing this bugfix. [PR#2915](https://github.com/newrelic/newrelic-ruby-agent/pull/2915)
94
+
95
+ - **Bugfix: Restore AWS Lambda layer operational functionality**
96
+
97
+ Version 9.14.0 of the agent introduced an optimization related to how the agent handles boolean configuration parameters which inadvertently caused the agent to stop operating properly in an AWS Lambda layer context. [Issue#2919](https://github.com/newrelic/newrelic-ruby-agent/issues/2919)[PR#2920](https://github.com/newrelic/newrelic-ruby-agent/pull/2920)
98
+
99
+ ## v9.14.0
100
+
101
+ Version 9.14.0 adds Apache Kafka instrumentation for the rdkafka and ruby-kafka gems, introduces a configuration-based, automatic way to add custom instrumentation method tracers, correctly captures MIME type for ActionDispatch 7.0+ requests, properly handles Boolean coercion for `newrelic.yml` configuration, fixes a JRuby bug in the configuration manager, fixes a bug related to `Bundler.rubygems.installed_specs`, and fixes a bug to make the agent compatible with ViewComponent v3.15.0+.
102
+
103
+ - **Feature: Add Apache Kafka instrumentation for the rdkafka and ruby-kafka gems**
104
+
105
+ The agent now has instrumentation for both the rdkafka and ruby-kafka gems. The agent will record transactions and message broker segments for produce and consume calls made using these gems. [PR#2824](https://github.com/newrelic/newrelic-ruby-agent/pull/2824) [PR#2842](https://github.com/newrelic/newrelic-ruby-agent/pull/2842)
106
+
107
+ - **Feature: Add a configuration option to permit custom method tracers to be defined automatically**
108
+
109
+ A new `:automatic_custom_instrumentation_method_list` configuration parameter has been added to permit the user to define a list of fully qualified (namespaced) Ruby methods for the agent to automatically add custom instrumentation for without requiring any code modifications to be made to the classes that define the methods.
110
+
111
+ The list should be an array of `CLASS#METHOD` (for instance methods) and/or `CLASS.METHOD` (for class methods) strings.
112
+
113
+ Use fully qualified class names (using the `::` delimiter) that include any module or class namespacing.
114
+
115
+ Here is some Ruby source code that defines a `render_png` instance method for an `Image` class and a `notify` class method for a `User` class, both within a `MyCompany` module namespace:
116
+
117
+ ```
118
+ module MyCompany
119
+ class Image
120
+ def render_png
121
+ # code to render a PNG
122
+ end
123
+ end
124
+
125
+ class User
126
+ def self.notify
127
+ # code to notify users
128
+ end
129
+ end
130
+ end
131
+ ```
132
+
133
+ Given that source code, the `newrelic.yml` config file might request instrumentation for both of these methods like so:
134
+
135
+ ```
136
+ automatic_custom_instrumentation_method_list:
137
+ - MyCompany::Image#render_png
138
+ - MyCompany::User.notify
139
+ ```
140
+
141
+ That configuration example uses YAML array syntax to specify both methods. Alternatively, you can use a comma-delimited string:
142
+
143
+ ```
144
+ automatic_custom_instrumentation_method_list: 'MyCompany::Image#render_png, MyCompany::User.notify'
145
+ ```
146
+
147
+ Whitespace around the comma(s) in the list is optional. When configuring the agent with a list of methods via the `NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST` environment variable, use this comma-delimited string format:
148
+
149
+ ```
150
+ export NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST='MyCompany::Image#render_png, MyCompany::User.notify'
151
+ ```
152
+
153
+ [PR#2851](https://github.com/newrelic/newrelic-ruby-agent/pull/2851)
154
+
155
+ - **Feature: Collect just MIME type for ActionDispatch 7.0+ requests**
156
+
157
+ Rails 7.0 [introduced changes](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#actiondispatch-request-content-type-now-returns-content-type-header-as-it-is) to the behavior of `ActionDispatch::Request#content_type`, adding extra request-related details the agent wasn't expecting to collect. Additionally, the agent's use of `content_type ` was triggering deprecation warnings. The agent now uses `ActionDispatch::Request#media_type` to capture the MIME type. Thanks to [@internethostage](https://github.com/internethostage) for letting us know about this change. [Issue#2500](https://github.com/newrelic/newrelic-ruby-agent/issues/2500) [PR#2855](https://github.com/newrelic/newrelic-ruby-agent/pull/2855)
158
+
159
+ - **Bugfix: Corrected Boolean coercion for `newrelic.yml` configuration**
160
+
161
+ Previously, any String assigned to New Relic configurations expecting a Boolean value were evaluated as `true`. This could lead to unexpected behavior. For example, setting `application_logging.enabled: 'false'` in `newrelic.yml` would incorrectly evaluate to `application_logging.enabled: true` due to the truthy nature of Strings.
162
+
163
+ Now, the agent strictly interprets Boolean configuration values. It recognizes both actual Boolean values and certain Strings/Symbols:
164
+ - `'true'`, `'yes'`, or `'on'` (evaluates to `true`)
165
+ - `'false'`, `'no'`, or `'off'` (evaluates to `false`)
166
+
167
+ Any other inputs will revert to the setting's default configuration value. [PR#2847](https://github.com/newrelic/newrelic-ruby-agent/pull/2847)
168
+
169
+ - **Bugfix: JRuby not saving configuration values correctly in configuration manager**
170
+
171
+ Previously, a change made to fix a different JRuby bug caused the agent to not save configuration values correctly in the configuration manager when running on JRuby. This has been fixed. [PR#2848](https://github.com/newrelic/newrelic-ruby-agent/pull/2848)
172
+
173
+ - **Bugfix: Update condition to verify Bundler.rubygems.installed_specs is available**
174
+
175
+ To address a recent Bundler deprecation warning, we started using `Bundler.rubygems.installed_specs` instead of `Bundler.rubygems.all_specs` in environments that seemed appropriate. We discovered the version constraint we used was too low. Now, rather than check the version, we check for the method using `respond_to?`. [PR#2853](https://github.com/newrelic/newrelic-ruby-agent/pull/2853)
176
+
177
+ - **Bugfix: Support view_component v3.15.0+**
178
+
179
+ Previously the agent had been making use of a private API to obtain a component identifier value. This private API was dropped in v3.15.0 of view_component, resulting in errors from the New Relic Ruby agent's continued attempts to use it. Many thanks to community member [@navidemad](https://github.com/navidemad) for bringing this issue to our attention and supplying a bugfix with [PR#2870](https://github.com/newrelic/newrelic-ruby-agent/pull/2870).
180
+
181
+ ## v9.13.0
182
+
183
+ Version 9.13.0 enhances support for AWS Lambda functions, adds experimental OpenSearch instrumentation, updates framework detection, silences a Bundler deprecation warning, fixes Falcon dispatcher detection, fixes a bug with Redis instrumentation installation, and addresses a JRuby-specific concurrency issue.
184
+
185
+ - **Feature: Enhance AWS Lambda function instrumentation**
186
+
187
+ When utilized via the latest [New Relic Ruby layer for AWS Lambda](https://layers.newrelic-external.com/), the agent now offers enhanced support for AWS Lambda function instrumentation.
188
+ * The agent's instrumentation for AWS Lambda functions now supports distributed tracing.
189
+ * Web-triggered invocations are now identified as being "web"-based when an API Gateway call is involved, with support for both API Gateway versions 1.0 and 2.0.
190
+ * Web-based calls have the HTTP method, URI, and status code recorded.
191
+ * The agent now recognizes and reports on 12 separate AWS resources that are capable of triggering a Lambda function invocation: ALB, API Gateway V1, API Gateway V2, CloudFront, CloudWatch Scheduler, DynamoStreams, Firehose, Kinesis, S3, SES, SNS, and SQS.
192
+ * The type of the triggering resource and its ARN will be recorded for each resource, and for many of them, extra resource-specific attributes will be recorded as well. For example, Lambda function invocations triggered by S3 bucket activity will now result in the S3 bucket name being recorded.
193
+ [PR#2811](https://github.com/newrelic/newrelic-ruby-agent/pull/2811)
194
+
195
+ - **Feature: Add experimental OpenSearch instrumentation**
196
+
197
+ The agent will now automatically instrument the `opensearch-ruby` gem. We're marking this instrumentation as experimental because more work is needed to fully test it. OpenSearch instrumentation provides telemetry similar to Elasticsearch. Thank you, [@Earlopain](https://github.com/Earlopain) for reporting the issue and [@praveen-ks](https://github.com/praveen-ks) for an initial draft of the instrumentation. [Issue#2228](https://github.com/newrelic/newrelic-ruby-agent/issues/2228) [PR#2796](https://github.com/newrelic/newrelic-ruby-agent/pull/2796)
198
+
199
+ - **Feature: Improve framework detection accuracy for Grape and Padrino**
200
+
201
+ Previously, applications using the Grape framework would set `ruby` as their framework within the Environment Report. Now, Grape applications will be set to `grape`. Similarly, applications using the Padrino framework would be set to `sinatra`. Now, they will be set to `padrino`. This will help the New Relic security agent compatibility checks. Thank you, [@prateeksen](https://github.com/prateeksen) for making this change. [Issue#2777](https://github.com/newrelic/newrelic-ruby-agent/issues/2777) [PR#2789](https://github.com/newrelic/newrelic-ruby-agent/pull/2789)
202
+
203
+ - **Feature: Silence Bundler `all_specs` deprecation warning**
204
+
205
+ `Bundler.rubygems.all_specs` was deprecated in favor of `Bundler.rubygems.installed_specs` in Bundler versions 2+, causing the agent to emit deprecation warnings. The method has been updated when Bundler 2+ is detected and warnings are now silenced. Thanks to [@jcoyne](https://github.com/jcoyne) for reporting this issue. [Issue#2733](https://github.com/newrelic/newrelic-ruby-agent/issues/2733) [PR#2823](https://github.com/newrelic/newrelic-ruby-agent/pull/2823)
206
+
207
+ - **Bugfix: Fix Falcon dispatcher detection**
208
+
209
+ Previously, we tried to use the object space to determine whether the [Falcon web server](https://github.com/socketry/falcon) was in use. However, Falcon is not added to the object space until after the environment report is generated, resulting in a `nil` dispatcher. Now, we revert to an earlier strategy that discovered the dispatcher using `File.basename`. Thank you, [@prateeksen](https://github.com/prateeksen) for reporting this issue and researching the problem. [Issue#2778](https://github.com/newrelic/newrelic-ruby-agent/issues/2778) [PR#2795](https://github.com/newrelic/newrelic-ruby-agent/pull/2795)
210
+
211
+ - **Bugfix: Fix for a Redis instrumentation error when Redis::Cluster::Client is present**
212
+
213
+ The Redis instrumentation previously contained a bug that would cause it to error out when `Redis::Cluster::Client` was present, owing to the use of a Ruby `return` outside of a method. Thanks very much to [@jdelStrother](https://github.com/jdelStrother) for not only reporting this bug but pointing us to the root cause as well. [Issue#2814](https://github.com/newrelic/newrelic-ruby-agent/issues/2814) [PR#2816](https://github.com/newrelic/newrelic-ruby-agent/pull/2816)
214
+
215
+ - **Bugfix: Address JRuby concurrency issue with config hash accessing**
216
+
217
+ The agent's internal configuration class maintains a hash that occassionally gets rebuilt. During the rebuild, certain previously dynamically determined instrumentation values are preserved for the benefit of the [New Relic Ruby security agent](https://github.com/newrelic/csec-ruby-agent). After reports from JRuby customers regarding concurrency issues related to the hash being accessed while being modified, two separate fixes went into the hash rebuild logic previously: a `Hash#dup` operation and a `synchronize do` block. But errors were still reported. We ourselves remain unable to reproduce these concurrency errors despite using the same exact versions of JRuby and all reported software. After confirming that the hash access code in question is only needed for the Ruby security agent (which operates only in non-production dedicated security testing environments), we have introduced a new fix for JRuby customers that will simply skip over the troublesome code when JRuby is in play but the security agent is not. [PR#2798](https://github.com/newrelic/newrelic-ruby-agent/pull/2798)
218
+
3
219
  ## v9.12.0
4
220
 
5
221
  Version 9.12.0 adds support for the `newrelic_security` agent, introduces instrumentation for the LogStasher gem, improves instrumentation for the `redis-clustering` gem, and updates the Elasticsearch instrumentation to only attempt to get the cluster name once per client, even if it fails.
@@ -430,7 +646,7 @@ Version 9.3.0 of the agent adds log-level filtering, adds custom attributes for
430
646
  | --------------------------- | ------- | ------------------------------------------------------ | ------ |
431
647
  | `application_logging.forwarding.log_level` | `debug` | Sets the minimum log level for events forwarded to New Relic | `debug`, `info`, `warn`, `error`, `fatal`, `unknown` |
432
648
 
433
- This setting uses [Ruby's Logger::Severity constants integer values](https://github.com/ruby/ruby/blob/master/lib/logger/severity.rb#L6-L17) to determine precedence.
649
+ This setting uses [Ruby's Logger::Severity constants integer values](https://github.com/ruby/logger/blob/113b82a06b3076b93a71cd467e1605b23afb3088/lib/logger/severity.rb#L6-L17) to determine precedence.
434
650
 
435
651
  - **Feature: Custom attributes for logs**
436
652
 
data/CONTRIBUTING.md CHANGED
@@ -184,9 +184,9 @@ New Relic hosts and moderates an online forum where customers can interact with
184
184
  New Relic employees as well as other customers to get help and share best
185
185
  practices. Like all official New Relic open source projects, there's a related
186
186
  Community topic in the New Relic Explorers Hub. You can find this project's
187
- topic/threads here:
187
+ topic/threads under the "Ruby Agent" category here:
188
188
 
189
- [Explorer's Hub](https://discuss.newrelic.com/tags/rubyagent)
189
+ [Explorer's Hub](https://forum.newrelic.com/s/category/Category__c/Default)
190
190
 
191
191
  ## And Finally...
192
192
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <a href="https://opensource.newrelic.com/oss-category/#community-plus"><picture><source media="(prefers-color-scheme: dark)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/dark/Community_Plus.png"><source media="(prefers-color-scheme: light)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Plus.png"><img alt="New Relic Open Source community plus project banner." src="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Plus.png"></picture></a>
2
2
 
3
- # New Relic Ruby Agent
3
+ # New Relic Ruby agent
4
4
 
5
5
  The New Relic Ruby agent monitors your applications to help you
6
6
  [identify and solve performance issues](https://docs.newrelic.com/docs/agents/ruby-agent/getting-started/introduction-new-relic-ruby#monitor-performance).
@@ -15,7 +15,7 @@ This code is actively maintained by New Relic engineering teams and delivered he
15
15
 
16
16
  [![Gem Version](https://badge.fury.io/rb/newrelic_rpm.svg)](https://badge.fury.io/rb/newrelic_rpm)
17
17
 
18
- ## Supported Environments
18
+ ## Supported environments
19
19
 
20
20
  An up-to-date list of Ruby versions and frameworks for the latest agent
21
21
  can be found on [our docs site](http://docs.newrelic.com/docs/ruby/supported-frameworks).
@@ -23,14 +23,11 @@ can be found on [our docs site](http://docs.newrelic.com/docs/ruby/supported-fra
23
23
  You can also monitor non-web applications. Refer to the "Other
24
24
  Environments" section below.
25
25
 
26
- We offer an AWS Lambda layer for instrumenting your serverless Ruby functions.
27
- Details can be found on our [getting started guide](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/instrument-your-own/).
28
-
29
- ## Installing and Using
26
+ ## Installing and using
30
27
 
31
28
  The latest released gem for the Ruby agent can be found at [RubyGems.org](https://rubygems.org/gems/newrelic_rpm)
32
29
 
33
- ### Quick Start
30
+ ### Quick start
34
31
 
35
32
  #### With Bundler
36
33
 
@@ -56,7 +53,7 @@ and then require the New Relic Ruby agent in your Ruby start-up sequence:
56
53
  require 'newrelic_rpm'
57
54
  ```
58
55
 
59
- #### Other Environments
56
+ #### Other environments
60
57
 
61
58
  Assuming you have installed the agent per above, you may also need to tell the Ruby agent to start for some frameworks and non-framework environments. To do so, add the following to your Ruby start-up sequence start the agent:
62
59
 
@@ -64,29 +61,29 @@ Assuming you have installed the agent per above, you may also need to tell the R
64
61
  NewRelic::Agent.manual_start
65
62
  ```
66
63
 
67
- ### Complete Install Instructions
64
+ ### Complete install instructions
68
65
 
69
66
  For complete documentation on installing the New Relic Ruby agent, see the following links:
70
67
 
71
68
  * [Introduction](https://docs.newrelic.com/docs/agents/ruby-agent/getting-started/introduction-new-relic-ruby)
72
- * [Install the New Relic Ruby agent](https://docs.newrelic.com/docs/agents/ruby-agent/installation/install-new-relic-ruby-agent)
69
+ * [Install the New Relic Ruby agent](https://docs.newrelic.com/docs/agents/ruby-agent/installation/install-new-relic-ruby-agent). See also these docs that cover specific install scenarios:
70
+ * [Rails plugin installation](https://docs.newrelic.com/docs/agents/ruby-agent/installation/ruby-agent-installation-rails-plugin)
71
+ * [AWS Lambda](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/instrument-your-own/)
72
+ * [GAE Flexible Environment](https://docs.newrelic.com/docs/agents/ruby-agent/installation/install-new-relic-ruby-agent-gae-flexible-environment)
73
+ * [Pure Rack apps](http://docs.newrelic.com/docs/ruby/rack-middlewares)
74
+ * [Ruby agent and Heroku](https://docs.newrelic.com/docs/agents/ruby-agent/installation/ruby-agent-heroku)
75
+ * [Background jobs](https://docs.newrelic.com/docs/agents/ruby-agent/background-jobs/monitor-ruby-background-processes)
73
76
  * [Configure the agent](https://docs.newrelic.com/docs/agents/ruby-agent/configuration/ruby-agent-configuration)
74
77
  * [Update the agent](https://docs.newrelic.com/docs/agents/ruby-agent/installation/update-ruby-agent)
75
- * [Rails plugin installation](https://docs.newrelic.com/docs/agents/ruby-agent/installation/ruby-agent-installation-rails-plugin)
76
- * [GAE Flexible Environment](https://docs.newrelic.com/docs/agents/ruby-agent/installation/install-new-relic-ruby-agent-gae-flexible-environment)
77
- * [Pure Rack Apps](http://docs.newrelic.com/docs/ruby/rack-middlewares)
78
- * [Ruby agent and Heroku](https://docs.newrelic.com/docs/agents/ruby-agent/installation/ruby-agent-heroku)
79
- * [Background Jobs](https://docs.newrelic.com/docs/agents/ruby-agent/background-jobs/monitor-ruby-background-processes)
80
78
  * [Uninstall the Ruby agent](https://docs.newrelic.com/docs/agents/ruby-agent/installation/uninstall-ruby-agent)
81
79
 
82
- ### Recording Deploys
80
+ ### Recording deploys
83
81
 
84
82
  The Ruby agent supports recording deployments in New Relic via a command line
85
83
  tool or Capistrano recipes. For more information on these features, see
86
84
  [our deployment documentation](http://docs.newrelic.com/docs/ruby/recording-deployments-with-the-ruby-agent)
87
85
  for more information.
88
86
 
89
-
90
87
  ## Support
91
88
 
92
89
  Should you need assistance with New Relic products, you are in good hands with several support diagnostic tools and support channels.
@@ -97,11 +94,10 @@ New Relic offers NRDiag, [a client-side diagnostic utility](https://docs.newreli
97
94
 
98
95
  If the issue has been confirmed as a bug or is a Feature request, please file a GitHub issue.
99
96
 
100
- **Support Channels**
97
+ **Support channels**
101
98
 
102
99
  * [New Relic Documentation](https://docs.newrelic.com/docs/agents/ruby-agent): Comprehensive guidance for using our platform
103
100
  * [New Relic Community](https://forum.newrelic.com): The best place to engage in troubleshooting questions
104
- * [New Relic Developer](https://developer.newrelic.com/): Resources for building a custom observability applications
105
101
  * [New Relic University](https://learn.newrelic.com/): A range of online training for New Relic users of every level
106
102
  * [New Relic Technical Support](https://support.newrelic.com/) 24/7/365 ticketed support. Read more about our [Technical Support Offerings](https://docs.newrelic.com/docs/licenses/license-information/general-usage-licenses/support-plan).
107
103
 
@@ -135,7 +131,7 @@ As of version 6.12 (released July 16, 2020), the New Relic Ruby agent is license
135
131
 
136
132
  The New Relic Ruby agent may use source code from third-party libraries. When used, these libraries will be outlined in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
137
133
 
138
- ## Thank You
134
+ ## Thank you
139
135
 
140
136
  We always look forward to connecting with the community. We welcome [contributions](https://github.com/newrelic/newrelic-ruby-agent#contributing) to our source code and suggestions for improvements, and would love to hear about what you like and want to see in the future.
141
137
 
data/lib/boot/strap.rb CHANGED
@@ -44,14 +44,15 @@ module NRBundlerPatch
44
44
  NR_AGENT_GEM = 'newrelic_rpm'
45
45
 
46
46
  def require(*_groups)
47
- super
48
-
49
47
  require_newrelic
48
+
49
+ super
50
50
  end
51
51
 
52
52
  def require_newrelic
53
53
  lib = File.expand_path('../..', __FILE__)
54
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
54
+ $LOAD_PATH.reject! { |path| path.include?('newrelic_rpm') }
55
+ $LOAD_PATH.unshift(lib)
55
56
  Kernel.require NR_AGENT_GEM
56
57
  end
57
58
  end
@@ -13,6 +13,7 @@ require 'new_relic/traced_thread'
13
13
  require 'new_relic/coerce'
14
14
  require 'new_relic/agent/autostart'
15
15
  require 'new_relic/agent/harvester'
16
+ require 'new_relic/agent/health_check'
16
17
  require 'new_relic/agent/hostname'
17
18
  require 'new_relic/agent/new_relic_service'
18
19
  require 'new_relic/agent/pipe_service'
@@ -88,6 +89,7 @@ module NewRelic
88
89
  end
89
90
 
90
91
  def init_components
92
+ @health_check = HealthCheck.new
91
93
  @service = NewRelicService.new
92
94
  @events = EventListener.new
93
95
  @stats_engine = StatsEngine.new
@@ -139,6 +141,8 @@ module NewRelic
139
141
  # Holds all the methods defined on NewRelic::Agent::Agent
140
142
  # instances
141
143
  module InstanceMethods
144
+ # the agent control health check file generator
145
+ attr_reader :health_check
142
146
  # the statistics engine that holds all the timeslice data
143
147
  attr_reader :stats_engine
144
148
  # the transaction sampler that handles recording transactions
@@ -68,6 +68,7 @@ module NewRelic
68
68
  def handle_license_error(error)
69
69
  ::NewRelic::Agent.logger.error(error.message,
70
70
  'Visit newrelic.com to obtain a valid license key, or to upgrade your account.')
71
+ NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::INVALID_LICENSE_KEY)
71
72
  disconnect
72
73
  end
73
74
 
@@ -191,6 +192,7 @@ module NewRelic
191
192
  @connected_pid = $$
192
193
  @connect_state = :connected
193
194
  signal_connected
195
+ NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::HEALTHY)
194
196
  rescue NewRelic::Agent::ForceDisconnectException => e
195
197
  handle_force_disconnect(e)
196
198
  rescue NewRelic::Agent::LicenseException => e
@@ -198,6 +200,7 @@ module NewRelic
198
200
  rescue NewRelic::Agent::UnrecoverableAgentException => e
199
201
  handle_unrecoverable_agent_error(e)
200
202
  rescue StandardError, Timeout::Error, NewRelic::Agent::ServerConnectionException => e
203
+ NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_CONNECT)
201
204
  retry if retry_from_error?(e, opts)
202
205
  rescue Exception => e
203
206
  ::NewRelic::Agent.logger.error('Exception of unexpected type during Agent#connect():', e)
@@ -119,6 +119,7 @@ module NewRelic
119
119
  rescue UnrecoverableServerException => e
120
120
  NewRelic::Agent.logger.warn("#{endpoint} data was rejected by remote service, discarding. Error: ", e)
121
121
  rescue ServerConnectionException => e
122
+ NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_CONNECT)
122
123
  log_remote_unavailable(endpoint, e)
123
124
  container.merge!(payload)
124
125
  rescue => e
@@ -133,9 +134,11 @@ module NewRelic
133
134
  rescue ForceRestartException, ForceDisconnectException
134
135
  raise
135
136
  rescue UnrecoverableServerException => e
137
+ NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_CONNECT)
136
138
  NewRelic::Agent.logger.warn('get_agent_commands message was rejected by remote service, discarding. ' \
137
139
  'Error: ', e)
138
140
  rescue ServerConnectionException => e
141
+ NewRelic::Agent.health_check.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_CONNECT)
139
142
  log_remote_unavailable(:get_agent_commands, e)
140
143
  rescue => e
141
144
  NewRelic::Agent.logger.info('Error during check_for_and_handle_agent_commands, will retry later: ', e)
@@ -19,6 +19,9 @@ module NewRelic
19
19
  revert_to_default_configuration
20
20
 
21
21
  @started = nil
22
+
23
+ NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::SHUTDOWN) if NewRelic::Agent.agent.health_check.healthy?
24
+
22
25
  Control.reset
23
26
  end
24
27
 
@@ -86,6 +86,7 @@ module NewRelic
86
86
  # is the worker thread that gathers data and talks to the
87
87
  # server.
88
88
  def handle_force_disconnect(error)
89
+ NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::FORCED_DISCONNECT)
89
90
  ::NewRelic::Agent.logger.warn('Agent received a ForceDisconnectException from the server, disconnecting. ' \
90
91
  "(#{error.message})")
91
92
  disconnect
@@ -36,6 +36,9 @@ module NewRelic
36
36
  # setting up the worker thread and the exit handler to shut
37
37
  # down the agent
38
38
  def check_config_and_start_agent
39
+ # some health statuses, such as invalid license key, are ran before
40
+ # the agent officially starts
41
+ @health_check.create_and_run_health_check_loop
39
42
  return unless monitoring? && has_correct_license_key?
40
43
  return if using_forking_dispatcher?
41
44
 
@@ -129,6 +132,7 @@ module NewRelic
129
132
  if Agent.config[:monitor_mode]
130
133
  true
131
134
  else
135
+ NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::AGENT_DISABLED)
132
136
  ::NewRelic::Agent.logger.warn('Agent configured not to send data in this environment.')
133
137
  false
134
138
  end
@@ -140,6 +144,7 @@ module NewRelic
140
144
  if Agent.config[:license_key] && Agent.config[:license_key].length > 0
141
145
  true
142
146
  else
147
+ NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::MISSING_LICENSE_KEY)
143
148
  ::NewRelic::Agent.logger.warn('No license key found. ' +
144
149
  'This often means your newrelic.yml file was not found, or it lacks a section for the running ' \
145
150
  "environment, '#{NewRelic::Control.instance.env}'. You may also want to try linting your newrelic.yml " \
@@ -160,6 +165,7 @@ module NewRelic
160
165
  if key.length == 40
161
166
  true
162
167
  else
168
+ NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::INVALID_LICENSE_KEY)
163
169
  ::NewRelic::Agent.logger.error("Invalid license key: #{key}")
164
170
  false
165
171
  end
@@ -180,6 +186,7 @@ module NewRelic
180
186
  end
181
187
 
182
188
  unless app_name_configured?
189
+ NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::MISSING_APP_NAME)
183
190
  NewRelic::Agent.logger.error('No application name configured.',
184
191
  'The agent cannot start without at least one. Please check your ',
185
192
  'newrelic.yml and ensure that it is valid and has at least one ',
@@ -9,12 +9,18 @@ module NewRelic
9
9
  HEX_MASK = '7fffffffff80'
10
10
 
11
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
+
12
15
  "arn:aws:#{service}:#{region}:#{account_id}:#{resource}"
13
16
  rescue => e
14
17
  NewRelic::Agent.logger.warn("Failed to create ARN: #{e}")
15
18
  end
16
19
 
17
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
+
18
24
  access_key_id = config.credentials.credentials.access_key_id if config&.credentials&.credentials&.respond_to?(:access_key_id)
19
25
  return unless access_key_id
20
26