dd-trace 2.1.0 → 2.1.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/NOTICE +4 -0
- package/package.json +1 -1
- package/packages/datadog-instrumentations/src/mysql.js +2 -2
- package/packages/datadog-instrumentations/src/mysql2.js +5 -5
- package/packages/datadog-plugin-aws-sdk/src/helpers.js +1 -1
- package/packages/datadog-plugin-mysql/src/index.js +4 -5
- package/packages/datadog-plugin-mysql2/src/index.js +11 -0
- package/packages/dd-trace/lib/version.js +1 -1
- package/packages/dd-trace/src/plugins/index.js +1 -1
- package/scripts/tracer-runner.js +13 -0
package/NOTICE
ADDED
package/package.json
CHANGED
|
@@ -20,9 +20,9 @@ addHook({ name: 'mysql', file: 'lib/Connection.js', versions: ['>=2'] }, Connect
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const sql = arguments[0].sql ? arguments[0].sql : arguments[0]
|
|
23
|
-
const
|
|
23
|
+
const conf = this.config
|
|
24
24
|
|
|
25
|
-
startCh.publish(
|
|
25
|
+
startCh.publish({ sql, conf })
|
|
26
26
|
|
|
27
27
|
try {
|
|
28
28
|
const res = query.apply(this, arguments)
|
|
@@ -8,10 +8,10 @@ const {
|
|
|
8
8
|
const shimmer = require('../../datadog-shimmer')
|
|
9
9
|
|
|
10
10
|
addHook({ name: 'mysql2', file: 'lib/connection.js', versions: ['>=1'] }, Connection => {
|
|
11
|
-
const startCh = channel('apm:
|
|
12
|
-
const asyncEndCh = channel('apm:
|
|
13
|
-
const endCh = channel('apm:
|
|
14
|
-
const errorCh = channel('apm:
|
|
11
|
+
const startCh = channel('apm:mysql2:query:start')
|
|
12
|
+
const asyncEndCh = channel('apm:mysql2:query:async-end')
|
|
13
|
+
const endCh = channel('apm:mysql2:query:end')
|
|
14
|
+
const errorCh = channel('apm:mysql2:query:error')
|
|
15
15
|
|
|
16
16
|
shimmer.wrap(Connection.prototype, 'addCommand', addCommand => function (cmd) {
|
|
17
17
|
if (!startCh.hasSubscribers) return addCommand.apply(this, arguments)
|
|
@@ -45,7 +45,7 @@ addHook({ name: 'mysql2', file: 'lib/connection.js', versions: ['>=1'] }, Connec
|
|
|
45
45
|
return asyncResource.bind(function executeWithTrace (packet, connection) {
|
|
46
46
|
const sql = cmd.statement ? cmd.statement.query : cmd.sql
|
|
47
47
|
|
|
48
|
-
startCh.publish(
|
|
48
|
+
startCh.publish({ sql, conf: config })
|
|
49
49
|
|
|
50
50
|
if (this.onResult) {
|
|
51
51
|
const onResult = asyncResource.bind(this.onResult)
|
|
@@ -80,7 +80,7 @@ const helpers = {
|
|
|
80
80
|
if (!span) return
|
|
81
81
|
|
|
82
82
|
const service = services[serviceName] && services[serviceName]
|
|
83
|
-
if (service.requestInject) service.requestInject(span, request, tracer)
|
|
83
|
+
if (service && service.requestInject) service.requestInject(span, request, tracer)
|
|
84
84
|
},
|
|
85
85
|
|
|
86
86
|
wrapCb (cb, serviceName, tags, request, tracer, childOf) {
|
|
@@ -4,7 +4,6 @@ const Plugin = require('../../dd-trace/src/plugins/plugin')
|
|
|
4
4
|
const { storage } = require('../../datadog-core')
|
|
5
5
|
const analyticsSampler = require('../../dd-trace/src/analytics_sampler')
|
|
6
6
|
|
|
7
|
-
// This plugin supports both mysql and mysql2
|
|
8
7
|
class MySQLPlugin extends Plugin {
|
|
9
8
|
static get name () {
|
|
10
9
|
return 'mysql'
|
|
@@ -13,7 +12,7 @@ class MySQLPlugin extends Plugin {
|
|
|
13
12
|
constructor (...args) {
|
|
14
13
|
super(...args)
|
|
15
14
|
|
|
16
|
-
this.addSub(
|
|
15
|
+
this.addSub(`apm:${this.constructor.name}:query:start`, ({ sql, conf }) => {
|
|
17
16
|
const store = storage.getStore()
|
|
18
17
|
const childOf = store ? store.span : store
|
|
19
18
|
const span = this.tracer.startSpan('mysql.query', {
|
|
@@ -38,18 +37,18 @@ class MySQLPlugin extends Plugin {
|
|
|
38
37
|
this.enter(span, store)
|
|
39
38
|
})
|
|
40
39
|
|
|
41
|
-
this.addSub(
|
|
40
|
+
this.addSub(`apm:${this.constructor.name}:query:end`, () => {
|
|
42
41
|
this.exit()
|
|
43
42
|
})
|
|
44
43
|
|
|
45
|
-
this.addSub(
|
|
44
|
+
this.addSub(`apm:${this.constructor.name}:query:error`, err => {
|
|
46
45
|
if (err) {
|
|
47
46
|
const span = storage.getStore().span
|
|
48
47
|
span.setTag('error', err)
|
|
49
48
|
}
|
|
50
49
|
})
|
|
51
50
|
|
|
52
|
-
this.addSub(
|
|
51
|
+
this.addSub(`apm:${this.constructor.name}:query:async-end`, () => {
|
|
53
52
|
const span = storage.getStore().span
|
|
54
53
|
span.finish()
|
|
55
54
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = '2.1.
|
|
1
|
+
module.exports = '2.1.1'
|
|
@@ -35,7 +35,7 @@ module.exports = {
|
|
|
35
35
|
'mongodb-core': require('../../../datadog-plugin-mongodb-core/src'),
|
|
36
36
|
'mongoose': require('../../../datadog-plugin-mongoose/src'),
|
|
37
37
|
'mysql': require('../../../datadog-plugin-mysql/src'),
|
|
38
|
-
'mysql2': require('../../../datadog-plugin-
|
|
38
|
+
'mysql2': require('../../../datadog-plugin-mysql2/src'),
|
|
39
39
|
'net': require('../../../datadog-plugin-net/src'),
|
|
40
40
|
'next': require('../../../datadog-plugin-next/src'),
|
|
41
41
|
'oracledb': require('../../../datadog-plugin-oracledb/src'),
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const spawnWrap = require('spawn-wrap')
|
|
4
|
+
const path = require('path')
|
|
5
|
+
|
|
6
|
+
spawnWrap(['--require', path.join(__dirname, '..', 'init.js')])
|
|
7
|
+
|
|
8
|
+
const { spawn } = require('child_process')
|
|
9
|
+
|
|
10
|
+
const [command, ...argv] = process.argv.slice(2)
|
|
11
|
+
spawn(command, argv, {
|
|
12
|
+
stdio: 'inherit'
|
|
13
|
+
})
|