dd-trace 2.12.2 → 2.13.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.
@@ -9,7 +9,6 @@ const os = require('os')
9
9
  const request = require('./exporters/common/request')
10
10
 
11
11
  let config
12
- let instrumenter
13
12
  let pluginManager
14
13
 
15
14
  let seqId = 0
@@ -20,17 +19,6 @@ const sentIntegrations = new Set()
20
19
 
21
20
  function getIntegrations () {
22
21
  const newIntegrations = []
23
- for (const plugin of instrumenter._instrumented.keys()) {
24
- if (sentIntegrations.has(plugin.name)) {
25
- continue
26
- }
27
- newIntegrations.push({
28
- name: plugin.name,
29
- enabled: true,
30
- auto_enabled: true
31
- })
32
- sentIntegrations.add(plugin.name)
33
- }
34
22
  for (const pluginName in pluginManager._pluginsByName) {
35
23
  if (sentIntegrations.has(pluginName)) {
36
24
  continue
@@ -146,12 +134,11 @@ function sendData (reqType, payload = {}) {
146
134
  })
147
135
  }
148
136
 
149
- function start (aConfig, theInstrumenter, thePluginManager) {
137
+ function start (aConfig, thePluginManager) {
150
138
  if (!aConfig.telemetryEnabled) {
151
139
  return
152
140
  }
153
141
  config = aConfig
154
- instrumenter = theInstrumenter
155
142
  pluginManager = thePluginManager
156
143
  application = createAppObject()
157
144
  host = createHostObject()
@@ -7,8 +7,6 @@ const semver = require('semver')
7
7
  const proxyquire = require('proxyquire')
8
8
  const exec = require('./helpers/exec')
9
9
  const childProcess = require('child_process')
10
- const plugins = require('../packages/dd-trace/src/plugins')
11
- const Plugin = require('../packages/dd-trace/src/plugins/plugin')
12
10
  const externals = require('../packages/dd-trace/test/plugins/externals')
13
11
 
14
12
  const requirePackageJsonPath = require.resolve('../packages/dd-trace/src/require-package-json')
@@ -16,6 +14,9 @@ const requirePackageJsonPath = require.resolve('../packages/dd-trace/src/require
16
14
  const workspaces = new Set()
17
15
  const versionLists = {}
18
16
  const deps = {}
17
+ const names = []
18
+ const filter = process.env.hasOwnProperty('PLUGINS') && process.env.PLUGINS.split('|')
19
+
19
20
  Object.keys(externals).forEach(external => externals[external].forEach(thing => {
20
21
  if (thing.dep) {
21
22
  if (!deps[external]) {
@@ -29,7 +30,10 @@ fs.readdirSync(path.join(__dirname, '../packages/datadog-instrumentations/src'))
29
30
  .filter(file => file.endsWith('js'))
30
31
  .forEach(file => {
31
32
  file = file.replace('.js', '')
32
- plugins[file] = { name: file, prototype: Object.create(Plugin.prototype) }
33
+
34
+ if (!filter || filter.includes(file)) {
35
+ names.push(file)
36
+ }
33
37
  })
34
38
 
35
39
  run()
@@ -42,32 +46,19 @@ async function run () {
42
46
  }
43
47
 
44
48
  async function assertVersions () {
45
- let filter = []
46
- let names = Object.keys(plugins)
47
-
48
- if (process.env.hasOwnProperty('PLUGINS')) {
49
- filter = process.env.PLUGINS.split('|')
50
- names = names.filter(name => ~filter.indexOf(name))
51
- }
52
-
53
49
  const internals = names
54
50
  .map(key => {
55
- const plugin = plugins[key]
56
- if (plugin.prototype instanceof Plugin) {
57
- const instrumentations = []
58
- const name = plugin.name
59
-
60
- try {
61
- loadInstFile(`${name}/server.js`, instrumentations)
62
- loadInstFile(`${name}/client.js`, instrumentations)
63
- } catch (e) {
64
- loadInstFile(`${name}.js`, instrumentations)
65
- }
66
-
67
- return instrumentations
68
- } else {
69
- return plugin
51
+ const instrumentations = []
52
+ const name = key
53
+
54
+ try {
55
+ loadInstFile(`${name}/server.js`, instrumentations)
56
+ loadInstFile(`${name}/client.js`, instrumentations)
57
+ } catch (e) {
58
+ loadInstFile(`${name}.js`, instrumentations)
70
59
  }
60
+
61
+ return instrumentations
71
62
  })
72
63
  .reduce((prev, next) => prev.concat(next), [])
73
64