newrelic_rpm 6.12.0.367 → 6.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +31 -0
  3. data/.github/ISSUE_TEMPLATE/config.yml +5 -0
  4. data/.github/ISSUE_TEMPLATE/feature_request.md +24 -0
  5. data/.github/actions/annotate/README.md +79 -0
  6. data/.github/actions/annotate/action.yml +6 -0
  7. data/.github/actions/annotate/dist/index.js +433 -0
  8. data/.github/actions/annotate/index.js +25 -0
  9. data/.github/actions/annotate/package-lock.json +172 -0
  10. data/.github/actions/annotate/package.json +30 -0
  11. data/.github/actions/annotate/pre-commit +5 -0
  12. data/.github/actions/build-ruby/README.md +79 -0
  13. data/.github/actions/build-ruby/action.yml +15 -0
  14. data/.github/actions/build-ruby/dist/index.js +52683 -0
  15. data/.github/actions/build-ruby/index.js +514 -0
  16. data/.github/actions/build-ruby/package-lock.json +581 -0
  17. data/.github/actions/build-ruby/package.json +32 -0
  18. data/.github/actions/build-ruby/pre-commit +5 -0
  19. data/.github/pull_request_template.md +16 -0
  20. data/.github/workflows/ci.yml +212 -0
  21. data/.github/workflows/pr_review_checklist.yml +22 -0
  22. data/.github/workflows/release.yml +78 -0
  23. data/.github/workflows/scripts/rubygems-authenticate.py +13 -0
  24. data/.github/workflows/scripts/rubygems-publish.rb +32 -0
  25. data/.github/workflows/snyk.yml +27 -0
  26. data/.github/workflows/stale.yml +21 -0
  27. data/.gitignore +3 -0
  28. data/CHANGELOG.md +81 -8
  29. data/CONTRIBUTING.md +54 -11
  30. data/README.md +40 -16
  31. data/ROADMAP.md +24 -0
  32. data/lib/new_relic/agent.rb +2 -4
  33. data/lib/new_relic/agent/agent.rb +4 -0
  34. data/lib/new_relic/agent/http_clients/uri_util.rb +7 -7
  35. data/lib/new_relic/agent/instrumentation/rake.rb +1 -0
  36. data/lib/new_relic/agent/new_relic_service.rb +25 -3
  37. data/lib/new_relic/agent/transaction/external_request_segment.rb +2 -2
  38. data/lib/new_relic/agent/transaction/segment.rb +9 -5
  39. data/lib/new_relic/version.rb +1 -1
  40. data/lib/tasks/multiverse.rb +9 -0
  41. data/newrelic_rpm.gemspec +0 -1
  42. data/test/agent_helper.rb +6 -0
  43. metadata +29 -8
  44. data/.travis.yml +0 -240
  45. data/CODE_OF_CONDUCT.md +0 -46
  46. data/lib/new_relic/metrics.rb +0 -13
@@ -0,0 +1,21 @@
1
+ name: "Close stale issues"
2
+ on:
3
+ schedule:
4
+ - cron: "0 0 * * *"
5
+
6
+ jobs:
7
+ stale:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/stale@v3
11
+ with:
12
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
13
+ stale-issue-message: 'This has been marked stale after 30 days with no activity. It will be closed in 5 days if there is no activity.'
14
+ stale-pr-message: 'Stale pull request message'
15
+ days-before-stale: 30
16
+ days-before-close: 5
17
+ stale-issue-label: 'stale'
18
+ exempt-issue-labels: 'good first issue,help wanted,in progress,on hold,in review,roadmap'
19
+ stale-pr-label: 'stale'
20
+ exempt-pr-labels: 'on hold,in review'
21
+
data/.gitignore CHANGED
@@ -31,3 +31,6 @@ test/performance/script/log/
31
31
  infinite_tracing/log/
32
32
  infinite_tracing/test/new_relic/infinite_tracing/log
33
33
  test/fixtures/cross_agent_tests/*/README.md
34
+ node_modules/
35
+ yarn.lock
36
+ errors.txt
@@ -1,38 +1,111 @@
1
1
  # New Relic Ruby Agent Release Notes #
2
2
 
3
+ ## v6.13.0
4
+
5
+ * **Bugfix: never use redirect host when accessing preconnect endpoint**
6
+
7
+ When connecting to New Relic, the Ruby Agent uses the value in `Agent.config[:host]` to post a request to the New Relic preconnect endpoint. This endpoint returns a "redirect host" which is the URL to which agents send data from that point on.
8
+
9
+ Previously, if the agent needed to reconnect to the collector, it would incorrectly use this redirect host to call the preconnect
10
+ endpoint, when it should have used the original configured value in `Agent.config[:host]`. The agent now uses the correct host
11
+ for all calls to preconnect.
12
+
13
+ * **Bugfix: calling `add_custom_attributes` no longer modifies the params of the caller**
14
+
15
+ The previous agent's improvements to recording attributes at the span level had an unexpected
16
+ side-effect of modifying the params passed to the API call as duplicated attributes were deleted
17
+ in the process. This is now fixed and params passed in are no longer modified.
18
+
19
+ Thanks to Pete Johns (@johnsyweb) for the PR that resolves this bug.
20
+
21
+ * **Bugfix: `http.url` query parameters spans are now obfuscated**
22
+
23
+ Previously, the agent was recording the full URL of the external requests, including
24
+ the query and fragment parts of the URL as part of the attributes on the external request
25
+ span. This has been fixed so that the URL is obfuscated to filter out potentially sensitive data.
26
+
27
+ * **Use system SSL certificates by default**
28
+
29
+ The Ruby agent previously used a root SSL/TLS certificate bundle by default. Now the agent will attempt to use
30
+ the default system certificates, but will fall back to the bundled certs if there is an issue (and log that this occurred).
31
+
32
+ * **Bugfix: reduce allocations for segment attributes**
33
+
34
+ Previously, every segment received an `Attributes` object on initialization. The agent now lazily creates attributes
35
+ on segments, resulting in a significant reduction in object allocations for a typical transaction.
36
+
37
+ * **Bugfix: eliminate errors around Rake::VERSION with Rails**
38
+
39
+ When running a Rails application with rake tasks, customers could see the following error:
40
+
41
+ * **Prevent connecting agent thread from hanging on shutdown**
42
+
43
+ A bug in `Net::HTTP`'s Gzip decoder can cause the (un-catchable)
44
+ thread-kill exception to be replaced with a (catchable) `Zlib` exception,
45
+ which prevents a connecting agent thread from exiting during shutdown,
46
+ causing the Ruby process to hang indefinitely.
47
+ This workaround checks for an `aborting` thread in the `#connect` exception handler
48
+ and re-raises the exception, allowing a killed thread to continue exiting.
49
+
50
+ Thanks to Will Jordan (@wjordan) for chasing this one down and patching with tests.
51
+
52
+ * **Fix error messages about Rake instrumentation**
53
+
54
+ When running a Rails application with rake tasks, customers could see the following error in logs resulting from
55
+ a small part of rake functionality being loaded with the Rails test runner:
56
+
57
+ ```
58
+ ERROR : Error while detecting rake_instrumentation:
59
+ ERROR : NameError: uninitialized constant Rake::VERSION
60
+ ```
61
+
62
+ Such error messages should no longer appear in this context.
63
+
64
+ Thanks to @CamilleDrapier for pointing out this issue.
65
+
66
+ * **Remove NewRelic::Metrics**
67
+
68
+ The `NewRelic::Metrics` module has been removed from the agent since it is no longer used.
69
+
70
+ Thanks to @csaura for the contribution!
71
+
3
72
  ## v6.12.0
4
73
 
74
+ * The New Relic Ruby Agent is now open source under the [Apache 2 license](LICENSE)
75
+ and you can now observe the project roadmap. See our [Contributing guide](https://github.com/newrelic/newrelic-ruby-agent/blob/main/CONTRIBUTING.md)
76
+ and [Code of Conduct](https://github.com/newrelic/.github/blob/master/CODE_OF_CONDUCT.md) for details on contributing!
77
+
5
78
  * **Security: Updated all uses of Rake to >= 12.3.3**
6
79
 
7
80
  All versions of Rake testing prior to 12.3.3 were removed to address
8
81
  [CVE-2020-8130](https://nvd.nist.gov/vuln/detail/CVE-2020-8130).
9
82
  No functionality in the agent was removed nor deprecated with this change, and older versions
10
- of rake are expected to continue to work as they have in the past. However, versions of
83
+ of rake are expected to continue to work as they have in the past. However, versions of
11
84
  rake < 12.3.3 are no longer tested nor supported.
12
85
 
13
86
  * **Bugfix: fixes an error capturing content length in middleware on multi-part responses**
14
87
 
15
- In the middleware tracing, the `Content-Length` header is sometimes returned as an array of
16
- values when content is a multi-part response. Previously, the agent would fail with
17
- "NoMethodError: undefined method `to_i` for Array" Error. This bug is now fixed and
88
+ In the middleware tracing, the `Content-Length` header is sometimes returned as an array of
89
+ values when content is a multi-part response. Previously, the agent would fail with
90
+ "NoMethodError: undefined method `to_i` for Array" Error. This bug is now fixed and
18
91
  multi-part content lengths are summed for a total when an `Array` is present.
19
-
92
+
20
93
  * **Added support for auto-instrumenting Mongo gem versions 2.6 to 2.12**
21
-
94
+
22
95
  * **Bugfix: MongoDB instrumentation did not handle CommandFailed events when noticing errors**
23
96
 
24
97
  The mongo gem sometimes returns a CommandFailed object instead of a CommandSucceeded object with
25
98
  error attributes populated. The instrumentation did not handle noticing errors on CommandFailed
26
99
  objects and resulted in logging an error and backtrace to the log file.
27
100
 
28
- Additionally, a bug in recording the metric for "findAndModify" as all lowercased "findandmodify"
101
+ Additionally, a bug in recording the metric for "findAndModify" as all lowercased "findandmodify"
29
102
  for versions 2.1 through 2.5 was fixed.
30
103
 
31
104
  * **Bugfix: Priority Sampler causes crash in high throughput environents in rare cases**
32
105
 
33
106
  Previously, the priority sampling buffer would, in rare cases, generate an error in high-throughput
34
107
  environments once capacity is reached and the sampling algorthym engages. This issue is fixed.
35
-
108
+
36
109
  * **Additional Transaction Information applied to Span Events**
37
110
 
38
111
  When Distributed Tracing and/or Infinite Tracing are enabled, the Agent will now incorporate additional information from the Transaction Event on to the root Span Event of the transaction.
@@ -6,8 +6,8 @@ development team.
6
6
 
7
7
  When contributing, keep in mind that the agent runs in a wide variety of Ruby
8
8
  language implementations (e.g. 2.x.x, jruby, etc.) as well as a wide variety of
9
- application environments (e.g. Rails, Sinatra, roll-your-own, etc.) See
10
- https://docs.newrelic.com/docs/agents/ruby-agent/getting-started/ruby-agent-requirements-supported-frameworks
9
+ application environments (e.g. Rails, Sinatra, roll-your-own, etc.) See [Ruby agent requirements and supported frameworks]
10
+ (https://docs.newrelic.com/docs/agents/ruby-agent/getting-started/ruby-agent-requirements-supported-frameworks)
11
11
  for the current full list.
12
12
 
13
13
  Because of this, we need to be more defensive in our coding practices than most
@@ -17,12 +17,52 @@ we can't assume the presence of any specific libraries, including `ActiveSupport
17
17
 
18
18
  ## Process
19
19
 
20
+ ### Version Support
21
+
22
+ When contributing, keep in mind that New Relic customers (that's you!) are
23
+ running many different versions of Ruby, some of them pretty old. Changes that
24
+ depend on the newest version of Ruby will probably be rejected, especially if
25
+ they replace something backwards compatible.
26
+
27
+ Be aware that the instrumentation needs to work with a wide range of versions of
28
+ the instrumented modules, and that code that looks nonsensical or
29
+ overcomplicated may be that way for compatibility-related reasons. Read all the
30
+ comments and check the related tests before deciding whether existing code is
31
+ incorrect.
32
+
33
+ If you are planning on contributing a new feature or an otherwise complex
34
+ contribution, we kindly ask you to start a conversation with the maintainer team
35
+ by opening up an Github issue first.
36
+
37
+
38
+ ### General Guidelines
39
+ The Ruby agent avoids requiring any dependencies in the main agent code base.
40
+ Instrumentations and features that would otherwise require a dependency (such as
41
+ Infinite Tracing, which require gRPC and protobuf) are built as separate gems.
42
+ If you have a feature or instrumentation request that would require a
43
+ dependency, please open an Issue to discuss with the maintainers before
44
+ proceeding.
45
+
46
+ Your code will be evaluated for completeness and accuracy in
47
+ implementation and must be accompanied with appropriate unit tests. New
48
+ additions that do not break existing tests are the easiest and quickest to be
49
+ accepted and merged. New features and improvements that break existing
50
+ functionality are slower to be accepted and merged as they require agreement
51
+ with maintainers across a majority of the languages New Relic supports. Any
52
+ such breaking changes will require a major version bump whereas non-breaking
53
+ additions only lead to minor version bumps.
54
+
55
+ Please be aware that the maintainers of New Relic’s agents aim to have as much
56
+ commonality of functionality across all language agents as makes sense, so we are
57
+ always working to reconcile language-specific changes against the cross-language
58
+ community set of agreements.
59
+
20
60
  ### Feature Requests
21
61
 
22
62
  Feature requests should be submitted in the [Issue tracker](../../issues), with
23
63
  a description of the expected behavior & use case. Before submitting an Issue,
24
64
  please search for similar ones in the [closed
25
- issues](../../issues?q=is%3Aissue+is%3Aclosed+label%3Aenhancement).
65
+ issues](../../issues?q=is%3Aissue+is%3Aclosed).
26
66
 
27
67
  ### Pull Requests
28
68
 
@@ -31,9 +71,9 @@ licensing restrictions.
31
71
 
32
72
  ### Code of Conduct
33
73
 
34
- Before contributing please read the [code of conduct](./CODE_OF_CONDUCT.md)
74
+ Before contributing please read the [code of conduct](https://github.com/newrelic/.github/blob/master/CODE_OF_CONDUCT.md)
35
75
 
36
- Note that our [code of conduct](./CODE_OF_CONDUCT.md) applies to all platforms
76
+ Note that our [code of conduct](https://github.com/newrelic/.github/blob/master/CODE_OF_CONDUCT.md) applies to all platforms
37
77
  and venues related to this project; please follow it in all your interactions
38
78
  with the project and its participants.
39
79
 
@@ -61,13 +101,16 @@ Running the test suite is simple. Just invoke:
61
101
  bundle
62
102
  bundle exec rake
63
103
 
64
- This will run the unit tests in standalone mode, bootstrapping a basic Rails
65
- 3.2 environment for the agent to instrument, then executing the test suite.
104
+ This will run the unit tests in standalone mode. You can run against a specific Rails version
105
+ by passing the version name (which should match the name of a subdirectory in test/environments)
106
+ as an argument to the test:env rake task, like this:
107
+
108
+ bundle exec rake test:env[rails60]
66
109
 
67
110
  These tests are setup to run automatically in
68
- [Travis CI](https://travis-ci.org/newrelic/rpm) under several Ruby implementations.
69
- When you've pushed your changes to GitHub, you can confirm that the Travis
70
- build passes for your fork.
111
+ [GitHub Actions](https://github.com/newrelic/newrelic-ruby-agent/actions) under several
112
+ Ruby implementations. When you've pushed your changes to GitHub, you can confirm that
113
+ the GitHub Actions test matrix passes for your fork.
71
114
 
72
115
  Additionally, our own CI jobs runs these tests under multiple versions of Rails
73
116
  to verify compatibility.
@@ -124,7 +167,7 @@ practices. Like all official New Relic open source projects, there's a related
124
167
  Community topic in the New Relic Explorers Hub. You can find this project's
125
168
  topic/threads here:
126
169
 
127
- [Explorer's Hub](https://discuss.newrelic.com/c/support-products-agents/ruby-agent)
170
+ [Explorer's Hub](https://discuss.newrelic.com/tags/rubyagent)
128
171
 
129
172
  ## And Finally...
130
173
 
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
- [![Community Project header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Project.png)](https://opensource.newrelic.com/oss-category/#community-project)
1
+ [![Community Plus header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus)
2
2
 
3
3
  # New Relic Ruby Agent
4
4
 
5
- The New Relic Ruby agent monitors your applications to help you
6
- [identify and solve performance issues](https://docs.newrelic.com/docs/agents/ruby-agent/getting-started/introduction-new-relic-ruby#monitor-performance).
7
- You can also extend the agent's performance monitoring to
8
- [collect and analyze business data](https://docs.newrelic.com/docs/agents/ruby-agent/getting-started/introduction-new-relic-ruby#business-data)
5
+ The New Relic Ruby agent monitors your applications to help you
6
+ [identify and solve performance issues](https://docs.newrelic.com/docs/agents/ruby-agent/getting-started/introduction-new-relic-ruby#monitor-performance).
7
+ You can also extend the agent's performance monitoring to
8
+ [collect and analyze business data](https://docs.newrelic.com/docs/agents/ruby-agent/getting-started/introduction-new-relic-ruby#business-data)
9
9
  to help you improve the customer experience and make data-driven business decisions.
10
10
 
11
11
  The New Relic Ruby Agent is dual-purposed as a either a Gem or a Rails plugin,
@@ -79,29 +79,53 @@ for more information.
79
79
 
80
80
  ## Support
81
81
 
82
- New Relic hosts and moderates an online forum where customers can interact with New Relic employees as well as other customers to get help and share best practices. Like all official New Relic open source projects, there's a related Community topic in the New Relic Explorers Hub. You can find this project's topic/threads here:
82
+ Should you need assistance with New Relic products, you are in good hands with several support diagnostic tools and support channels.
83
83
 
84
- https://discuss.newrelic.com/c/support-products-agents/ruby-agent
84
+ This [troubleshooting framework](https://discuss.newrelic.com/t/ruby-troubleshooting-framework-install/108685) steps you through common troubleshooting questions.
85
+
86
+ New Relic offers NRDiag, [a client-side diagnostic utility](https://docs.newrelic.com/docs/using-new-relic/cross-product-functions/troubleshooting/new-relic-diagnostics) that automatically detects common problems with New Relic agents. If NRDiag detects a problem, it suggests troubleshooting steps. NRDiag can also automatically attach troubleshooting data to a New Relic Support ticket.
87
+
88
+ If the issue has been confirmed as a bug or is a Feature request, please file a Github issue.
89
+
90
+ **Support Channels**
91
+
92
+ * [New Relic Documentation](https://docs.newrelic.com/docs/agents/ruby-agent): Comprehensive guidance for using our platform
93
+ * [New Relic Community](https://discuss.newrelic.com/tags/rubyagent): The best place to engage in troubleshooting questions
94
+ * [New Relic Developer](https://developer.newrelic.com/): Resources for building a custom observability applications
95
+ * [New Relic University](https://learn.newrelic.com/): A range of online training for New Relic users of every level
96
+ * [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).
97
+
98
+ ## Privacy
99
+
100
+ At New Relic we take your privacy and the security of your information seriously, and are committed to protecting your information. We must emphasize the importance of not sharing personal data in public forums, and ask all users to scrub logs and diagnostic information for sensitive information, whether personal, proprietary, or otherwise.
101
+
102
+ We define “Personal Data” as any information relating to an identified or identifiable individual, including, for example, your name, phone number, post code or zip code, Device ID, IP address and email address.
103
+
104
+ Please review [New Relic’s General Data Privacy Notice](https://newrelic.com/termsandconditions/privacy) for more information.
105
+
106
+ ## Roadmap
107
+ See our [roadmap](https://github.com/newrelic/newrelic-ruby-agent/blob/main/ROADMAP.md), to learn more about our product vision, understand our plans, and provide us valuable feedback.
85
108
 
86
109
  ## Contributing
87
110
 
88
111
  We encourage contributions to improve the New Relic Ruby agent! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.
89
112
  If you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company, please drop us an email at opensource@newrelic.com.
90
113
 
91
- If you would like to contribute to this project, please review [these guidelines](./CONTRIBUTING.md).
114
+ **A note about vulnerabilities**
115
+
116
+ As noted in our [security policy](https://github.com/newrelic/newrelic-ruby-agent/security/policy), New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.
117
+
118
+ If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through [HackerOne](https://hackerone.com/newrelic).
119
+
120
+ If you would like to contribute to this project, please review [these guidelines](https://github.com/newrelic/newrelic-ruby-agent/blob/main/CONTRIBUTING.md).
92
121
 
93
- To [all contributors](https://github.com/newrelic/newrelic-ruby-agent/graphs/contributors), we thank you! Without your contribution, this project would not be what it is today. We also host a community project page dedicated to
122
+ To [all contributors](https://github.com/newrelic/newrelic-ruby-agent/graphs/contributors), we thank you! Without your contribution, this project would not be what it is today. We also host a community project page dedicated to
94
123
  the [New Relic Ruby agent](https://opensource.newrelic.com/projects/newrelic/newrelic-ruby-agent).
95
124
 
96
125
  ## License
97
126
 
98
127
  The New Relic Ruby agent is licensed under the [Apache 2.0](http://apache.org/licenses/LICENSE-2.0.txt) License.
99
- The New Relic Ruby agent also uses source code from third-party libraries. Full details on which libraries are used and the terms under which they are licensed can be found in the [THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md).
100
-
101
- ## Support
102
-
103
- You can find more detailed documentation [on our website](http://newrelic.com/docs),
104
- and specifically in the [Ruby category](http://newrelic.com/docs/ruby).
128
+ The New Relic Ruby agent also uses source code from third-party libraries. Full details on which libraries are used and the terms under which they are licensed can be found in the [THIRD_PARTY_NOTICES.md](https://github.com/newrelic/newrelic-ruby-agent/blob/main/THIRD_PARTY_NOTICES.md).
105
129
 
106
130
  ## Thank You
107
131
 
@@ -109,4 +133,4 @@ Thank you, and may your application scale to infinity plus one.
109
133
 
110
134
  Lew Cirne, Founder and CEO
111
135
 
112
- New Relic, Inc.
136
+ New Relic, Inc.
@@ -0,0 +1,24 @@
1
+ # Ruby Agent Roadmap
2
+
3
+ ## Product Vision
4
+ The goal of the Ruby agent is to provide complete visibility into the health of your service. The agent provides metrics about the runtime health of your service and the process it runs in, and traces that show how specific requests are performing. It also provides information about the environment in which it is running, so you can identify issues with specific hosts, regions, deployments, and other facets.
5
+
6
+ New Relic is moving toward OpenTelemetry. OpenTelemetry is a unified standard for service instrumentation. You will soon see an updated version of the agent that uses the OpenTelemetry SDK and auto-instrumentation as its foundation. OpenTelemetry will include a broad set of high-quality community-contributed instrumentation and a powerful vendor-neutral API for adding your own instrumentation.
7
+
8
+
9
+ ## Roadmap
10
+ ### Description
11
+ This roadmap project is broken down into the following sections:
12
+
13
+ - **Now**:
14
+ - This section contains features that are currently in progress.
15
+ - **Next**:
16
+ - This section contains work planned within the next three months. These features may still be deprioritized and moved to Future.
17
+ - **Future**:
18
+ - This section is for ideas for future work that is aligned with the product vision and possible opportunities for community contribution. It contains a list of features that anyone can implement. No guarantees can be provided on if or when these features will be completed.
19
+
20
+
21
+ **The roadmap project is found [here](https://github.com/orgs/newrelic/projects/12)**
22
+
23
+ #### Disclaimers
24
+ > This roadmap is subject to change at any time. Future items should not be considered commitments.
@@ -26,7 +26,6 @@ module NewRelic
26
26
 
27
27
  require 'new_relic/version'
28
28
  require 'new_relic/local_environment'
29
- require 'new_relic/metrics'
30
29
  require 'new_relic/metric_spec'
31
30
  require 'new_relic/metric_data'
32
31
  require 'new_relic/noticed_error'
@@ -587,9 +586,8 @@ module NewRelic
587
586
  segment = ::NewRelic::Agent::Tracer.current_segment
588
587
  if segment
589
588
  # Make sure not to override existing segment-level custom attributes
590
- segment_custom_keys = segment.attributes.custom_attributes.keys
591
- segment_custom_keys.each { |k| params.delete k.to_sym }
592
- segment.add_custom_attributes(params)
589
+ segment_custom_keys = segment.attributes.custom_attributes.keys.map(&:to_sym)
590
+ segment.add_custom_attributes(params.reject { |k, _v| segment_custom_keys.include?(k.to_sym) })
593
591
  end
594
592
  else
595
593
  ::NewRelic::Agent.logger.warn("Bad argument passed to #add_custom_attributes. Expected Hash but got #{params.class}")
@@ -953,6 +953,10 @@ module NewRelic
953
953
  rescue NewRelic::Agent::UnrecoverableAgentException => e
954
954
  handle_unrecoverable_agent_error(e)
955
955
  rescue StandardError, Timeout::Error, NewRelic::Agent::ServerConnectionException => e
956
+ # Allow a killed (aborting) thread to continue exiting during shutdown.
957
+ # See: https://github.com/newrelic/newrelic-ruby-agent/issues/340
958
+ raise if Thread.current.status == 'aborting'
959
+
956
960
  log_error(e)
957
961
  if opts[:keep_retrying]
958
962
  note_connect_failure
@@ -15,13 +15,13 @@ module NewRelic
15
15
  module HTTPClients
16
16
  module URIUtil
17
17
 
18
- def self.filter_uri(original)
19
- filtered = original.dup
20
- filtered.user = nil
21
- filtered.password = nil
22
- filtered.query = nil
23
- filtered.fragment = nil
24
- filtered.to_s
18
+ def self.obfuscated_uri(url)
19
+ parse_and_normalize_url(url).tap do |obfuscated|
20
+ obfuscated.user = nil
21
+ obfuscated.password = nil
22
+ obfuscated.query = nil
23
+ obfuscated.fragment = nil
24
+ end
25
25
  end
26
26
 
27
27
  # There are valid URI strings that some HTTP client libraries will
@@ -8,6 +8,7 @@ DependencyDetection.defer do
8
8
 
9
9
  depends_on do
10
10
  defined?(::Rake) &&
11
+ defined?(::Rake::VERSION) &&
11
12
  ::NewRelic::Agent.config[:'disable_rake'] == false &&
12
13
  ::NewRelic::Agent.config[:'rake.tasks'].any? &&
13
14
  ::NewRelic::Agent::Instrumentation::RakeInstrumentation.should_install?
@@ -38,8 +38,10 @@ module NewRelic
38
38
  def initialize(license_key=nil, collector=control.server)
39
39
  @license_key = license_key
40
40
  @collector = collector
41
+ @configured_collector = collector
41
42
  @request_timeout = Agent.config[:timeout]
42
43
  @ssl_cert_store = nil
44
+ @use_bundled_certs = false
43
45
  @in_session = nil
44
46
  @agent_id = nil
45
47
  @shared_tcp_connection = nil
@@ -290,12 +292,20 @@ module NewRelic
290
292
  # installed
291
293
  conn.use_ssl = true
292
294
  conn.verify_mode = OpenSSL::SSL::VERIFY_PEER
293
- conn.cert_store = ssl_cert_store
295
+ set_cert_store(conn)
294
296
  rescue StandardError, LoadError
295
297
  msg = "SSL is not available in the environment; please install SSL support."
296
298
  raise UnrecoverableAgentException.new(msg)
297
299
  end
298
300
 
301
+ def set_cert_store(conn)
302
+ if @use_bundled_certs || NewRelic::Agent.config[:ca_bundle_path]
303
+ conn.cert_store = ssl_cert_store
304
+ else
305
+ ::NewRelic::Agent.logger.debug("Using default security certificates")
306
+ end
307
+ end
308
+
299
309
  def start_connection(conn)
300
310
  NewRelic::Agent.logger.debug("Opening TCP connection to #{conn.address}:#{conn.port}")
301
311
  Timeout.timeout(@request_timeout) { conn.start }
@@ -337,6 +347,14 @@ module NewRelic
337
347
  conn = create_http_connection
338
348
  start_connection(conn)
339
349
  conn
350
+ rescue Timeout::Error
351
+ if @use_bundled_certs == false
352
+ ::NewRelic::Agent.logger.info("Unable to connect. Falling back to bundled security certificates")
353
+ @use_bundled_certs = true
354
+ retry
355
+ else
356
+ raise
357
+ end
340
358
  end
341
359
 
342
360
  # The path to the certificate file used to verify the SSL
@@ -346,6 +364,7 @@ module NewRelic
346
364
  NewRelic::Agent.logger.warn("Couldn't find CA bundle from configured ca_bundle_path: #{path_override}") unless File.exist? path_override
347
365
  path_override
348
366
  else
367
+ ::NewRelic::Agent.increment_metric("Supportability/Ruby/Certificate/BundleRequired")
349
368
  File.expand_path(File.join(control.newrelic_root, 'cert', 'cacert.pem'))
350
369
  end
351
370
  end
@@ -415,15 +434,18 @@ module NewRelic
415
434
  data, encoding = compress_request_if_needed(data, method)
416
435
  size = data.size
417
436
 
437
+ # Preconnect needs to always use the configured collector host, not the redirect host
438
+ endpoint_specific_collector = (method == :preconnect) ? @configured_collector : @collector
439
+
418
440
  uri = remote_method_uri(method)
419
- full_uri = "#{@collector}#{uri}"
441
+ full_uri = "#{endpoint_specific_collector}#{uri}"
420
442
 
421
443
  @audit_logger.log_request(full_uri, payload, @marshaller)
422
444
  request_send_ts = Time.now
423
445
  response = send_request(:data => data,
424
446
  :uri => uri,
425
447
  :encoding => encoding,
426
- :collector => @collector,
448
+ :collector => endpoint_specific_collector,
427
449
  :endpoint => method)
428
450
  response_check_ts = Time.now
429
451
  @marshaller.load(decompress_response(response))