dd-trace 2.6.0 → 2.8.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.
- package/LICENSE-3rdparty.csv +1 -4
- package/index.d.ts +0 -7
- package/package.json +18 -24
- package/packages/datadog-instrumentations/index.js +16 -0
- package/packages/datadog-instrumentations/src/amqp10.js +33 -32
- package/packages/datadog-instrumentations/src/amqplib.js +16 -11
- package/packages/datadog-instrumentations/src/aws-sdk.js +104 -0
- package/packages/datadog-instrumentations/src/cassandra-driver.js +53 -51
- package/packages/datadog-instrumentations/src/connect.js +111 -0
- package/packages/datadog-instrumentations/src/couchbase.js +41 -39
- package/packages/datadog-instrumentations/src/cucumber.js +38 -38
- package/packages/datadog-instrumentations/src/dns.js +20 -19
- package/packages/datadog-instrumentations/src/elasticsearch.js +30 -32
- package/packages/datadog-instrumentations/src/express.js +27 -0
- package/packages/datadog-instrumentations/src/fastify.js +187 -0
- package/packages/datadog-instrumentations/src/find-my-way.js +30 -0
- package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +100 -0
- package/packages/datadog-instrumentations/src/hapi.js +210 -0
- package/packages/datadog-instrumentations/src/http/client.js +44 -44
- package/packages/datadog-instrumentations/src/http/server.js +15 -13
- package/packages/datadog-instrumentations/src/ioredis.js +16 -17
- package/packages/datadog-instrumentations/src/jest.js +22 -17
- package/packages/datadog-instrumentations/src/kafkajs.js +112 -0
- package/packages/datadog-instrumentations/src/knex.js +20 -0
- package/packages/datadog-instrumentations/src/koa.js +159 -0
- package/packages/datadog-instrumentations/src/limitd-client.js +21 -0
- package/packages/datadog-instrumentations/src/memcached.js +14 -12
- package/packages/datadog-instrumentations/src/mocha.js +37 -39
- package/packages/datadog-instrumentations/src/moleculer/client.js +46 -0
- package/packages/datadog-instrumentations/src/moleculer/server.js +59 -0
- package/packages/datadog-instrumentations/src/moleculer.js +4 -0
- package/packages/datadog-instrumentations/src/mongodb-core.js +29 -33
- package/packages/datadog-instrumentations/src/mysql.js +30 -29
- package/packages/datadog-instrumentations/src/mysql2.js +8 -9
- package/packages/datadog-instrumentations/src/net.js +23 -24
- package/packages/datadog-instrumentations/src/oracledb.js +128 -0
- package/packages/datadog-instrumentations/src/paperplane.js +77 -0
- package/packages/datadog-instrumentations/src/pg.js +32 -32
- package/packages/datadog-instrumentations/src/redis.js +49 -47
- package/packages/datadog-instrumentations/src/restify.js +58 -0
- package/packages/datadog-instrumentations/src/rhea.js +52 -50
- package/packages/datadog-instrumentations/src/router.js +177 -0
- package/packages/datadog-instrumentations/src/sharedb.js +20 -20
- package/packages/datadog-instrumentations/src/tedious.js +19 -19
- package/packages/datadog-plugin-amqp10/src/index.js +2 -7
- package/packages/datadog-plugin-amqplib/src/index.js +1 -2
- package/packages/datadog-plugin-aws-sdk/src/base.js +146 -0
- package/packages/datadog-plugin-aws-sdk/src/index.js +16 -106
- package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +4 -2
- package/packages/datadog-plugin-aws-sdk/src/services/default.js +7 -0
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +3 -1
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +5 -4
- package/packages/datadog-plugin-aws-sdk/src/services/index.js +12 -0
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +4 -3
- package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +4 -3
- package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +3 -1
- package/packages/datadog-plugin-aws-sdk/src/services/s3.js +3 -1
- package/packages/datadog-plugin-aws-sdk/src/services/sns.js +4 -3
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +45 -6
- package/packages/datadog-plugin-cassandra-driver/src/index.js +1 -5
- package/packages/datadog-plugin-connect/src/index.js +10 -114
- package/packages/datadog-plugin-couchbase/src/index.js +3 -4
- package/packages/datadog-plugin-cucumber/src/index.js +1 -9
- package/packages/datadog-plugin-dns/src/index.js +15 -5
- package/packages/datadog-plugin-elasticsearch/src/index.js +1 -5
- package/packages/datadog-plugin-express/src/index.js +11 -25
- package/packages/datadog-plugin-fastify/src/index.js +17 -4
- package/packages/datadog-plugin-find-my-way/src/index.js +20 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/index.js +56 -111
- package/packages/datadog-plugin-hapi/src/index.js +34 -3
- package/packages/datadog-plugin-http/src/client.js +1 -3
- package/packages/datadog-plugin-http/src/server.js +2 -6
- package/packages/datadog-plugin-jest/src/index.js +2 -3
- package/packages/datadog-plugin-kafkajs/src/index.js +61 -91
- package/packages/datadog-plugin-koa/src/index.js +12 -164
- package/packages/datadog-plugin-memcached/src/index.js +1 -5
- package/packages/datadog-plugin-mocha/src/index.js +3 -7
- package/packages/datadog-plugin-moleculer/src/client.js +34 -44
- package/packages/datadog-plugin-moleculer/src/index.js +32 -3
- package/packages/datadog-plugin-moleculer/src/server.js +28 -50
- package/packages/datadog-plugin-mongodb-core/src/index.js +1 -5
- package/packages/datadog-plugin-mysql/src/index.js +1 -5
- package/packages/datadog-plugin-net/src/index.js +3 -7
- package/packages/datadog-plugin-oracledb/src/index.js +34 -100
- package/packages/datadog-plugin-paperplane/src/index.js +14 -100
- package/packages/datadog-plugin-paperplane/src/logger.js +11 -0
- package/packages/datadog-plugin-paperplane/src/server.js +24 -0
- package/packages/datadog-plugin-pg/src/index.js +1 -5
- package/packages/datadog-plugin-redis/src/index.js +1 -5
- package/packages/datadog-plugin-restify/src/index.js +13 -75
- package/packages/datadog-plugin-rhea/src/index.js +1 -5
- package/packages/datadog-plugin-router/src/index.js +67 -164
- package/packages/datadog-plugin-sharedb/src/index.js +1 -5
- package/packages/datadog-plugin-tedious/src/index.js +1 -5
- package/packages/datadog-plugin-web/src/index.js +20 -0
- package/packages/dd-trace/lib/version.js +1 -1
- package/packages/dd-trace/src/appsec/callbacks/ddwaf.js +8 -2
- package/packages/dd-trace/src/appsec/reporter.js +4 -0
- package/packages/dd-trace/src/encode/agentless-ci-visibility.js +3 -1
- package/packages/dd-trace/src/plugin_manager.js +13 -7
- package/packages/dd-trace/src/plugins/index.js +1 -2
- package/packages/dd-trace/src/plugins/log_plugin.js +8 -4
- package/packages/dd-trace/src/plugins/plugin.js +8 -8
- package/packages/dd-trace/src/plugins/util/test.js +5 -1
- package/packages/dd-trace/src/plugins/util/web.js +40 -12
- package/packages/dd-trace/src/profiling/config.js +8 -8
- package/packages/dd-trace/src/profiling/index.js +4 -4
- package/packages/dd-trace/src/profiling/profilers/{heap.js → space.js} +2 -2
- package/packages/dd-trace/src/profiling/profilers/{cpu.js → wall.js} +2 -2
- package/scripts/install_plugin_modules.js +23 -11
- package/packages/datadog-plugin-aws-sdk/src/helpers.js +0 -103
- package/packages/datadog-plugin-fastify/src/fastify.js +0 -198
- package/packages/datadog-plugin-fastify/src/find-my-way.js +0 -37
- package/packages/datadog-plugin-hapi/src/route.js +0 -75
- package/packages/datadog-plugin-hapi/src/server.js +0 -204
- package/packages/datadog-plugin-knex/src/index.js +0 -23
- package/packages/datadog-plugin-limitd-client/src/index.js +0 -30
- package/scripts/postpublish.js +0 -24
package/LICENSE-3rdparty.csv
CHANGED
|
@@ -17,7 +17,6 @@ require,lodash.sortby,MIT,Copyright JS Foundation and other contributors
|
|
|
17
17
|
require,lodash.uniq,MIT,Copyright JS Foundation and other contributors
|
|
18
18
|
require,methods,MIT,Copyright 2013-2014 TJ Holowaychuk
|
|
19
19
|
require,module-details-from-path,MIT,Copyright 2016 Thomas Watson Steen
|
|
20
|
-
require,multer,MIT,Copyright 2014 Hage Yaapa
|
|
21
20
|
require,opentracing,MIT,Copyright 2016 Resonance Labs Inc
|
|
22
21
|
require,path-to-regexp,MIT,Copyright 2014 Blake Embrey
|
|
23
22
|
require,performance-now,MIT,Copyright 2013 Braveg1rl
|
|
@@ -31,7 +30,6 @@ dev,chai,MIT,Copyright 2017 Chai.js Assertion Library
|
|
|
31
30
|
dev,chalk,MIT,Copyright Sindre Sorhus
|
|
32
31
|
dev,checksum,MIT,Copyright Daniel D. Shaw
|
|
33
32
|
dev,cli-table3,MIT,Copyright 2014 James Talmage
|
|
34
|
-
dev,codecov,MIT,Copyright 2014 Gregg Caines
|
|
35
33
|
dev,dotenv,BSD-2-Clause,Copyright 2015 Scott Motte
|
|
36
34
|
dev,eslint,MIT,Copyright JS Foundation and other contributors https://js.foundation
|
|
37
35
|
dev,eslint-config-standard,MIT,Copyright Feross Aboukhadijeh
|
|
@@ -39,8 +37,6 @@ dev,eslint-plugin-import,MIT,Copyright 2015 Ben Mosher
|
|
|
39
37
|
dev,eslint-plugin-node,MIT,Copyright 2015 Toru Nagashima
|
|
40
38
|
dev,eslint-plugin-promise,ISC,jden and other contributors
|
|
41
39
|
dev,eslint-plugin-standard,MIT,Copyright 2015 Jamund Ferguson
|
|
42
|
-
dev,mocha-junit-reporter,MIT,Copyright 2015 Michael Allen
|
|
43
|
-
dev,mocha-multi-reporters,MIT,Copyright 2015 Stanley Ng 2019 Yousaf Nabi
|
|
44
40
|
dev,express,MIT,Copyright 2009-2014 TJ Holowaychuk 2013-2014 Roman Shtylman 2014-2015 Douglas Christopher Wilson
|
|
45
41
|
dev,get-port,MIT,Copyright Sindre Sorhus
|
|
46
42
|
dev,glob,ISC,Copyright Isaac Z. Schlueter and Contributors
|
|
@@ -49,6 +45,7 @@ dev,int64-buffer,MIT,Copyright 2015-2016 Yusuke Kawasaki
|
|
|
49
45
|
dev,jszip,MIT,Copyright 2015-2016 Stuart Knightley and contributors
|
|
50
46
|
dev,mkdirp,MIT,Copyright 2010 James Halliday
|
|
51
47
|
dev,mocha,MIT,Copyright 2011-2018 JS Foundation and contributors https://js.foundation
|
|
48
|
+
dev,multer,MIT,Copyright 2014 Hage Yaapa
|
|
52
49
|
dev,msgpack-lite,MIT,Copyright 2015 Yusuke Kawasaki
|
|
53
50
|
dev,nock,MIT,Copyright 2017 Pedro Teixeira and other contributors
|
|
54
51
|
dev,nyc,ISC,Copyright 2015 Contributors
|
package/index.d.ts
CHANGED
|
@@ -575,7 +575,6 @@ interface Plugins {
|
|
|
575
575
|
"kafkajs": plugins.kafkajs
|
|
576
576
|
"knex": plugins.knex;
|
|
577
577
|
"koa": plugins.koa;
|
|
578
|
-
"limitd-client": plugins.limitd_client;
|
|
579
578
|
"memcached": plugins.memcached;
|
|
580
579
|
"microgateway-core": plugins.microgateway_core;
|
|
581
580
|
"mocha": plugins.mocha;
|
|
@@ -1159,12 +1158,6 @@ declare namespace plugins {
|
|
|
1159
1158
|
*/
|
|
1160
1159
|
interface kafkajs extends Instrumentation {}
|
|
1161
1160
|
|
|
1162
|
-
/**
|
|
1163
|
-
* This plugin automatically instruments the
|
|
1164
|
-
* [limitd-client](https://github.com/limitd/node-client) module.
|
|
1165
|
-
*/
|
|
1166
|
-
interface limitd_client extends Integration {}
|
|
1167
|
-
|
|
1168
1161
|
/**
|
|
1169
1162
|
* This plugin automatically instruments the
|
|
1170
1163
|
* [memcached](https://github.com/3rd-Eden/memcached) module.
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dd-trace",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "Datadog APM tracing client for JavaScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"preinstall": "node scripts/preinstall.js",
|
|
9
|
-
"postpublish": "node scripts/postpublish.js",
|
|
10
9
|
"bench": "node benchmark",
|
|
11
10
|
"bench:profiler": "node benchmark/profiler",
|
|
12
11
|
"bench:e2e": "SERVICES=mongo yarn services && cd benchmark/e2e && node benchmark-run.js --duration=30",
|
|
@@ -16,25 +15,23 @@
|
|
|
16
15
|
"lint": "node scripts/check_licenses.js && eslint . && yarn audit --groups dependencies",
|
|
17
16
|
"services": "node ./scripts/install_plugin_modules && node packages/dd-trace/test/setup/services",
|
|
18
17
|
"tdd": "node scripts/tdd.js",
|
|
19
|
-
"test": "SERVICES=* yarn services && mocha --exit --expose-gc 'packages/dd-trace/test/setup/node.js' 'packages/*/test/**/*.spec.js'",
|
|
20
|
-
"test:trace:core": "mocha --exit --expose-gc --file packages/dd-trace/test/setup/core.js \"packages/dd-trace/test/**/*.spec.js\"",
|
|
21
|
-
"test:trace:core:ci": "nyc --include \"packages/dd-trace/src/**/*.js\" -- npm run test:trace:core
|
|
22
|
-
"test:instrumentations": "mocha --file 'packages/dd-trace/test/setup/core.js' 'packages/datadog-instrumentations/test/**/*.spec.js'",
|
|
23
|
-
"test:instrumentations:ci": "nyc --include 'packages/datadog-instrumentations/src/**/*.js' -- npm run test:instrumentations
|
|
24
|
-
"test:core": "mocha --file packages/datadog-core/test/setup.js 'packages/datadog-core/test/**/*.spec.js'",
|
|
25
|
-
"test:core:ci": "nyc --include 'packages/datadog-core/src/**/*.js' -- npm run test:core
|
|
26
|
-
"test:plugins": "mocha --exit --file \"packages/dd-trace/test/setup/core.js\" \"packages/datadog-plugin-@($(echo $PLUGINS))/test/**/*.spec.js\"",
|
|
27
|
-
"test:plugins:ci": "yarn services && nyc --include \"packages/datadog-plugin-@($(echo $PLUGINS))/src/**/*.js\" -- npm run test:plugins
|
|
18
|
+
"test": "SERVICES=* yarn services && mocha --colors --exit --expose-gc 'packages/dd-trace/test/setup/node.js' 'packages/*/test/**/*.spec.js'",
|
|
19
|
+
"test:trace:core": "mocha --colors --exit --expose-gc --file packages/dd-trace/test/setup/core.js --exclude \"packages/dd-trace/test/profiling/**/*.spec.js\" \"packages/dd-trace/test/**/*.spec.js\"",
|
|
20
|
+
"test:trace:core:ci": "nyc --no-clean --include \"packages/dd-trace/src/**/*.js\" --exclude \"packages/dd-trace/src/profiling/**/*.js\" -- npm run test:trace:core",
|
|
21
|
+
"test:instrumentations": "mocha --colors --file 'packages/dd-trace/test/setup/core.js' 'packages/datadog-instrumentations/test/**/*.spec.js'",
|
|
22
|
+
"test:instrumentations:ci": "nyc --no-clean --include 'packages/datadog-instrumentations/src/**/*.js' -- npm run test:instrumentations",
|
|
23
|
+
"test:core": "mocha --colors --file packages/datadog-core/test/setup.js 'packages/datadog-core/test/**/*.spec.js'",
|
|
24
|
+
"test:core:ci": "nyc --no-clean --include 'packages/datadog-core/src/**/*.js' -- npm run test:core",
|
|
25
|
+
"test:plugins": "mocha --colors --exit --file \"packages/dd-trace/test/setup/core.js\" \"packages/datadog-instrumentations/test/@($(echo $PLUGINS)).spec.js\" \"packages/datadog-plugin-@($(echo $PLUGINS))/test/**/*.spec.js\"",
|
|
26
|
+
"test:plugins:ci": "yarn services && nyc --no-clean --include \"packages/datadog-instrumentations/src/@($(echo $PLUGINS)).js\" --include \"packages/datadog-instrumentations/src/@($(echo $PLUGINS))/**/*.js\" --include \"packages/datadog-plugin-@($(echo $PLUGINS))/src/**/*.js\" -- npm run test:plugins",
|
|
28
27
|
"test:plugins:upstream": "node ./packages/dd-trace/test/plugins/suite.js",
|
|
29
|
-
"test:profiler": "mocha --exit --file \"packages/dd-trace/test/setup/core.js\" \"packages/dd-trace/test/profiling/**/*.spec.js\"",
|
|
30
|
-
"test:
|
|
31
|
-
"test:
|
|
32
|
-
"test:shimmer
|
|
28
|
+
"test:profiler": "mocha --colors --exit --file \"packages/dd-trace/test/setup/core.js\" \"packages/dd-trace/test/profiling/**/*.spec.js\"",
|
|
29
|
+
"test:profiler:ci": "nyc --no-clean --include \"packages/dd-trace/src/profiling/**/*.js\" -- npm run test:profiler",
|
|
30
|
+
"test:integration": "mocha --colors --timeout 30000 \"integration-tests/**/*.spec.js\"",
|
|
31
|
+
"test:shimmer": "mocha --colors 'packages/datadog-shimmer/test/**/*.spec.js'",
|
|
32
|
+
"test:shimmer:ci": "nyc --no-clean --include 'packages/datadog-shimmer/src/**/*.js' -- npm run test:shimmer",
|
|
33
33
|
"leak:core": "node ./scripts/install_plugin_modules && (cd packages/memwatch && yarn) && NODE_PATH=./packages/memwatch/node_modules node --no-warnings ./node_modules/.bin/tape 'packages/dd-trace/test/leak/**/*.js'",
|
|
34
34
|
"leak:plugins": "yarn services && (cd packages/memwatch && yarn) && NODE_PATH=./packages/memwatch/node_modules node --no-warnings ./node_modules/.bin/tape \"packages/datadog-plugin-@($(echo $PLUGINS))/test/leak.js\"",
|
|
35
|
-
"cover:merge": "nyc merge ./.nyc_output ./.nyc_merge/$CIRCLE_JOB.json",
|
|
36
|
-
"cover:report": "nyc report -t ./.nyc_merge -n 'packages/**/*.js'",
|
|
37
|
-
"codecov": "codecov",
|
|
38
35
|
"junit:upload": "node ./scripts/junit_report.js"
|
|
39
36
|
},
|
|
40
37
|
"repository": {
|
|
@@ -61,7 +58,7 @@
|
|
|
61
58
|
"node": ">=12"
|
|
62
59
|
},
|
|
63
60
|
"dependencies": {
|
|
64
|
-
"@datadog/native-appsec": "^1.
|
|
61
|
+
"@datadog/native-appsec": "^1.2.0",
|
|
65
62
|
"@datadog/native-metrics": "^1.2.0",
|
|
66
63
|
"@datadog/pprof": "^0.4.0",
|
|
67
64
|
"@datadog/sketches-js": "^1.0.4",
|
|
@@ -79,7 +76,6 @@
|
|
|
79
76
|
"lodash.uniq": "^4.5.0",
|
|
80
77
|
"methods": "^1.1.2",
|
|
81
78
|
"module-details-from-path": "^1.0.3",
|
|
82
|
-
"multer": "^1.4.2",
|
|
83
79
|
"opentracing": ">=0.12.1",
|
|
84
80
|
"path-to-regexp": "^0.1.2",
|
|
85
81
|
"performance-now": "^2.1.0",
|
|
@@ -95,9 +91,8 @@
|
|
|
95
91
|
"chalk": "^3.0.0",
|
|
96
92
|
"checksum": "^0.1.1",
|
|
97
93
|
"cli-table3": "^0.5.1",
|
|
98
|
-
"codecov": "3.8.1",
|
|
99
94
|
"dotenv": "8.2.0",
|
|
100
|
-
"eslint": "^
|
|
95
|
+
"eslint": "^7.32.0",
|
|
101
96
|
"eslint-config-standard": "^11.0.0-beta.0",
|
|
102
97
|
"eslint-plugin-import": "^2.8.0",
|
|
103
98
|
"eslint-plugin-node": "^5.2.1",
|
|
@@ -111,8 +106,7 @@
|
|
|
111
106
|
"jszip": "^3.5.0",
|
|
112
107
|
"mkdirp": "^0.5.1",
|
|
113
108
|
"mocha": "8",
|
|
114
|
-
"
|
|
115
|
-
"mocha-multi-reporters": "^1.5.1",
|
|
109
|
+
"multer": "^1.4.2",
|
|
116
110
|
"msgpack-lite": "^0.1.26",
|
|
117
111
|
"nock": "^11.3.3",
|
|
118
112
|
"nyc": "^15.1.0",
|
|
@@ -2,32 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
require('./src/amqplib')
|
|
4
4
|
require('./src/amqp10')
|
|
5
|
+
require('./src/aws-sdk')
|
|
5
6
|
require('./src/bluebird')
|
|
6
7
|
require('./src/bunyan')
|
|
7
8
|
require('./src/cassandra-driver')
|
|
9
|
+
require('./src/connect')
|
|
8
10
|
require('./src/couchbase')
|
|
9
11
|
require('./src/cucumber')
|
|
10
12
|
require('./src/dns')
|
|
11
13
|
require('./src/elasticsearch')
|
|
14
|
+
require('./src/express')
|
|
15
|
+
require('./src/fastify')
|
|
16
|
+
require('./src/find-my-way')
|
|
12
17
|
require('./src/generic-pool')
|
|
18
|
+
require('./src/google-cloud-pubsub')
|
|
19
|
+
require('./src/hapi')
|
|
13
20
|
require('./src/http')
|
|
14
21
|
require('./src/ioredis')
|
|
15
22
|
require('./src/jest')
|
|
23
|
+
require('./src/kafkajs')
|
|
24
|
+
require('./src/knex')
|
|
25
|
+
require('./src/koa')
|
|
16
26
|
require('./src/memcached')
|
|
27
|
+
require('./src/moleculer')
|
|
17
28
|
require('./src/mongodb-core')
|
|
18
29
|
require('./src/mongoose')
|
|
19
30
|
require('./src/mysql')
|
|
20
31
|
require('./src/mysql2')
|
|
21
32
|
require('./src/mocha')
|
|
22
33
|
require('./src/net')
|
|
34
|
+
require('./src/oracledb')
|
|
35
|
+
require('./src/paperplane')
|
|
23
36
|
require('./src/pino')
|
|
24
37
|
require('./src/pg')
|
|
25
38
|
require('./src/promise')
|
|
26
39
|
require('./src/promise-js')
|
|
27
40
|
require('./src/q')
|
|
28
41
|
require('./src/redis')
|
|
42
|
+
require('./src/restify')
|
|
43
|
+
require('./src/router')
|
|
29
44
|
require('./src/rhea')
|
|
30
45
|
require('./src/sharedb')
|
|
31
46
|
require('./src/tedious')
|
|
32
47
|
require('./src/when')
|
|
33
48
|
require('./src/winston')
|
|
49
|
+
require('./src/limitd-client')
|
|
@@ -9,62 +9,63 @@ const shimmer = require('../../datadog-shimmer')
|
|
|
9
9
|
|
|
10
10
|
addHook({ name: 'amqp10', file: 'lib/sender_link.js', versions: ['>=3'] }, SenderLink => {
|
|
11
11
|
const startCh = channel('apm:amqp10:send:start')
|
|
12
|
-
const
|
|
13
|
-
const endCh = channel('apm:amqp10:send:end')
|
|
12
|
+
const finishCh = channel('apm:amqp10:send:finish')
|
|
14
13
|
const errorCh = channel('apm:amqp10:send:error')
|
|
15
14
|
shimmer.wrap(SenderLink.prototype, 'send', send => function (msg, options) {
|
|
16
15
|
if (!startCh.hasSubscribers) {
|
|
17
16
|
return send.apply(this, arguments)
|
|
18
17
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const asyncResource = new AsyncResource('bound-anonymous-fn')
|
|
19
|
+
return asyncResource.runInAsyncScope(() => {
|
|
20
|
+
startCh.publish({ link: this })
|
|
21
|
+
try {
|
|
22
|
+
const promise = send.apply(this, arguments)
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const asyncResource = new AsyncResource('bound-anonymous-fn')
|
|
24
|
+
if (!promise) {
|
|
25
|
+
finish(finishCh, errorCh)
|
|
26
|
+
return promise
|
|
27
|
+
}
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
promise.then(asyncResource.bind(() => finish(finishCh, errorCh)),
|
|
30
|
+
asyncResource.bind(e => finish(finishCh, errorCh, e)))
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
32
|
+
return promise
|
|
33
|
+
} catch (err) {
|
|
34
|
+
finish(finishCh, errorCh, err)
|
|
35
|
+
throw err
|
|
36
|
+
}
|
|
37
|
+
})
|
|
40
38
|
})
|
|
41
39
|
return SenderLink
|
|
42
40
|
})
|
|
43
41
|
|
|
44
42
|
addHook({ name: 'amqp10', file: 'lib/receiver_link.js', versions: ['>=3'] }, ReceiverLink => {
|
|
45
43
|
const startCh = channel('apm:amqp10:receive:start')
|
|
46
|
-
const
|
|
44
|
+
const finishCh = channel('apm:amqp10:receive:finish')
|
|
47
45
|
const errorCh = channel('apm:amqp10:receive:error')
|
|
48
46
|
shimmer.wrap(ReceiverLink.prototype, '_messageReceived', messageReceived => function (transferFrame) {
|
|
49
47
|
if (!transferFrame || transferFrame.aborted || transferFrame.more) {
|
|
50
48
|
return messageReceived.apply(this, arguments)
|
|
51
49
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
const asyncResource = new AsyncResource('bound-anonymous-fn')
|
|
51
|
+
return asyncResource.runInAsyncScope(() => {
|
|
52
|
+
startCh.publish({ link: this })
|
|
53
|
+
try {
|
|
54
|
+
return messageReceived.apply(this, arguments)
|
|
55
|
+
} catch (err) {
|
|
56
|
+
errorCh.publish(err)
|
|
57
|
+
throw err
|
|
58
|
+
} finally {
|
|
59
|
+
finishCh.publish()
|
|
60
|
+
}
|
|
61
|
+
})
|
|
61
62
|
})
|
|
62
63
|
return ReceiverLink
|
|
63
64
|
})
|
|
64
65
|
|
|
65
|
-
function finish (
|
|
66
|
+
function finish (finishCh, errorCh, error) {
|
|
66
67
|
if (error) {
|
|
67
68
|
errorCh.publish(error)
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
+
finishCh.publish()
|
|
70
71
|
}
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
const {
|
|
4
4
|
channel,
|
|
5
|
-
addHook
|
|
5
|
+
addHook,
|
|
6
|
+
AsyncResource
|
|
6
7
|
} = require('./helpers/instrument')
|
|
7
8
|
const kebabCase = require('lodash.kebabcase')
|
|
8
9
|
const shimmer = require('../../datadog-shimmer')
|
|
9
10
|
|
|
10
11
|
const startCh = channel('apm:amqplib:command:start')
|
|
11
|
-
const
|
|
12
|
+
const finishCh = channel('apm:amqplib:command:finish')
|
|
12
13
|
const errorCh = channel('apm:amqplib:command:error')
|
|
13
14
|
|
|
14
15
|
let methods = {}
|
|
@@ -40,17 +41,21 @@ function instrument (send, channel, args, method, fields, message) {
|
|
|
40
41
|
if (!startCh.hasSubscribers) {
|
|
41
42
|
return send.apply(channel, args)
|
|
42
43
|
}
|
|
43
|
-
startCh.publish({ channel, method, fields, message })
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
errorCh.publish(err)
|
|
45
|
+
const asyncResource = new AsyncResource('bound-anonymous-fn')
|
|
46
|
+
return asyncResource.runInAsyncScope(() => {
|
|
47
|
+
startCh.publish({ channel, method, fields, message })
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
try {
|
|
50
|
+
return send.apply(channel, args)
|
|
51
|
+
} catch (err) {
|
|
52
|
+
errorCh.publish(err)
|
|
53
|
+
|
|
54
|
+
throw err
|
|
55
|
+
} finally {
|
|
56
|
+
finishCh.publish()
|
|
57
|
+
}
|
|
58
|
+
})
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
function isCamelCase (str) {
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
channel,
|
|
5
|
+
addHook,
|
|
6
|
+
AsyncResource
|
|
7
|
+
} = require('./helpers/instrument')
|
|
8
|
+
const shimmer = require('../../datadog-shimmer')
|
|
9
|
+
|
|
10
|
+
function wrapRequest (send) {
|
|
11
|
+
return function wrappedRequest (cb) {
|
|
12
|
+
if (!this.service) return send.apply(this, arguments)
|
|
13
|
+
|
|
14
|
+
const serviceIdentifier = this.service.serviceIdentifier
|
|
15
|
+
const channelSuffix = getChannelSuffix(serviceIdentifier)
|
|
16
|
+
const startCh = channel(`apm:aws:request:start:${channelSuffix}`)
|
|
17
|
+
if (!startCh.hasSubscribers) return send.apply(this, arguments)
|
|
18
|
+
const outerAr = new AsyncResource('apm:aws:request:outer')
|
|
19
|
+
|
|
20
|
+
this.on('complete', response => {
|
|
21
|
+
channel(`apm:aws:request:complete:${channelSuffix}`).publish({ response })
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
return new AsyncResource('apm:aws:request:inner').runInAsyncScope(() => {
|
|
25
|
+
startCh.publish({
|
|
26
|
+
serviceIdentifier,
|
|
27
|
+
operation: this.operation,
|
|
28
|
+
awsRegion: this.service.config && this.service.config.region,
|
|
29
|
+
awsService: this.service.api && this.service.api.className,
|
|
30
|
+
request: this
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
if (typeof cb === 'function') {
|
|
34
|
+
arguments[0] = wrapCb(cb, channelSuffix, this, outerAr)
|
|
35
|
+
}
|
|
36
|
+
return send.apply(this, arguments)
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function wrapCb (cb, serviceName, request, ar) {
|
|
42
|
+
return function wrappedCb (err, response) {
|
|
43
|
+
const obj = { request, response }
|
|
44
|
+
return ar.runInAsyncScope(() => {
|
|
45
|
+
channel(`apm:aws:response:start:${serviceName}`).publish(obj)
|
|
46
|
+
// TODO(bengl) make this work without needing a needsFinish property added to the object
|
|
47
|
+
if (!obj.needsFinish) {
|
|
48
|
+
return cb.apply(this, arguments)
|
|
49
|
+
}
|
|
50
|
+
const finishChannel = channel(`apm:aws:response:finish:${serviceName}`)
|
|
51
|
+
try {
|
|
52
|
+
let result = cb.apply(this, arguments)
|
|
53
|
+
if (result && result.then) {
|
|
54
|
+
result = result.then(x => {
|
|
55
|
+
finishChannel.publish()
|
|
56
|
+
return x
|
|
57
|
+
}, e => {
|
|
58
|
+
finishChannel.publish(e)
|
|
59
|
+
throw e
|
|
60
|
+
})
|
|
61
|
+
} else {
|
|
62
|
+
finishChannel.publish()
|
|
63
|
+
}
|
|
64
|
+
return result
|
|
65
|
+
} catch (e) {
|
|
66
|
+
finishChannel.publish(e)
|
|
67
|
+
throw e
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function getChannelSuffix (name) {
|
|
74
|
+
return [
|
|
75
|
+
'cloudwatchlogs',
|
|
76
|
+
'dynamodb',
|
|
77
|
+
'eventbridge',
|
|
78
|
+
'kinesis',
|
|
79
|
+
'lambda',
|
|
80
|
+
'redshift',
|
|
81
|
+
's3',
|
|
82
|
+
'sns',
|
|
83
|
+
'sqs'
|
|
84
|
+
].includes(name) ? name : 'default'
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
addHook({ name: 'aws-sdk', versions: ['>=2.3.0'] }, AWS => {
|
|
88
|
+
shimmer.wrap(AWS.Request.prototype, 'promise', wrapRequest)
|
|
89
|
+
shimmer.wrap(AWS.config, 'setPromisesDependency', setPromisesDependency => {
|
|
90
|
+
return function wrappedSetPromisesDependency (dep) {
|
|
91
|
+
const result = setPromisesDependency.apply(this, arguments)
|
|
92
|
+
shimmer.wrap(AWS.Request.prototype, 'promise', wrapRequest)
|
|
93
|
+
return result
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
return AWS
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
// <2.1.35 has breaking changes for instrumentation
|
|
100
|
+
// https://github.com/aws/aws-sdk-js/pull/629
|
|
101
|
+
addHook({ name: 'aws-sdk', versions: ['>=2.1.35'] }, AWS => {
|
|
102
|
+
shimmer.wrap(AWS.Request.prototype, 'send', wrapRequest)
|
|
103
|
+
return AWS
|
|
104
|
+
})
|
|
@@ -8,8 +8,7 @@ const {
|
|
|
8
8
|
const shimmer = require('../../datadog-shimmer')
|
|
9
9
|
|
|
10
10
|
const startCh = channel('apm:cassandra:query:start')
|
|
11
|
-
const
|
|
12
|
-
const endCh = channel('apm:cassandra:query:end')
|
|
11
|
+
const finishCh = channel('apm:cassandra:query:finish')
|
|
13
12
|
const errorCh = channel('apm:cassandra:query:error')
|
|
14
13
|
const addConnectionCh = channel(`apm:cassandra:query:addConnection`)
|
|
15
14
|
|
|
@@ -18,34 +17,34 @@ addHook({ name: 'cassandra-driver', versions: ['>=3.0.0'] }, cassandra => {
|
|
|
18
17
|
if (!startCh.hasSubscribers) {
|
|
19
18
|
return batch.apply(this, arguments)
|
|
20
19
|
}
|
|
20
|
+
const callbackResource = new AsyncResource('bound-anonymous-fn')
|
|
21
21
|
const asyncResource = new AsyncResource('bound-anonymous-fn')
|
|
22
|
-
startCh.publish({ keyspace: this.keyspace, query: queries })
|
|
23
|
-
|
|
24
22
|
const lastIndex = arguments.length - 1
|
|
25
23
|
let cb = arguments[lastIndex]
|
|
26
24
|
|
|
27
25
|
if (typeof cb === 'function') {
|
|
28
|
-
cb =
|
|
29
|
-
arguments[lastIndex] = wrapCallback(
|
|
26
|
+
cb = callbackResource.bind(cb)
|
|
27
|
+
arguments[lastIndex] = wrapCallback(finishCh, errorCh, asyncResource, cb)
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
promiseAsyncResource
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
return asyncResource.runInAsyncScope(() => {
|
|
31
|
+
startCh.publish({ keyspace: this.keyspace, query: queries })
|
|
32
|
+
try {
|
|
33
|
+
const res = batch.apply(this, arguments)
|
|
34
|
+
if (typeof res === 'function' || !res) {
|
|
35
|
+
return wrapCallback(finishCh, errorCh, asyncResource, res)
|
|
36
|
+
} else {
|
|
37
|
+
const promiseAsyncResource = new AsyncResource('bound-anonymous-fn')
|
|
38
|
+
return res.then(
|
|
39
|
+
promiseAsyncResource.bind(() => finish(finishCh, errorCh)),
|
|
40
|
+
promiseAsyncResource.bind(err => finish(finishCh, errorCh, err))
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
} catch (e) {
|
|
44
|
+
finish(finishCh, errorCh, e)
|
|
45
|
+
throw e
|
|
42
46
|
}
|
|
43
|
-
}
|
|
44
|
-
finish(asyncEndCh, errorCh, e)
|
|
45
|
-
throw e
|
|
46
|
-
} finally {
|
|
47
|
-
endCh.publish(undefined)
|
|
48
|
-
}
|
|
47
|
+
})
|
|
49
48
|
})
|
|
50
49
|
return cassandra
|
|
51
50
|
})
|
|
@@ -55,17 +54,19 @@ addHook({ name: 'cassandra-driver', versions: ['>=4.4'] }, cassandra => {
|
|
|
55
54
|
if (!startCh.hasSubscribers) {
|
|
56
55
|
return _execute.apply(this, arguments)
|
|
57
56
|
}
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
const asyncResource = new AsyncResource('bound-anonymous-fn')
|
|
58
|
+
return asyncResource.runInAsyncScope(() => {
|
|
59
|
+
startCh.publish({ keyspace: this.keyspace, query })
|
|
60
|
+
const promise = _execute.apply(this, arguments)
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
const promiseAsyncResource = new AsyncResource('bound-anonymous-fn')
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
promise.then(
|
|
65
|
+
promiseAsyncResource.bind(() => finish(finishCh, errorCh)),
|
|
66
|
+
promiseAsyncResource.bind(err => finish(finishCh, errorCh, err))
|
|
67
|
+
)
|
|
68
|
+
return promise
|
|
69
|
+
})
|
|
69
70
|
})
|
|
70
71
|
return cassandra
|
|
71
72
|
})
|
|
@@ -76,6 +77,7 @@ addHook({ name: 'cassandra-driver', versions: ['3 - 4.3'] }, cassandra => {
|
|
|
76
77
|
if (!startCh.hasSubscribers) {
|
|
77
78
|
return _innerExecute.apply(this, arguments)
|
|
78
79
|
}
|
|
80
|
+
const callbackResource = new AsyncResource('bound-anonymous-fn')
|
|
79
81
|
const asyncResource = new AsyncResource('bound-anonymous-fn')
|
|
80
82
|
const isValid = (args) => {
|
|
81
83
|
return args.length === 4 || typeof args[3] === 'function'
|
|
@@ -85,24 +87,24 @@ addHook({ name: 'cassandra-driver', versions: ['3 - 4.3'] }, cassandra => {
|
|
|
85
87
|
return _innerExecute.apply(this, arguments)
|
|
86
88
|
}
|
|
87
89
|
|
|
88
|
-
|
|
90
|
+
return asyncResource.runInAsyncScope(() => {
|
|
91
|
+
startCh.publish({ keyspace: this.keyspace, query })
|
|
89
92
|
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
const lastIndex = arguments.length - 1
|
|
94
|
+
let cb = arguments[lastIndex]
|
|
92
95
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
if (typeof cb === 'function') {
|
|
97
|
+
cb = callbackResource.bind(cb)
|
|
98
|
+
arguments[lastIndex] = wrapCallback(finishCh, errorCh, asyncResource, cb)
|
|
99
|
+
}
|
|
97
100
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
101
|
+
try {
|
|
102
|
+
return _innerExecute.apply(this, arguments)
|
|
103
|
+
} catch (e) {
|
|
104
|
+
finish(finishCh, errorCh, e)
|
|
105
|
+
throw e
|
|
106
|
+
}
|
|
107
|
+
})
|
|
106
108
|
}
|
|
107
109
|
)
|
|
108
110
|
return cassandra
|
|
@@ -167,16 +169,16 @@ addHook({ name: 'cassandra-driver', versions: ['3 - 3.2'], file: 'lib/request-ha
|
|
|
167
169
|
return RequestHandler
|
|
168
170
|
})
|
|
169
171
|
|
|
170
|
-
function finish (
|
|
172
|
+
function finish (finishCh, errorCh, error) {
|
|
171
173
|
if (error) {
|
|
172
174
|
errorCh.publish(error)
|
|
173
175
|
}
|
|
174
|
-
|
|
176
|
+
finishCh.publish(undefined)
|
|
175
177
|
}
|
|
176
178
|
|
|
177
|
-
function wrapCallback (
|
|
178
|
-
return
|
|
179
|
-
finish(
|
|
179
|
+
function wrapCallback (finishCh, errorCh, asyncResource, callback) {
|
|
180
|
+
return asyncResource.bind(function (err) {
|
|
181
|
+
finish(finishCh, errorCh, err)
|
|
180
182
|
if (callback) {
|
|
181
183
|
return callback.apply(this, arguments)
|
|
182
184
|
}
|