dd-trace 4.31.0 → 4.33.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 +0 -1
- package/ci/init.js +3 -3
- package/index.d.ts +35 -0
- package/package.json +4 -5
- package/packages/datadog-esbuild/index.js +2 -2
- package/packages/datadog-instrumentations/src/apollo-server.js +1 -1
- package/packages/datadog-instrumentations/src/apollo.js +103 -0
- package/packages/datadog-instrumentations/src/aws-sdk.js +4 -1
- package/packages/datadog-instrumentations/src/cassandra-driver.js +1 -1
- package/packages/datadog-instrumentations/src/cucumber.js +6 -2
- package/packages/datadog-instrumentations/src/fs.js +0 -1
- package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/hooks.js +57 -56
- package/packages/datadog-instrumentations/src/helpers/instrument.js +2 -2
- package/packages/datadog-instrumentations/src/http/client.js +1 -0
- package/packages/datadog-instrumentations/src/jest.js +12 -13
- package/packages/datadog-instrumentations/src/kafkajs.js +2 -1
- package/packages/datadog-instrumentations/src/ldapjs.js +2 -1
- package/packages/datadog-instrumentations/src/mocha.js +1 -1
- package/packages/datadog-instrumentations/src/mongodb-core.js +4 -6
- package/packages/datadog-instrumentations/src/net.js +1 -1
- package/packages/datadog-instrumentations/src/passport-utils.js +1 -0
- package/packages/datadog-instrumentations/src/playwright.js +158 -7
- package/packages/datadog-instrumentations/src/rhea.js +5 -2
- package/packages/datadog-instrumentations/src/tedious.js +1 -1
- package/packages/datadog-plugin-apollo/src/gateway/execute.js +12 -0
- package/packages/datadog-plugin-apollo/src/gateway/fetch.js +36 -0
- package/packages/datadog-plugin-apollo/src/gateway/index.js +36 -0
- package/packages/datadog-plugin-apollo/src/gateway/plan.js +12 -0
- package/packages/datadog-plugin-apollo/src/gateway/postprocessing.js +12 -0
- package/packages/datadog-plugin-apollo/src/gateway/request.js +124 -0
- package/packages/datadog-plugin-apollo/src/gateway/validate.js +25 -0
- package/packages/datadog-plugin-apollo/src/index.js +15 -0
- package/packages/datadog-plugin-aws-sdk/src/base.js +3 -3
- package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +2 -2
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/s3.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/sns.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +2 -2
- package/packages/datadog-plugin-child_process/src/index.js +1 -1
- package/packages/datadog-plugin-couchbase/src/index.js +2 -1
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +1 -0
- package/packages/datadog-plugin-fetch/src/index.js +1 -1
- package/packages/datadog-plugin-graphql/src/resolve.js +1 -1
- package/packages/datadog-plugin-grpc/src/client.js +2 -2
- package/packages/datadog-plugin-grpc/src/server.js +2 -2
- package/packages/datadog-plugin-http/src/client.js +2 -2
- package/packages/datadog-plugin-http2/src/client.js +4 -3
- package/packages/datadog-plugin-jest/src/index.js +1 -0
- package/packages/datadog-plugin-kafkajs/src/consumer.js +1 -1
- package/packages/datadog-plugin-kafkajs/src/producer.js +1 -1
- package/packages/datadog-plugin-next/src/index.js +1 -1
- package/packages/datadog-plugin-openai/src/index.js +4 -4
- package/packages/datadog-plugin-playwright/src/index.js +16 -3
- package/packages/datadog-plugin-rhea/src/consumer.js +1 -1
- package/packages/datadog-plugin-rhea/src/producer.js +1 -1
- package/packages/datadog-plugin-router/src/index.js +1 -1
- package/packages/datadog-plugin-tedious/src/index.js +1 -1
- package/packages/dd-trace/src/appsec/blocking.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/analyzers.js +17 -17
- package/packages/dd-trace/src/appsec/iast/analyzers/cookie-analyzer.js +1 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secrets-rules.js +132 -132
- package/packages/dd-trace/src/appsec/iast/analyzers/hsts-header-missing-analyzer.js +1 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/overhead-controller.js +2 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +3 -3
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +4 -4
- package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +1 -1
- package/packages/dd-trace/src/appsec/iast/telemetry/namespaces.js +27 -18
- package/packages/dd-trace/src/appsec/iast/telemetry/span-tags.js +1 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +7 -4
- package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +0 -1
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +2 -1
- package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +1 -0
- package/packages/dd-trace/src/config.js +13 -13
- package/packages/dd-trace/src/datastreams/pathway.js +1 -1
- package/packages/dd-trace/src/datastreams/processor.js +15 -15
- package/packages/dd-trace/src/encode/agentless-ci-visibility.js +2 -2
- package/packages/dd-trace/src/encode/coverage-ci-visibility.js +1 -1
- package/packages/dd-trace/src/exporters/common/request.js +1 -0
- package/packages/dd-trace/src/exporters/span-stats/writer.js +0 -1
- package/packages/dd-trace/src/external-logger/src/index.js +5 -5
- package/packages/dd-trace/src/opentelemetry/span.js +2 -0
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +1 -1
- package/packages/dd-trace/src/opentracing/span.js +1 -1
- package/packages/dd-trace/src/plugin_manager.js +1 -2
- package/packages/dd-trace/src/plugins/apollo.js +52 -0
- package/packages/dd-trace/src/plugins/ci_plugin.js +2 -1
- package/packages/dd-trace/src/plugins/composite.js +4 -4
- package/packages/dd-trace/src/plugins/database.js +1 -0
- package/packages/dd-trace/src/plugins/index.js +44 -43
- package/packages/dd-trace/src/plugins/plugin.js +1 -1
- package/packages/dd-trace/src/plugins/tracing.js +9 -6
- package/packages/dd-trace/src/plugins/util/test.js +2 -1
- package/packages/dd-trace/src/plugins/util/web.js +4 -4
- package/packages/dd-trace/src/profiling/config.js +1 -1
- package/packages/dd-trace/src/profiling/loggers/console.js +1 -1
- package/packages/dd-trace/src/profiling/profilers/events.js +79 -82
- package/packages/dd-trace/src/proxy.js +2 -0
- package/packages/dd-trace/src/runtime_metrics.js +8 -5
- package/packages/dd-trace/src/serverless.js +3 -2
- package/packages/dd-trace/src/service-naming/schemas/v0/web.js +24 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +0 -1
- package/packages/dd-trace/src/service-naming/schemas/v1/web.js +24 -0
- package/packages/dd-trace/src/span_processor.js +2 -2
- package/packages/dd-trace/src/span_stats.js +1 -1
- package/packages/dd-trace/src/telemetry/dependencies.js +4 -5
- package/packages/dd-trace/src/telemetry/index.js +12 -13
- package/packages/dd-trace/src/telemetry/send-data.js +0 -1
- package/packages/dd-trace/src/util.js +7 -7
|
@@ -15,6 +15,8 @@ const MS_TO_NS = 1000000
|
|
|
15
15
|
const pprofValueType = 'timeline'
|
|
16
16
|
const pprofValueUnit = 'nanoseconds'
|
|
17
17
|
|
|
18
|
+
const dateOffset = BigInt(Math.round(performance.timeOrigin * MS_TO_NS))
|
|
19
|
+
|
|
18
20
|
function labelFromStr (stringTable, key, valStr) {
|
|
19
21
|
return new Label({ key, str: stringTable.dedup(valStr) })
|
|
20
22
|
}
|
|
@@ -146,6 +148,76 @@ if (node16) {
|
|
|
146
148
|
decoratorTypes.net = NetDecorator
|
|
147
149
|
}
|
|
148
150
|
|
|
151
|
+
// Translates performance entries into pprof samples.
|
|
152
|
+
class EventSerializer {
|
|
153
|
+
constructor () {
|
|
154
|
+
this.stringTable = new StringTable()
|
|
155
|
+
this.samples = []
|
|
156
|
+
this.locations = []
|
|
157
|
+
this.functions = []
|
|
158
|
+
this.decorators = {}
|
|
159
|
+
|
|
160
|
+
// A synthetic single-frame location to serve as the location for timeline
|
|
161
|
+
// samples. We need these as the profiling backend (mimicking official pprof
|
|
162
|
+
// tool's behavior) ignores these.
|
|
163
|
+
const fn = new Function({ id: this.functions.length + 1, name: this.stringTable.dedup('') })
|
|
164
|
+
this.functions.push(fn)
|
|
165
|
+
const line = new Line({ functionId: fn.id })
|
|
166
|
+
const location = new Location({ id: this.locations.length + 1, line: [line] })
|
|
167
|
+
this.locations.push(location)
|
|
168
|
+
this.locationId = [location.id]
|
|
169
|
+
|
|
170
|
+
this.timestampLabelKey = this.stringTable.dedup(END_TIMESTAMP_LABEL)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
addEvent (item) {
|
|
174
|
+
const { entryType, startTime, duration } = item
|
|
175
|
+
let decorator = this.decorators[entryType]
|
|
176
|
+
if (!decorator) {
|
|
177
|
+
const DecoratorCtor = decoratorTypes[entryType]
|
|
178
|
+
if (DecoratorCtor) {
|
|
179
|
+
decorator = new DecoratorCtor(this.stringTable)
|
|
180
|
+
decorator.eventTypeLabel = labelFromStrStr(this.stringTable, 'event', entryType)
|
|
181
|
+
this.decorators[entryType] = decorator
|
|
182
|
+
} else {
|
|
183
|
+
// Shouldn't happen but it's better to not rely on observer only getting
|
|
184
|
+
// requested event types.
|
|
185
|
+
return
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
const endTime = startTime + duration
|
|
189
|
+
const sampleInput = {
|
|
190
|
+
value: [Math.round(duration * MS_TO_NS)],
|
|
191
|
+
locationId: this.locationId,
|
|
192
|
+
label: [
|
|
193
|
+
decorator.eventTypeLabel,
|
|
194
|
+
new Label({ key: this.timestampLabelKey, num: dateOffset + BigInt(Math.round(endTime * MS_TO_NS)) })
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
decorator.decorateSample(sampleInput, item)
|
|
198
|
+
this.samples.push(new Sample(sampleInput))
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
createProfile (startDate, endDate) {
|
|
202
|
+
const timeValueType = new ValueType({
|
|
203
|
+
type: this.stringTable.dedup(pprofValueType),
|
|
204
|
+
unit: this.stringTable.dedup(pprofValueUnit)
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
return new Profile({
|
|
208
|
+
sampleType: [timeValueType],
|
|
209
|
+
timeNanos: endDate.getTime() * MS_TO_NS,
|
|
210
|
+
periodType: timeValueType,
|
|
211
|
+
period: 1,
|
|
212
|
+
durationNanos: (endDate.getTime() - startDate.getTime()) * MS_TO_NS,
|
|
213
|
+
sample: this.samples,
|
|
214
|
+
location: this.locations,
|
|
215
|
+
function: this.functions,
|
|
216
|
+
stringTable: this.stringTable
|
|
217
|
+
})
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
149
221
|
/**
|
|
150
222
|
* This class generates pprof files with timeline events sourced from Node.js
|
|
151
223
|
* performance measurement APIs.
|
|
@@ -155,7 +227,7 @@ class EventsProfiler {
|
|
|
155
227
|
this.type = 'events'
|
|
156
228
|
this._flushIntervalNanos = (options.flushInterval || 60000) * 1e6 // 60 sec
|
|
157
229
|
this._observer = undefined
|
|
158
|
-
this.
|
|
230
|
+
this.eventSerializer = new EventSerializer()
|
|
159
231
|
}
|
|
160
232
|
|
|
161
233
|
start () {
|
|
@@ -163,7 +235,9 @@ class EventsProfiler {
|
|
|
163
235
|
if (this._observer) return
|
|
164
236
|
|
|
165
237
|
function add (items) {
|
|
166
|
-
|
|
238
|
+
for (const item of items.getEntries()) {
|
|
239
|
+
this.eventSerializer.addEvent(item)
|
|
240
|
+
}
|
|
167
241
|
}
|
|
168
242
|
this._observer = new PerformanceObserver(add.bind(this))
|
|
169
243
|
this._observer.observe({ entryTypes: Object.keys(decoratorTypes) })
|
|
@@ -177,89 +251,12 @@ class EventsProfiler {
|
|
|
177
251
|
}
|
|
178
252
|
|
|
179
253
|
profile (restart, startDate, endDate) {
|
|
180
|
-
if (this.entries.length === 0) {
|
|
181
|
-
// No events in the period; don't produce a profile
|
|
182
|
-
return null
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const stringTable = new StringTable()
|
|
186
|
-
const locations = []
|
|
187
|
-
const functions = []
|
|
188
|
-
|
|
189
|
-
// A synthetic single-frame location to serve as the location for timeline
|
|
190
|
-
// samples. We need these as the profiling backend (mimicking official pprof
|
|
191
|
-
// tool's behavior) ignores these.
|
|
192
|
-
const locationId = (() => {
|
|
193
|
-
const fn = new Function({ id: functions.length + 1, name: stringTable.dedup('') })
|
|
194
|
-
functions.push(fn)
|
|
195
|
-
const line = new Line({ functionId: fn.id })
|
|
196
|
-
const location = new Location({ id: locations.length + 1, line: [line] })
|
|
197
|
-
locations.push(location)
|
|
198
|
-
return [location.id]
|
|
199
|
-
})()
|
|
200
|
-
|
|
201
|
-
const decorators = {}
|
|
202
|
-
for (const [eventType, DecoratorCtor] of Object.entries(decoratorTypes)) {
|
|
203
|
-
const decorator = new DecoratorCtor(stringTable)
|
|
204
|
-
decorator.eventTypeLabel = labelFromStrStr(stringTable, 'event', eventType)
|
|
205
|
-
decorators[eventType] = decorator
|
|
206
|
-
}
|
|
207
|
-
const timestampLabelKey = stringTable.dedup(END_TIMESTAMP_LABEL)
|
|
208
|
-
|
|
209
|
-
const dateOffset = BigInt(Math.round(performance.timeOrigin * MS_TO_NS))
|
|
210
|
-
const lateEntries = []
|
|
211
|
-
const perfEndDate = endDate.getTime() - performance.timeOrigin
|
|
212
|
-
const samples = this.entries.map((item) => {
|
|
213
|
-
const decorator = decorators[item.entryType]
|
|
214
|
-
if (!decorator) {
|
|
215
|
-
// Shouldn't happen but it's better to not rely on observer only getting
|
|
216
|
-
// requested event types.
|
|
217
|
-
return null
|
|
218
|
-
}
|
|
219
|
-
const { startTime, duration } = item
|
|
220
|
-
if (startTime >= perfEndDate) {
|
|
221
|
-
// An event past the current recording end date; save it for the next
|
|
222
|
-
// profile. Not supposed to happen as long as there's no async activity
|
|
223
|
-
// between capture of the endDate value in profiler.js _collect() and
|
|
224
|
-
// here, but better be safe than sorry.
|
|
225
|
-
lateEntries.push(item)
|
|
226
|
-
return null
|
|
227
|
-
}
|
|
228
|
-
const endTime = startTime + duration
|
|
229
|
-
const sampleInput = {
|
|
230
|
-
value: [Math.round(duration * MS_TO_NS)],
|
|
231
|
-
locationId,
|
|
232
|
-
label: [
|
|
233
|
-
decorator.eventTypeLabel,
|
|
234
|
-
new Label({ key: timestampLabelKey, num: dateOffset + BigInt(Math.round(endTime * MS_TO_NS)) })
|
|
235
|
-
]
|
|
236
|
-
}
|
|
237
|
-
decorator.decorateSample(sampleInput, item)
|
|
238
|
-
return new Sample(sampleInput)
|
|
239
|
-
}).filter(v => v)
|
|
240
|
-
|
|
241
|
-
this.entries = lateEntries
|
|
242
|
-
|
|
243
|
-
const timeValueType = new ValueType({
|
|
244
|
-
type: stringTable.dedup(pprofValueType),
|
|
245
|
-
unit: stringTable.dedup(pprofValueUnit)
|
|
246
|
-
})
|
|
247
|
-
|
|
248
254
|
if (!restart) {
|
|
249
255
|
this.stop()
|
|
250
256
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
timeNanos: endDate.getTime() * MS_TO_NS,
|
|
255
|
-
periodType: timeValueType,
|
|
256
|
-
period: 1,
|
|
257
|
-
durationNanos: (endDate.getTime() - startDate.getTime()) * MS_TO_NS,
|
|
258
|
-
sample: samples,
|
|
259
|
-
location: locations,
|
|
260
|
-
function: functions,
|
|
261
|
-
stringTable: stringTable
|
|
262
|
-
})
|
|
257
|
+
const profile = this.eventSerializer.createProfile(startDate, endDate)
|
|
258
|
+
this.eventSerializer = new EventSerializer()
|
|
259
|
+
return profile
|
|
263
260
|
}
|
|
264
261
|
|
|
265
262
|
encode (profile) {
|
|
@@ -6,6 +6,7 @@ const runtimeMetrics = require('./runtime_metrics')
|
|
|
6
6
|
const log = require('./log')
|
|
7
7
|
const { setStartupLogPluginManager } = require('./startup-log')
|
|
8
8
|
const telemetry = require('./telemetry')
|
|
9
|
+
const nomenclature = require('./service-naming')
|
|
9
10
|
const PluginManager = require('./plugin_manager')
|
|
10
11
|
const remoteConfig = require('./appsec/remote_config')
|
|
11
12
|
const AppsecSdk = require('./appsec/sdk')
|
|
@@ -17,6 +18,7 @@ class Tracer extends NoopProxy {
|
|
|
17
18
|
super()
|
|
18
19
|
|
|
19
20
|
this._initialized = false
|
|
21
|
+
this._nomenclature = nomenclature
|
|
20
22
|
this._pluginManager = new PluginManager(this)
|
|
21
23
|
this.dogstatsd = new dogstatsd.NoopDogStatsDClient()
|
|
22
24
|
this._tracingInitialized = false
|
|
@@ -238,12 +238,15 @@ function captureHistograms () {
|
|
|
238
238
|
*
|
|
239
239
|
* performance.eventLoopUtilization available in Node.js >= v14.10, >= v12.19, >= v16
|
|
240
240
|
*/
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
241
|
+
let captureELU = () => {}
|
|
242
|
+
if ('eventLoopUtilization' in performance) {
|
|
243
|
+
captureELU = () => {
|
|
244
|
+
// if elu is undefined (first run) the measurement is from start of process
|
|
245
|
+
elu = performance.eventLoopUtilization(elu)
|
|
244
246
|
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
+
client.gauge('runtime.node.event_loop.utilization', elu.utilization)
|
|
248
|
+
}
|
|
249
|
+
}
|
|
247
250
|
|
|
248
251
|
function captureCommonMetrics () {
|
|
249
252
|
captureMemoryUsage()
|
|
@@ -4,7 +4,7 @@ const log = require('./log')
|
|
|
4
4
|
|
|
5
5
|
function maybeStartServerlessMiniAgent (config) {
|
|
6
6
|
if (process.platform !== 'win32' && process.platform !== 'linux') {
|
|
7
|
-
log.error(
|
|
7
|
+
log.error('Serverless Mini Agent is only supported on Windows and Linux.')
|
|
8
8
|
return
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -34,7 +34,8 @@ function getRustBinaryPath (config) {
|
|
|
34
34
|
|
|
35
35
|
const rustBinaryPathRoot = config.isGCPFunction ? '/workspace' : '/home/site/wwwroot'
|
|
36
36
|
const rustBinaryPathOsFolder = process.platform === 'win32'
|
|
37
|
-
? 'datadog-serverless-agent-windows-amd64'
|
|
37
|
+
? 'datadog-serverless-agent-windows-amd64'
|
|
38
|
+
: 'datadog-serverless-agent-linux-amd64'
|
|
38
39
|
|
|
39
40
|
const rustBinaryExtension = process.platform === 'win32' ? '.exe' : ''
|
|
40
41
|
|
|
@@ -33,6 +33,30 @@ const web = {
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
server: {
|
|
36
|
+
'apollo.gateway.request': {
|
|
37
|
+
opName: () => 'apollo.gateway.request',
|
|
38
|
+
serviceName: ({ pluginConfig, tracerService }) => pluginConfig.service || tracerService
|
|
39
|
+
},
|
|
40
|
+
'apollo.gateway.plan': {
|
|
41
|
+
opName: () => 'apollo.gateway.plan',
|
|
42
|
+
serviceName: ({ pluginConfig, tracerService }) => pluginConfig.service || tracerService
|
|
43
|
+
},
|
|
44
|
+
'apollo.gateway.validate': {
|
|
45
|
+
opName: () => 'apollo.gateway.validate',
|
|
46
|
+
serviceName: ({ pluginConfig, tracerService }) => pluginConfig.service || tracerService
|
|
47
|
+
},
|
|
48
|
+
'apollo.gateway.execute': {
|
|
49
|
+
opName: () => 'apollo.gateway.execute',
|
|
50
|
+
serviceName: ({ pluginConfig, tracerService }) => pluginConfig.service || tracerService
|
|
51
|
+
},
|
|
52
|
+
'apollo.gateway.fetch': {
|
|
53
|
+
opName: () => 'apollo.gateway.fetch',
|
|
54
|
+
serviceName: ({ pluginConfig, tracerService }) => pluginConfig.service || tracerService
|
|
55
|
+
},
|
|
56
|
+
'apollo.gateway.postprocessing': {
|
|
57
|
+
opName: () => 'apollo.gateway.postprocessing',
|
|
58
|
+
serviceName: ({ pluginConfig, tracerService }) => pluginConfig.service || tracerService
|
|
59
|
+
},
|
|
36
60
|
grpc: {
|
|
37
61
|
opName: () => DD_MAJOR <= 2 ? 'grpc.request' : 'grpc.server',
|
|
38
62
|
serviceName: identityService
|
|
@@ -32,6 +32,30 @@ const web = {
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
server: {
|
|
35
|
+
'apollo.gateway.request': {
|
|
36
|
+
opName: () => 'apollo.gateway.request',
|
|
37
|
+
serviceName: ({ pluginConfig, tracerService }) => pluginConfig.service || tracerService
|
|
38
|
+
},
|
|
39
|
+
'apollo.gateway.plan': {
|
|
40
|
+
opName: () => 'apollo.gateway.plan',
|
|
41
|
+
serviceName: ({ pluginConfig, tracerService }) => pluginConfig.service || tracerService
|
|
42
|
+
},
|
|
43
|
+
'apollo.gateway.validate': {
|
|
44
|
+
opName: () => 'apollo.gateway.validate',
|
|
45
|
+
serviceName: ({ pluginConfig, tracerService }) => pluginConfig.service || tracerService
|
|
46
|
+
},
|
|
47
|
+
'apollo.gateway.execute': {
|
|
48
|
+
opName: () => 'apollo.gateway.execute',
|
|
49
|
+
serviceName: ({ pluginConfig, tracerService }) => pluginConfig.service || tracerService
|
|
50
|
+
},
|
|
51
|
+
'apollo.gateway.fetch': {
|
|
52
|
+
opName: () => 'apollo.gateway.fetch',
|
|
53
|
+
serviceName: ({ pluginConfig, tracerService }) => pluginConfig.service || tracerService
|
|
54
|
+
},
|
|
55
|
+
'apollo.gateway.postprocessing': {
|
|
56
|
+
opName: () => 'apollo.gateway.postprocessing',
|
|
57
|
+
serviceName: ({ pluginConfig, tracerService }) => pluginConfig.service || tracerService
|
|
58
|
+
},
|
|
35
59
|
grpc: {
|
|
36
60
|
opName: () => 'grpc.server.request',
|
|
37
61
|
serviceName: identityService
|
|
@@ -181,7 +181,7 @@ class SpanStatsProcessor {
|
|
|
181
181
|
const { bucketSizeNs } = this
|
|
182
182
|
const serializedBuckets = []
|
|
183
183
|
|
|
184
|
-
for (const [
|
|
184
|
+
for (const [timeNs, bucket] of this.buckets.entries()) {
|
|
185
185
|
const bucketAggStats = []
|
|
186
186
|
|
|
187
187
|
for (const stats of bucket.values()) {
|
|
@@ -12,7 +12,7 @@ const savedDependenciesToSend = new Set()
|
|
|
12
12
|
const detectedDependencyKeys = new Set()
|
|
13
13
|
const detectedDependencyVersions = new Set()
|
|
14
14
|
|
|
15
|
-
const FILE_URI_START =
|
|
15
|
+
const FILE_URI_START = 'file://'
|
|
16
16
|
const moduleLoadStartChannel = dc.channel('dd-trace:moduleLoadStart')
|
|
17
17
|
|
|
18
18
|
let immediate, config, application, host, initialLoad
|
|
@@ -21,12 +21,11 @@ let getRetryData
|
|
|
21
21
|
let updateRetryData
|
|
22
22
|
|
|
23
23
|
function createBatchPayload (payload) {
|
|
24
|
-
const batchPayload =
|
|
25
|
-
|
|
26
|
-
batchPayload.push({
|
|
24
|
+
const batchPayload = payload.map(item => {
|
|
25
|
+
return {
|
|
27
26
|
request_type: item.reqType,
|
|
28
27
|
payload: item.payload
|
|
29
|
-
}
|
|
28
|
+
}
|
|
30
29
|
})
|
|
31
30
|
|
|
32
31
|
return batchPayload
|
|
@@ -35,7 +35,7 @@ function updateRetryData (error, retryObj) {
|
|
|
35
35
|
if (retryObj.reqType === 'message-batch') {
|
|
36
36
|
const payload = retryObj.payload[0].payload
|
|
37
37
|
const reqType = retryObj.payload[0].request_type
|
|
38
|
-
retryData = { payload
|
|
38
|
+
retryData = { payload, reqType }
|
|
39
39
|
|
|
40
40
|
// Since this payload failed twice it now gets save in to the extended heartbeat
|
|
41
41
|
const failedPayload = retryObj.payload[1].payload
|
|
@@ -43,17 +43,17 @@ function updateRetryData (error, retryObj) {
|
|
|
43
43
|
|
|
44
44
|
// save away the dependencies and integration request for extended heartbeat.
|
|
45
45
|
if (failedReqType === 'app-integrations-change') {
|
|
46
|
-
if (extendedHeartbeatPayload
|
|
47
|
-
extendedHeartbeatPayload
|
|
46
|
+
if (extendedHeartbeatPayload.integrations) {
|
|
47
|
+
extendedHeartbeatPayload.integrations.push(failedPayload)
|
|
48
48
|
} else {
|
|
49
|
-
extendedHeartbeatPayload
|
|
49
|
+
extendedHeartbeatPayload.integrations = [failedPayload]
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
if (failedReqType === 'app-dependencies-loaded') {
|
|
53
|
-
if (extendedHeartbeatPayload
|
|
54
|
-
extendedHeartbeatPayload
|
|
53
|
+
if (extendedHeartbeatPayload.dependencies) {
|
|
54
|
+
extendedHeartbeatPayload.dependencies.push(failedPayload)
|
|
55
55
|
} else {
|
|
56
|
-
extendedHeartbeatPayload
|
|
56
|
+
extendedHeartbeatPayload.dependencies = [failedPayload]
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
} else {
|
|
@@ -187,12 +187,11 @@ function getTelemetryData () {
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
function createBatchPayload (payload) {
|
|
190
|
-
const batchPayload =
|
|
191
|
-
|
|
192
|
-
batchPayload.push({
|
|
190
|
+
const batchPayload = payload.map(item => {
|
|
191
|
+
return {
|
|
193
192
|
request_type: item.reqType,
|
|
194
193
|
payload: item.payload
|
|
195
|
-
}
|
|
194
|
+
}
|
|
196
195
|
})
|
|
197
196
|
|
|
198
197
|
return batchPayload
|
|
@@ -202,10 +201,10 @@ function createPayload (currReqType, currPayload = {}) {
|
|
|
202
201
|
if (getRetryData()) {
|
|
203
202
|
const payload = { reqType: currReqType, payload: currPayload }
|
|
204
203
|
const batchPayload = createBatchPayload([payload, retryData])
|
|
205
|
-
return {
|
|
204
|
+
return { reqType: 'message-batch', payload: batchPayload }
|
|
206
205
|
}
|
|
207
206
|
|
|
208
|
-
return {
|
|
207
|
+
return { reqType: currReqType, payload: currPayload }
|
|
209
208
|
}
|
|
210
209
|
|
|
211
210
|
function heartbeat (config, application, host) {
|
|
@@ -32,13 +32,6 @@ function globMatch (pattern, subject) {
|
|
|
32
32
|
if (px < pattern.length) {
|
|
33
33
|
const c = pattern[px]
|
|
34
34
|
switch (c) {
|
|
35
|
-
default: // ordinary character
|
|
36
|
-
if (sx < subject.length && subject[sx] === c) {
|
|
37
|
-
px++
|
|
38
|
-
sx++
|
|
39
|
-
continue
|
|
40
|
-
}
|
|
41
|
-
break
|
|
42
35
|
case '?':
|
|
43
36
|
if (sx < subject.length) {
|
|
44
37
|
px++
|
|
@@ -51,6 +44,13 @@ function globMatch (pattern, subject) {
|
|
|
51
44
|
nextSx = sx + 1
|
|
52
45
|
px++
|
|
53
46
|
continue
|
|
47
|
+
default: // ordinary character
|
|
48
|
+
if (sx < subject.length && subject[sx] === c) {
|
|
49
|
+
px++
|
|
50
|
+
sx++
|
|
51
|
+
continue
|
|
52
|
+
}
|
|
53
|
+
break
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
if (nextSx > 0 && nextSx <= subject.length) {
|