newrelic 8.16.0 → 9.0.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.
@@ -5,8 +5,6 @@
5
5
 
6
6
  'use strict'
7
7
 
8
- const semver = require('semver')
9
-
10
8
  function getQuery(shim, original, name, args) {
11
9
  const config = args[0]
12
10
  let statement
@@ -22,12 +20,10 @@ function getQuery(shim, original, name, args) {
22
20
  }
23
21
 
24
22
  module.exports = function initialize(agent, pgsql, moduleName, shim) {
25
- const pgVersion = shim.require('./package.json').version
26
-
27
23
  shim.setDatastore(shim.POSTGRES)
24
+
28
25
  // allows for native wrapping to not happen if not necessary
29
26
  // when env var is true
30
-
31
27
  if (process.env.NODE_PG_FORCE_NATIVE) {
32
28
  return instrumentPGNative(pgsql)
33
29
  }
@@ -36,7 +32,7 @@ module.exports = function initialize(agent, pgsql, moduleName, shim) {
36
32
  // As of pg v7.0.0, Client.query returns a Promise from an async call.
37
33
  // pg supports event based Client.query when a Query object is passed in,
38
34
  // and works similarly in pg version <7.0.0
39
- if (semver.satisfies(pgVersion, '>=7.0.0') && typeof queryArgs[0] === 'string') {
35
+ if (typeof queryArgs[0] === 'string') {
40
36
  return {
41
37
  callback: shim.LAST,
42
38
  query: getQuery,
@@ -58,18 +54,7 @@ module.exports = function initialize(agent, pgsql, moduleName, shim) {
58
54
  // wrapping for native
59
55
  function instrumentPGNative(pg) {
60
56
  shim.wrapReturn(pg, 'Client', clientFactoryWrapper)
61
- shim.wrapReturn(pg.pools, 'Client', clientFactoryWrapper)
62
-
63
- // In pg v5 the Client class used by pg-pool is the same Client
64
- // class as pg.Client. Since querying through the Pool class just
65
- // defers to Client.query in this case we should skip instrumenting
66
- // the Client class on Pool.
67
- // Note: pg v5 was the only version to have both the Pool
68
- // constructor and pg.pools so we can check against pg.pools to only
69
- // instrument pg.Pool on v6 and later.
70
- if (!pg.pools) {
71
- shim.wrapClass(pg, 'Pool', { post: poolPostConstructor, es6: true })
72
- }
57
+ shim.wrapClass(pg, 'Pool', { post: poolPostConstructor, es6: true })
73
58
  }
74
59
 
75
60
  function poolPostConstructor(shim) {
@@ -21,7 +21,6 @@ module.exports = function instrumentations() {
21
21
  'generic-pool': { type: MODULE_TYPE.GENERIC },
22
22
  '@grpc/grpc-js': { module: './instrumentation/grpc-js' },
23
23
  '@hapi/hapi': { type: MODULE_TYPE.WEB_FRAMEWORK },
24
- 'hapi': { type: MODULE_TYPE.WEB_FRAMEWORK },
25
24
  'ioredis': { type: MODULE_TYPE.DATASTORE },
26
25
  'koa': { module: '@newrelic/koa' },
27
26
  'memcached': { type: MODULE_TYPE.DATASTORE },
@@ -36,7 +35,6 @@ module.exports = function instrumentations() {
36
35
  'restify': { type: MODULE_TYPE.WEB_FRAMEWORK },
37
36
  'superagent': { module: '@newrelic/superagent' },
38
37
  'undici': { type: MODULE_TYPE.TRANSACTION },
39
- 'oracle': { type: null },
40
38
  'vision': { type: MODULE_TYPE.WEB_FRAMEWORK },
41
39
  'when': { type: null },
42
40
  'winston': { type: MODULE_TYPE.GENERIC }
@@ -147,13 +147,6 @@ const CASSANDRA = {
147
147
  ALL: DB.PREFIX + 'Cassandra/' + ALL
148
148
  }
149
149
 
150
- const ORACLE = {
151
- PREFIX: 'Oracle',
152
- STATEMENT: DB.STATEMENT + '/Oracle/',
153
- OPERATION: DB.OPERATION + '/Oracle/',
154
- INSTANCE: DB.INSTANCE + '/Oracle/'
155
- }
156
-
157
150
  const EXPRESS = {
158
151
  PREFIX: 'Expressjs/',
159
152
  MIDDLEWARE: MIDDLEWARE.PREFIX + 'Expressjs/',
@@ -329,7 +322,6 @@ module.exports = {
329
322
  MYSQL: MYSQL,
330
323
  NODEJS: NODEJS,
331
324
  NORMALIZED: 'NormalizedUri',
332
- ORACLE: ORACLE,
333
325
  OTHER_TRANSACTION: OTHER_TRANSACTION,
334
326
  POSTGRES: POSTGRES,
335
327
  QUEUETIME: 'WebFrontend/QueueTime',
@@ -16,7 +16,7 @@ const { LOGGING } = require('../metrics/names')
16
16
  * @returns {string}
17
17
  */
18
18
  utils.truncate = function truncate(str) {
19
- if (str.length > OUTPUT_LENGTH) {
19
+ if (typeof str === 'string' && str.length > OUTPUT_LENGTH) {
20
20
  return str.substring(0, MAX_LENGTH) + '...'
21
21
  }
22
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newrelic",
3
- "version": "8.16.0",
3
+ "version": "9.0.0",
4
4
  "author": "New Relic Node.js agent team <nodejs@newrelic.com>",
5
5
  "license": "Apache-2.0",
6
6
  "contributors": [
@@ -108,6 +108,11 @@
108
108
  "name": "Diana Thayer",
109
109
  "email": "dthayer@newrelic.com",
110
110
  "web": "https://newrelic.com"
111
+ },
112
+ {
113
+ "name": "Jordi Gutiérrez Hermoso",
114
+ "email": "jgutierrezhermoso@newrelic.com",
115
+ "web": "https://newrelic.com"
111
116
  }
112
117
  ],
113
118
  "description": "New Relic agent",
@@ -121,7 +126,7 @@
121
126
  ],
122
127
  "homepage": "https://github.com/newrelic/node-newrelic",
123
128
  "engines": {
124
- "node": ">=12.0.0",
129
+ "node": ">=14",
125
130
  "npm": ">=6.0.0"
126
131
  },
127
132
  "directories": {
@@ -129,11 +134,10 @@
129
134
  },
130
135
  "scripts": {
131
136
  "bench": "node ./bin/run-bench.js",
132
- "ca-gen": "./bin/update-ca-bundle.sh",
133
137
  "docker-env": "./bin/docker-env-vars.sh",
134
138
  "docs": "npm ci && jsdoc -c ./jsdoc-conf.json --private -r .",
135
139
  "integration": "npm run prepare-test && npm run sub-install && time tap test/integration/**/**/*.tap.js --timeout=180 --no-coverage --reporter classic",
136
- "prepare-test": "npm run ca-gen && npm run ssl && npm run docker-env",
140
+ "prepare-test": "npm run ssl && npm run docker-env",
137
141
  "lint": "eslint ./*.js lib test bin examples",
138
142
  "lint:fix": "eslint --fix, ./*.js lib test bin examples",
139
143
  "public-docs": "jsdoc -c ./jsdoc-conf.json --tutorials examples/shim api.js lib/shim/ lib/transaction/handle.js && cp examples/shim/*.png out/",
@@ -161,9 +165,9 @@
161
165
  "dependencies": {
162
166
  "@grpc/grpc-js": "^1.5.5",
163
167
  "@grpc/proto-loader": "^0.6.13",
164
- "@newrelic/aws-sdk": "^4.1.1",
165
- "@newrelic/koa": "^6.1.1",
166
- "@newrelic/superagent": "^5.1.0",
168
+ "@newrelic/aws-sdk": "^5.0.0",
169
+ "@newrelic/koa": "^7.0.0",
170
+ "@newrelic/superagent": "^6.0.0",
167
171
  "@tyriar/fibonacci-heap": "^2.0.7",
168
172
  "async": "^3.2.3",
169
173
  "concat-stream": "^2.0.0",
@@ -174,13 +178,13 @@
174
178
  "winston-transport": "^4.5.0"
175
179
  },
176
180
  "optionalDependencies": {
177
- "@newrelic/native-metrics": "^8.0.0"
181
+ "@newrelic/native-metrics": "^9.0.0"
178
182
  },
179
183
  "devDependencies": {
180
184
  "@newrelic/eslint-config": "^0.0.3",
181
185
  "@newrelic/newrelic-oss-cli": "^0.1.2",
182
186
  "@newrelic/proxy": "^2.0.0",
183
- "@newrelic/test-utilities": "^6.5.5",
187
+ "@newrelic/test-utilities": "^7.0.0",
184
188
  "@octokit/rest": "^18.0.15",
185
189
  "@slack/bolt": "^3.7.0",
186
190
  "ajv": "^6.12.6",