dd-trace 2.35.0 → 2.36.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 +3 -0
- package/index.d.ts +274 -0
- package/package.json +5 -2
- package/packages/datadog-esbuild/index.js +13 -1
- package/packages/datadog-instrumentations/src/pg.js +14 -11
- package/packages/datadog-plugin-cypress/src/plugin.js +109 -47
- package/packages/datadog-plugin-cypress/src/support.js +3 -2
- package/packages/datadog-plugin-router/src/index.js +12 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/weak-hash-analyzer.js +24 -0
- package/packages/dd-trace/src/appsec/iast/telemetry/logs.js +1 -1
- package/packages/dd-trace/src/config.js +7 -3
- package/packages/dd-trace/src/opentelemetry/context_manager.js +74 -0
- package/packages/dd-trace/src/opentelemetry/sampler.js +18 -0
- package/packages/dd-trace/src/opentelemetry/span.js +151 -0
- package/packages/dd-trace/src/opentelemetry/span_context.js +44 -0
- package/packages/dd-trace/src/opentelemetry/span_processor.js +50 -0
- package/packages/dd-trace/src/opentelemetry/tracer.js +124 -0
- package/packages/dd-trace/src/opentelemetry/tracer_provider.js +72 -0
- package/packages/dd-trace/src/opentracing/span.js +14 -4
- package/packages/dd-trace/src/proxy.js +4 -0
- package/packages/dd-trace/src/telemetry/index.js +5 -6
- package/packages/dd-trace/src/telemetry/send-data.js +17 -5
|
@@ -6,10 +6,6 @@ const os = require('os')
|
|
|
6
6
|
const dependencies = require('./dependencies')
|
|
7
7
|
const { sendData } = require('./send-data')
|
|
8
8
|
|
|
9
|
-
const HEARTBEAT_INTERVAL = process.env.DD_TELEMETRY_HEARTBEAT_INTERVAL
|
|
10
|
-
? Number(process.env.DD_TELEMETRY_HEARTBEAT_INTERVAL) * 1000
|
|
11
|
-
: 60000
|
|
12
|
-
|
|
13
9
|
const telemetryStartChannel = dc.channel('datadog:telemetry:start')
|
|
14
10
|
const telemetryStopChannel = dc.channel('datadog:telemetry:stop')
|
|
15
11
|
|
|
@@ -19,6 +15,7 @@ let pluginManager
|
|
|
19
15
|
let application
|
|
20
16
|
let host
|
|
21
17
|
let interval
|
|
18
|
+
let heartbeatInterval
|
|
22
19
|
const sentIntegrations = new Set()
|
|
23
20
|
|
|
24
21
|
function getIntegrations () {
|
|
@@ -108,7 +105,7 @@ function createHostObject () {
|
|
|
108
105
|
}
|
|
109
106
|
|
|
110
107
|
function getTelemetryData () {
|
|
111
|
-
return { config, application, host, heartbeatInterval
|
|
108
|
+
return { config, application, host, heartbeatInterval }
|
|
112
109
|
}
|
|
113
110
|
|
|
114
111
|
function start (aConfig, thePluginManager) {
|
|
@@ -119,11 +116,13 @@ function start (aConfig, thePluginManager) {
|
|
|
119
116
|
pluginManager = thePluginManager
|
|
120
117
|
application = createAppObject()
|
|
121
118
|
host = createHostObject()
|
|
119
|
+
heartbeatInterval = config.telemetry.heartbeatInterval
|
|
120
|
+
|
|
122
121
|
dependencies.start(config, application, host)
|
|
123
122
|
sendData(config, application, host, 'app-started', appStarted())
|
|
124
123
|
interval = setInterval(() => {
|
|
125
124
|
sendData(config, application, host, 'app-heartbeat')
|
|
126
|
-
},
|
|
125
|
+
}, heartbeatInterval)
|
|
127
126
|
interval.unref()
|
|
128
127
|
process.on('beforeExit', onBeforeExit)
|
|
129
128
|
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
const request = require('../exporters/common/request')
|
|
2
|
+
|
|
3
|
+
function getHeaders (config, application, reqType) {
|
|
4
|
+
const headers = {
|
|
5
|
+
'content-type': 'application/json',
|
|
6
|
+
'dd-telemetry-api-version': 'v1',
|
|
7
|
+
'dd-telemetry-request-type': reqType,
|
|
8
|
+
'dd-client-library-language': application.language_name,
|
|
9
|
+
'dd-client-library-version': application.tracer_version
|
|
10
|
+
}
|
|
11
|
+
const debug = config.telemetry && config.telemetry.debug
|
|
12
|
+
if (debug) {
|
|
13
|
+
headers['dd-telemetry-debug-enabled'] = 'true'
|
|
14
|
+
}
|
|
15
|
+
return headers
|
|
16
|
+
}
|
|
17
|
+
|
|
2
18
|
let seqId = 0
|
|
3
19
|
|
|
4
20
|
function getPayload (payload) {
|
|
@@ -25,11 +41,7 @@ function sendData (config, application, host, reqType, payload = {}) {
|
|
|
25
41
|
port,
|
|
26
42
|
method: 'POST',
|
|
27
43
|
path: '/telemetry/proxy/api/v2/apmtelemetry',
|
|
28
|
-
headers:
|
|
29
|
-
'content-type': 'application/json',
|
|
30
|
-
'dd-telemetry-api-version': 'v1',
|
|
31
|
-
'dd-telemetry-request-type': reqType
|
|
32
|
-
}
|
|
44
|
+
headers: getHeaders(config, application, reqType)
|
|
33
45
|
}
|
|
34
46
|
const data = JSON.stringify({
|
|
35
47
|
api_version: 'v1',
|