newrelic 7.5.0 → 7.5.1

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.
package/NEWS.md CHANGED
@@ -1,3 +1,15 @@
1
+ ### v7.5.1 (2021-06-21)
2
+
3
+ * Fixed loading config from the main module's directory. Thank you @alexpls for the contribution.
4
+
5
+ * Moved all integration tests that required secrets to the smoke folder.
6
+
7
+ * Fixed LASP/CSP tests so they don't skip on runs where secrets are available.
8
+
9
+ * Modified self-signed SSL cert to use 'localhost' instead of 'ssl.lvh.me' for SSL testing.
10
+
11
+ * Removed unnecessary trace observer configuration validation for host and port.
12
+
1
13
  ### v7.5.0 (2021-06-01)
2
14
 
3
15
  * Added default support for config files with a 'cjs' extension (`newrelic.cjs`) in addition to `newrelic.js`.
@@ -56,14 +56,13 @@ const getConfigFileLocations = () => [
56
56
  process.env.NEW_RELIC_HOME,
57
57
  process.cwd(),
58
58
  process.env.HOME,
59
- path.join(__dirname, '../../../..') // above node_modules
59
+ path.join(__dirname, '../../../..'), // above node_modules
60
+ // the REPL has no main module
61
+ process.mainModule && process.mainModule.filename
62
+ ? path.dirname(process.mainModule.filename)
63
+ : undefined
60
64
  ].filter(Boolean)
61
65
 
62
- // the REPL has no main module
63
- if (process.mainModule && process.mainModule.filename) {
64
- getConfigFileLocations().splice(2, 0, path.dirname(process.mainModule.filename))
65
- }
66
-
67
66
  function isTruthular(setting) {
68
67
  if (setting == null) {
69
68
  return false
@@ -11,22 +11,31 @@ const SpanEventAggregator = require('./span-event-aggregator')
11
11
  const StreamingSpanEventAggregator = require('./streaming-span-event-aggregator')
12
12
 
13
13
  function createSpanEventAggregator(config, collector, metrics) {
14
+ const trace_observer = config.infinite_tracing.trace_observer
15
+
14
16
  let shouldCreateStreaming = false
15
- if (config.infinite_tracing.trace_observer.host) {
17
+ if (trace_observer.host) {
16
18
  // TODO: ideally this validation and configuration clearing would happen
17
19
  // in the config. Since we don't currently have a way to generate
18
20
  // support metrics in the config, keeping this related logic together here.
19
21
  // If logic happened prior, could merely check for existence of trace_observer.host.
20
- shouldCreateStreaming = validateInfiniteTracing(config.infinite_tracing.trace_observer)
22
+ shouldCreateStreaming = validateInfiniteTracing()
21
23
 
22
24
  if (!shouldCreateStreaming) {
23
25
  // Explicitly disable for any downstream consumers
24
- config.infinite_tracing.trace_observer.host = ''
25
- config.infinite_tracing.trace_observer.port = ''
26
+ trace_observer.host = ''
27
+ trace_observer.port = ''
26
28
  }
27
29
  }
28
30
 
29
31
  if (shouldCreateStreaming) {
32
+ trace_observer.host = trace_observer.host.trim()
33
+
34
+ if (typeof trace_observer.port !== 'string') {
35
+ trace_observer.port = String(trace_observer.port)
36
+ }
37
+ trace_observer.port = trace_observer.port.trim()
38
+
30
39
  return createStreamingAggregator(config, collector, metrics)
31
40
  }
32
41
 
@@ -71,7 +80,7 @@ function createStandardAggregator(config, collector, metrics) {
71
80
  return aggregator
72
81
  }
73
82
 
74
- function validateInfiniteTracing(trace_observer) {
83
+ function validateInfiniteTracing() {
75
84
  // TODO: Remove semver check when Node 10 support dropped.
76
85
  if (!psemver.satisfies('>=10.10.0')) {
77
86
  logger.warn(
@@ -80,40 +89,7 @@ function validateInfiniteTracing(trace_observer) {
80
89
  return false
81
90
  }
82
91
 
83
- trace_observer.host = trace_observer.host.trim()
84
-
85
- if (!validateHostName(trace_observer.host)) {
86
- logger.warn('Infinite tracing disabled: invalid infinite_tracing.trace_observer.host value')
87
-
88
- return false
89
- }
90
-
91
- if (typeof trace_observer.port !== 'string') {
92
- trace_observer.port = String(trace_observer.port)
93
- }
94
-
95
- trace_observer.port = trace_observer.port.trim()
96
-
97
- if (!validatePortValue(trace_observer.port)) {
98
- logger.warn('Infinite tracing disabled: invalid infinite_tracing.trace_observer.port value')
99
-
100
- return false
101
- }
102
-
103
92
  return true
104
93
  }
105
94
 
106
- function validateHostName(host) {
107
- // Regular expression for validating a hostname
108
- const hostReg = /(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{0,62}[a-zA-Z0-9]\.)+[a-zA-Z]{2,63}$)/
109
-
110
- return hostReg.test(host)
111
- }
112
-
113
- function validatePortValue(port) {
114
- if (port.length === 0) return false
115
-
116
- return !isNaN(port)
117
- }
118
-
119
95
  module.exports = createSpanEventAggregator
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newrelic",
3
- "version": "7.5.0",
3
+ "version": "7.5.1",
4
4
  "author": "New Relic Node.js agent team <nodejs@newrelic.com>",
5
5
  "license": "Apache-2.0",
6
6
  "contributors": [
@@ -120,16 +120,15 @@
120
120
  "scripts": {
121
121
  "bench": "node ./bin/run-bench.js",
122
122
  "ca-gen": "./bin/update-ca-bundle.sh",
123
- "clean": "./bin/clean.sh",
124
123
  "docker-env": "./bin/docker-env-vars.sh",
125
124
  "docs": "npm ci && jsdoc -c ./jsdoc-conf.json --private -r .",
126
125
  "integration": "npm run prepare-test && npm run sub-install && time tap --no-esm test/integration/**/**/*.tap.js --timeout=180 --no-coverage",
127
- "prepare-test": "npm ci && npm run ca-gen && npm run ssl && npm run docker-env",
126
+ "prepare-test": "npm run ca-gen && npm run ssl && npm run docker-env",
128
127
  "lint": "eslint ./*.js lib test bin",
129
128
  "public-docs": "npm ci && jsdoc -c ./jsdoc-conf.json --tutorials examples/shim api.js lib/shim/ lib/transaction/handle.js && cp examples/shim/*.png out/",
130
129
  "publish-docs": "./bin/publish-docs.sh",
131
130
  "services": "./bin/docker-services.sh",
132
- "smoke": "npm run clean && ./bin/smoke.sh",
131
+ "smoke": "npm run ssl && time tap test/smoke/**/**/*.tap.js --timeout=180 --no-coverage",
133
132
  "ssl": "./bin/ssl.sh",
134
133
  "sub-install": "node test/bin/install_sub_deps",
135
134
  "test": "npm run integration && npm run unit",