dd-trace 5.7.0 → 5.9.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
|
@@ -23,13 +23,10 @@ const fromEntries = Object.fromEntries || (entries =>
|
|
|
23
23
|
|
|
24
24
|
// eslint-disable-next-line max-len
|
|
25
25
|
const qsRegex = '(?:p(?:ass)?w(?:or)?d|pass(?:_?phrase)?|secret|(?:api_?|private_?|public_?|access_?|secret_?)key(?:_?id)?|token|consumer_?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?)(?:(?:\\s|%20)*(?:=|%3D)[^&]+|(?:"|%22)(?:\\s|%20)*(?::|%3A)(?:\\s|%20)*(?:"|%22)(?:%2[^2]|%[^2]|[^"%])+(?:"|%22))|bearer(?:\\s|%20)+[a-z0-9\\._\\-]+|token(?::|%3A)[a-z0-9]{13}|gh[opsu]_[0-9a-zA-Z]{36}|ey[I-L](?:[\\w=-]|%3D)+\\.ey[I-L](?:[\\w=-]|%3D)+(?:\\.(?:[\\w.+\\/=-]|%3D|%2F|%2B)+)?|[\\-]{5}BEGIN(?:[a-z\\s]|%20)+PRIVATE(?:\\s|%20)KEY[\\-]{5}[^\\-]+[\\-]{5}END(?:[a-z\\s]|%20)+PRIVATE(?:\\s|%20)KEY|ssh-rsa(?:\\s|%20)*(?:[a-z0-9\\/\\.+]|%2F|%5C|%2B){100,}'
|
|
26
|
-
|
|
27
|
-
|public_?)key)|token|consumer_?(?:id|key|secret)|sign(?:ed|ature)|bearer|authorization
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
ken|consumer_?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?)(?:\\s*=[^;]|"\\s*:\\s*"[^"]+")|bearer\
|
|
31
|
-
\\s+[a-z0-9\\._\\-]+|token:[a-z0-9]{13}|gh[opsu]_[0-9a-zA-Z]{36}|ey[I-L][\\w=-]+\\.ey[I-L][\\w=-]+(?:\\.[\\w.+\\/=-]+)?\
|
|
32
|
-
|[\\-]{5}BEGIN[a-z\\s]+PRIVATE\\sKEY[\\-]{5}[^\\-]+[\\-]{5}END[a-z\\s]+PRIVATE\\sKEY|ssh-rsa\\s*[a-z0-9\\/\\.+]{100,}`
|
|
26
|
+
// eslint-disable-next-line max-len
|
|
27
|
+
const defaultWafObfuscatorKeyRegex = '(?i)(?:p(?:ass)?w(?:or)?d|pass(?:_?phrase)?|secret|(?:api_?|private_?|public_?)key)|token|consumer_?(?:id|key|secret)|sign(?:ed|ature)|bearer|authorization'
|
|
28
|
+
// eslint-disable-next-line max-len
|
|
29
|
+
const defaultWafObfuscatorValueRegex = '(?i)(?:p(?:ass)?w(?:or)?d|pass(?:_?phrase)?|secret|(?:api_?|private_?|public_?|access_?|secret_?)key(?:_?id)?|token|consumer_?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?)(?:\\s*=[^;]|"\\s*:\\s*"[^"]+")|bearer\\s+[a-z0-9\\._\\-]+|token:[a-z0-9]{13}|gh[opsu]_[0-9a-zA-Z]{36}|ey[I-L][\\w=-]+\\.ey[I-L][\\w=-]+(?:\\.[\\w.+\\/=-]+)?|[\\-]{5}BEGIN[a-z\\s]+PRIVATE\\sKEY[\\-]{5}[^\\-]+[\\-]{5}END[a-z\\s]+PRIVATE\\sKEY|ssh-rsa\\s*[a-z0-9\\/\\.+]{100,}'
|
|
33
30
|
|
|
34
31
|
function maybeFile (filepath) {
|
|
35
32
|
if (!filepath) return
|
|
@@ -132,9 +129,11 @@ class Config {
|
|
|
132
129
|
|
|
133
130
|
const DD_SERVICE_MAPPING = coalesce(
|
|
134
131
|
options.serviceMapping,
|
|
135
|
-
process.env.DD_SERVICE_MAPPING
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
process.env.DD_SERVICE_MAPPING
|
|
133
|
+
? fromEntries(
|
|
134
|
+
process.env.DD_SERVICE_MAPPING.split(',').map(x => x.trim().split(':'))
|
|
135
|
+
)
|
|
136
|
+
: {}
|
|
138
137
|
)
|
|
139
138
|
|
|
140
139
|
const DD_API_KEY = coalesce(
|
|
@@ -704,7 +703,7 @@ class Config {
|
|
|
704
703
|
_isCiVisibility () {
|
|
705
704
|
return coalesce(
|
|
706
705
|
this.options.isCiVisibility,
|
|
707
|
-
this._defaults
|
|
706
|
+
this._defaults.isCiVisibility
|
|
708
707
|
)
|
|
709
708
|
}
|
|
710
709
|
|
|
@@ -717,7 +716,8 @@ class Config {
|
|
|
717
716
|
|
|
718
717
|
_getHostname () {
|
|
719
718
|
const DD_CIVISIBILITY_AGENTLESS_URL = process.env.DD_CIVISIBILITY_AGENTLESS_URL
|
|
720
|
-
const url = DD_CIVISIBILITY_AGENTLESS_URL
|
|
719
|
+
const url = DD_CIVISIBILITY_AGENTLESS_URL
|
|
720
|
+
? new URL(DD_CIVISIBILITY_AGENTLESS_URL)
|
|
721
721
|
: getAgentUrl(this._getTraceAgentUrl(), this.options)
|
|
722
722
|
const DD_AGENT_HOST = coalesce(
|
|
723
723
|
this.options.hostname,
|
|
@@ -808,7 +808,7 @@ class Config {
|
|
|
808
808
|
}
|
|
809
809
|
this._setString(calc, 'dogstatsd.hostname', this._getHostname())
|
|
810
810
|
this._setBoolean(calc, 'isGitUploadEnabled',
|
|
811
|
-
calc
|
|
811
|
+
calc.isIntelligentTestRunnerEnabled && !isFalse(this._isCiVisibilityGitUploadEnabled()))
|
|
812
812
|
this._setBoolean(calc, 'spanComputePeerService', this._getSpanComputePeerService())
|
|
813
813
|
this._setBoolean(calc, 'stats.enabled', this._isTraceStatsComputationEnabled())
|
|
814
814
|
}
|
|
@@ -22,7 +22,7 @@ function computeHash (service, env, edgeTags, parentHash) {
|
|
|
22
22
|
return cache.get(key)
|
|
23
23
|
}
|
|
24
24
|
const currentHash = shaHash(`${service}${env}` + edgeTags.join(''))
|
|
25
|
-
const buf = Buffer.concat([
|
|
25
|
+
const buf = Buffer.concat([currentHash, parentHash], 16)
|
|
26
26
|
const val = shaHash(buf.toString())
|
|
27
27
|
cache.set(key, val)
|
|
28
28
|
return val
|
|
@@ -273,12 +273,12 @@ class DataStreamsProcessor {
|
|
|
273
273
|
const edgeLatencyNs = nowNs - edgeStartNs
|
|
274
274
|
const pathwayLatencyNs = nowNs - pathwayStartNs
|
|
275
275
|
const dataStreamsContext = {
|
|
276
|
-
hash
|
|
277
|
-
edgeStartNs
|
|
278
|
-
pathwayStartNs
|
|
276
|
+
hash,
|
|
277
|
+
edgeStartNs,
|
|
278
|
+
pathwayStartNs,
|
|
279
279
|
previousDirection: direction,
|
|
280
|
-
closestOppositeDirectionHash
|
|
281
|
-
closestOppositeDirectionEdgeStart
|
|
280
|
+
closestOppositeDirectionHash,
|
|
281
|
+
closestOppositeDirectionEdgeStart
|
|
282
282
|
}
|
|
283
283
|
if (direction === 'direction:out') {
|
|
284
284
|
// Add the header for this now, as the callee doesn't have access to context when producing
|
|
@@ -289,12 +289,12 @@ class DataStreamsProcessor {
|
|
|
289
289
|
}
|
|
290
290
|
const checkpoint = {
|
|
291
291
|
currentTimestamp: nowNs,
|
|
292
|
-
parentHash
|
|
293
|
-
hash
|
|
294
|
-
edgeTags
|
|
295
|
-
edgeLatencyNs
|
|
296
|
-
pathwayLatencyNs
|
|
297
|
-
payloadSize
|
|
292
|
+
parentHash,
|
|
293
|
+
hash,
|
|
294
|
+
edgeTags,
|
|
295
|
+
edgeLatencyNs,
|
|
296
|
+
pathwayLatencyNs,
|
|
297
|
+
payloadSize
|
|
298
298
|
}
|
|
299
299
|
this.recordCheckpoint(checkpoint, span)
|
|
300
300
|
return dataStreamsContext
|
|
@@ -320,7 +320,7 @@ class DataStreamsProcessor {
|
|
|
320
320
|
// TimeBuckets
|
|
321
321
|
const serializedBuckets = []
|
|
322
322
|
|
|
323
|
-
for (const [
|
|
323
|
+
for (const [timeNs, bucket] of this.buckets.entries()) {
|
|
324
324
|
const points = []
|
|
325
325
|
|
|
326
326
|
// bucket: StatsBucket
|
|
@@ -354,9 +354,9 @@ class DataStreamsProcessor {
|
|
|
354
354
|
}
|
|
355
355
|
|
|
356
356
|
module.exports = {
|
|
357
|
-
DataStreamsProcessor
|
|
358
|
-
StatsPoint
|
|
359
|
-
StatsBucket
|
|
357
|
+
DataStreamsProcessor,
|
|
358
|
+
StatsPoint,
|
|
359
|
+
StatsBucket,
|
|
360
360
|
Backlog,
|
|
361
361
|
TimeBuckets,
|
|
362
362
|
getMessageSize,
|
|
@@ -328,8 +328,8 @@ class AgentlessCiVisibilityEncoder extends AgentEncoder {
|
|
|
328
328
|
version: ENCODING_VERSION,
|
|
329
329
|
metadata: {
|
|
330
330
|
'*': {
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
language: 'javascript',
|
|
332
|
+
library_version: ddTraceVersion
|
|
333
333
|
}
|
|
334
334
|
},
|
|
335
335
|
events: []
|
|
@@ -51,11 +51,11 @@ class ExternalLogger {
|
|
|
51
51
|
|
|
52
52
|
const payload = {
|
|
53
53
|
...log,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
timestamp: Date.now(),
|
|
55
|
+
hostname: log.hostname || this.hostname,
|
|
56
|
+
ddsource: log.ddsource || this.ddsource,
|
|
57
|
+
service: log.service || this.service,
|
|
58
|
+
ddtags: logTags || undefined
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
this.enqueue(payload)
|
|
@@ -161,9 +161,11 @@ class Span {
|
|
|
161
161
|
get resource () {
|
|
162
162
|
return this._parentTracer.resource
|
|
163
163
|
}
|
|
164
|
+
|
|
164
165
|
get instrumentationLibrary () {
|
|
165
166
|
return this._parentTracer.instrumentationLibrary
|
|
166
167
|
}
|
|
168
|
+
|
|
167
169
|
get _spanProcessor () {
|
|
168
170
|
return this._parentTracer.getActiveSpanProcessor()
|
|
169
171
|
}
|
|
@@ -321,7 +321,7 @@ class TextMapPropagator {
|
|
|
321
321
|
}
|
|
322
322
|
const matches = headerValue.trim().match(traceparentExpr)
|
|
323
323
|
if (matches.length) {
|
|
324
|
-
const [
|
|
324
|
+
const [version, traceId, spanId, flags, tail] = matches.slice(1)
|
|
325
325
|
const traceparent = { version }
|
|
326
326
|
const tracestate = TraceState.fromString(carrier.tracestate)
|
|
327
327
|
if (invalidSegment.test(traceId)) return null
|
|
@@ -210,7 +210,7 @@ class DatadogSpan {
|
|
|
210
210
|
// Wrap the value as a string if it's not already a string
|
|
211
211
|
sanitizedAttributes[key] = typeof maybeScalar === 'string' ? maybeScalar : String(maybeScalar)
|
|
212
212
|
} else {
|
|
213
|
-
log.warn(
|
|
213
|
+
log.warn('Dropping span link attribute. It is not of an allowed type')
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
}
|
|
@@ -4,7 +4,6 @@ const { channel } = require('dc-polyfill')
|
|
|
4
4
|
const { isFalse } = require('./util')
|
|
5
5
|
const plugins = require('./plugins')
|
|
6
6
|
const log = require('./log')
|
|
7
|
-
const Nomenclature = require('./service-naming')
|
|
8
7
|
|
|
9
8
|
const loadChannel = channel('dd-trace:instrumentation:load')
|
|
10
9
|
|
|
@@ -102,7 +101,7 @@ module.exports = class PluginManager {
|
|
|
102
101
|
// like instrumenter.enable()
|
|
103
102
|
configure (config = {}) {
|
|
104
103
|
this._tracerConfig = config
|
|
105
|
-
|
|
104
|
+
this._tracer._nomenclature.configure(config)
|
|
106
105
|
|
|
107
106
|
for (const name in pluginClasses) {
|
|
108
107
|
this.loadPlugin(name)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const TracingPlugin = require('./tracing')
|
|
2
|
+
const { storage } = require('../../../datadog-core')
|
|
3
|
+
|
|
4
|
+
class ApolloBasePlugin extends TracingPlugin {
|
|
5
|
+
static get id () { return 'apollo.gateway' }
|
|
6
|
+
static get type () { return 'web' }
|
|
7
|
+
static get kind () { return 'server' }
|
|
8
|
+
|
|
9
|
+
bindStart (ctx) {
|
|
10
|
+
const store = storage.getStore()
|
|
11
|
+
const childOf = store ? store.span : null
|
|
12
|
+
|
|
13
|
+
const span = this.startSpan(this.getOperationName(), {
|
|
14
|
+
childOf,
|
|
15
|
+
service: this.getServiceName(),
|
|
16
|
+
type: this.constructor.type,
|
|
17
|
+
kind: this.constructor.kind,
|
|
18
|
+
meta: {}
|
|
19
|
+
}, false)
|
|
20
|
+
|
|
21
|
+
ctx.parentStore = store
|
|
22
|
+
ctx.currentStore = { ...store, span }
|
|
23
|
+
|
|
24
|
+
return ctx.currentStore
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
end (ctx) {
|
|
28
|
+
// Only synchronous operations would have `result` or `error` on `end`.
|
|
29
|
+
if (!ctx.hasOwnProperty('result') && !ctx.hasOwnProperty('error')) return
|
|
30
|
+
ctx?.currentStore?.span?.finish()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
asyncStart (ctx) {
|
|
34
|
+
ctx?.currentStore?.span.finish()
|
|
35
|
+
return ctx.parentStore
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
getServiceName () {
|
|
39
|
+
return this.serviceName({
|
|
40
|
+
id: `${this.constructor.id}.${this.constructor.operation}`,
|
|
41
|
+
pluginConfig: this.config
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
getOperationName () {
|
|
46
|
+
return this.operationName({
|
|
47
|
+
id: `${this.constructor.id}.${this.constructor.operation}`
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
module.exports = ApolloBasePlugin
|
|
@@ -42,7 +42,7 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
42
42
|
}
|
|
43
43
|
this.tracer._exporter.getLibraryConfiguration(this.testConfiguration, (err, libraryConfig) => {
|
|
44
44
|
if (err) {
|
|
45
|
-
log.error(`
|
|
45
|
+
log.error(`Library configuration could not be fetched. ${err.message}`)
|
|
46
46
|
} else {
|
|
47
47
|
this.libraryConfig = libraryConfig
|
|
48
48
|
}
|
|
@@ -123,6 +123,7 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
123
123
|
this.tracer._exporter.getKnownTests(this.testConfiguration, (err, knownTests) => {
|
|
124
124
|
if (err) {
|
|
125
125
|
log.error(`Known tests could not be fetched. ${err.message}`)
|
|
126
|
+
this.libraryConfig.isEarlyFlakeDetectionEnabled = false
|
|
126
127
|
}
|
|
127
128
|
onDone({ err, knownTests })
|
|
128
129
|
})
|
|
@@ -12,11 +12,11 @@ class CompositePlugin extends Plugin {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
configure (config) {
|
|
15
|
+
super.configure(config)
|
|
15
16
|
for (const name in this.constructor.plugins) {
|
|
16
|
-
const pluginConfig = config[name] === false
|
|
17
|
-
|
|
18
|
-
...config[name]
|
|
19
|
-
}
|
|
17
|
+
const pluginConfig = config[name] === false
|
|
18
|
+
? false
|
|
19
|
+
: { ...config, ...config[name] }
|
|
20
20
|
|
|
21
21
|
this[name].configure(pluginConfig)
|
|
22
22
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
+
get '@apollo/gateway' () { return require('../../../datadog-plugin-apollo/src') },
|
|
4
5
|
get '@aws-sdk/smithy-client' () { return require('../../../datadog-plugin-aws-sdk/src') },
|
|
5
6
|
get '@cucumber/cucumber' () { return require('../../../datadog-plugin-cucumber/src') },
|
|
6
7
|
get '@playwright/test' () { return require('../../../datadog-plugin-playwright/src') },
|
|
@@ -17,66 +18,66 @@ module.exports = {
|
|
|
17
18
|
get '@opensearch-project/opensearch' () { return require('../../../datadog-plugin-opensearch/src') },
|
|
18
19
|
get '@redis/client' () { return require('../../../datadog-plugin-redis/src') },
|
|
19
20
|
get '@smithy/smithy-client' () { return require('../../../datadog-plugin-aws-sdk/src') },
|
|
20
|
-
get
|
|
21
|
-
get
|
|
22
|
-
get
|
|
21
|
+
get aerospike () { return require('../../../datadog-plugin-aerospike/src') },
|
|
22
|
+
get amqp10 () { return require('../../../datadog-plugin-amqp10/src') },
|
|
23
|
+
get amqplib () { return require('../../../datadog-plugin-amqplib/src') },
|
|
23
24
|
get 'aws-sdk' () { return require('../../../datadog-plugin-aws-sdk/src') },
|
|
24
|
-
get
|
|
25
|
+
get bunyan () { return require('../../../datadog-plugin-bunyan/src') },
|
|
25
26
|
get 'cassandra-driver' () { return require('../../../datadog-plugin-cassandra-driver/src') },
|
|
26
|
-
get
|
|
27
|
-
get
|
|
28
|
-
get
|
|
29
|
-
get
|
|
30
|
-
get
|
|
31
|
-
get
|
|
32
|
-
get
|
|
33
|
-
get
|
|
27
|
+
get child_process () { return require('../../../datadog-plugin-child_process/src') },
|
|
28
|
+
get connect () { return require('../../../datadog-plugin-connect/src') },
|
|
29
|
+
get couchbase () { return require('../../../datadog-plugin-couchbase/src') },
|
|
30
|
+
get cypress () { return require('../../../datadog-plugin-cypress/src') },
|
|
31
|
+
get dns () { return require('../../../datadog-plugin-dns/src') },
|
|
32
|
+
get elasticsearch () { return require('../../../datadog-plugin-elasticsearch/src') },
|
|
33
|
+
get express () { return require('../../../datadog-plugin-express/src') },
|
|
34
|
+
get fastify () { return require('../../../datadog-plugin-fastify/src') },
|
|
34
35
|
get 'find-my-way' () { return require('../../../datadog-plugin-find-my-way/src') },
|
|
35
|
-
get
|
|
36
|
-
get
|
|
37
|
-
get
|
|
38
|
-
get
|
|
39
|
-
get
|
|
40
|
-
get
|
|
41
|
-
get
|
|
36
|
+
get graphql () { return require('../../../datadog-plugin-graphql/src') },
|
|
37
|
+
get grpc () { return require('../../../datadog-plugin-grpc/src') },
|
|
38
|
+
get hapi () { return require('../../../datadog-plugin-hapi/src') },
|
|
39
|
+
get http () { return require('../../../datadog-plugin-http/src') },
|
|
40
|
+
get http2 () { return require('../../../datadog-plugin-http2/src') },
|
|
41
|
+
get https () { return require('../../../datadog-plugin-http/src') },
|
|
42
|
+
get ioredis () { return require('../../../datadog-plugin-ioredis/src') },
|
|
42
43
|
get 'jest-circus' () { return require('../../../datadog-plugin-jest/src') },
|
|
43
44
|
get 'jest-config' () { return require('../../../datadog-plugin-jest/src') },
|
|
44
45
|
get 'jest-environment-node' () { return require('../../../datadog-plugin-jest/src') },
|
|
45
46
|
get 'jest-environment-jsdom' () { return require('../../../datadog-plugin-jest/src') },
|
|
46
47
|
get 'jest-jasmine2' () { return require('../../../datadog-plugin-jest/src') },
|
|
47
48
|
get 'jest-worker' () { return require('../../../datadog-plugin-jest/src') },
|
|
48
|
-
get
|
|
49
|
+
get koa () { return require('../../../datadog-plugin-koa/src') },
|
|
49
50
|
get 'koa-router' () { return require('../../../datadog-plugin-koa/src') },
|
|
50
|
-
get
|
|
51
|
-
get
|
|
52
|
-
get
|
|
51
|
+
get kafkajs () { return require('../../../datadog-plugin-kafkajs/src') },
|
|
52
|
+
get mariadb () { return require('../../../datadog-plugin-mariadb/src') },
|
|
53
|
+
get memcached () { return require('../../../datadog-plugin-memcached/src') },
|
|
53
54
|
get 'microgateway-core' () { return require('../../../datadog-plugin-microgateway-core/src') },
|
|
54
|
-
get
|
|
55
|
+
get mocha () { return require('../../../datadog-plugin-mocha/src') },
|
|
55
56
|
get 'mocha-each' () { return require('../../../datadog-plugin-mocha/src') },
|
|
56
|
-
get
|
|
57
|
-
get
|
|
57
|
+
get moleculer () { return require('../../../datadog-plugin-moleculer/src') },
|
|
58
|
+
get mongodb () { return require('../../../datadog-plugin-mongodb-core/src') },
|
|
58
59
|
get 'mongodb-core' () { return require('../../../datadog-plugin-mongodb-core/src') },
|
|
59
|
-
get
|
|
60
|
-
get
|
|
61
|
-
get
|
|
62
|
-
get
|
|
60
|
+
get mysql () { return require('../../../datadog-plugin-mysql/src') },
|
|
61
|
+
get mysql2 () { return require('../../../datadog-plugin-mysql2/src') },
|
|
62
|
+
get net () { return require('../../../datadog-plugin-net/src') },
|
|
63
|
+
get next () { return require('../../../datadog-plugin-next/src') },
|
|
63
64
|
get 'node:dns' () { return require('../../../datadog-plugin-dns/src') },
|
|
64
65
|
get 'node:http' () { return require('../../../datadog-plugin-http/src') },
|
|
65
66
|
get 'node:http2' () { return require('../../../datadog-plugin-http2/src') },
|
|
66
67
|
get 'node:https' () { return require('../../../datadog-plugin-http/src') },
|
|
67
68
|
get 'node:net' () { return require('../../../datadog-plugin-net/src') },
|
|
68
|
-
get
|
|
69
|
-
get
|
|
70
|
-
get
|
|
71
|
-
get
|
|
72
|
-
get
|
|
69
|
+
get oracledb () { return require('../../../datadog-plugin-oracledb/src') },
|
|
70
|
+
get openai () { return require('../../../datadog-plugin-openai/src') },
|
|
71
|
+
get paperplane () { return require('../../../datadog-plugin-paperplane/src') },
|
|
72
|
+
get pg () { return require('../../../datadog-plugin-pg/src') },
|
|
73
|
+
get pino () { return require('../../../datadog-plugin-pino/src') },
|
|
73
74
|
get 'pino-pretty' () { return require('../../../datadog-plugin-pino/src') },
|
|
74
|
-
get
|
|
75
|
-
get
|
|
76
|
-
get
|
|
77
|
-
get
|
|
78
|
-
get
|
|
79
|
-
get
|
|
80
|
-
get
|
|
81
|
-
get
|
|
75
|
+
get playwright () { return require('../../../datadog-plugin-playwright/src') },
|
|
76
|
+
get redis () { return require('../../../datadog-plugin-redis/src') },
|
|
77
|
+
get restify () { return require('../../../datadog-plugin-restify/src') },
|
|
78
|
+
get rhea () { return require('../../../datadog-plugin-rhea/src') },
|
|
79
|
+
get router () { return require('../../../datadog-plugin-router/src') },
|
|
80
|
+
get sharedb () { return require('../../../datadog-plugin-sharedb/src') },
|
|
81
|
+
get tedious () { return require('../../../datadog-plugin-tedious/src') },
|
|
82
|
+
get winston () { return require('../../../datadog-plugin-winston/src') }
|
|
82
83
|
}
|
|
@@ -4,7 +4,6 @@ const Plugin = require('./plugin')
|
|
|
4
4
|
const { storage } = require('../../../datadog-core')
|
|
5
5
|
const analyticsSampler = require('../analytics_sampler')
|
|
6
6
|
const { COMPONENT } = require('../constants')
|
|
7
|
-
const Nomenclature = require('../service-naming')
|
|
8
7
|
|
|
9
8
|
class TracingPlugin extends Plugin {
|
|
10
9
|
constructor (...args) {
|
|
@@ -29,7 +28,7 @@ class TracingPlugin extends Plugin {
|
|
|
29
28
|
kind = this.constructor.kind
|
|
30
29
|
} = opts
|
|
31
30
|
|
|
32
|
-
return
|
|
31
|
+
return this._tracer._nomenclature.serviceName(type, kind, id, opts)
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
operationName (opts = {}) {
|
|
@@ -39,7 +38,7 @@ class TracingPlugin extends Plugin {
|
|
|
39
38
|
kind = this.constructor.kind
|
|
40
39
|
} = opts
|
|
41
40
|
|
|
42
|
-
return
|
|
41
|
+
return this._tracer._nomenclature.opName(type, kind, id, opts)
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
configure (config) {
|
|
@@ -58,8 +57,12 @@ class TracingPlugin extends Plugin {
|
|
|
58
57
|
this.activeSpan?.finish()
|
|
59
58
|
}
|
|
60
59
|
|
|
61
|
-
error (
|
|
62
|
-
|
|
60
|
+
error (ctxOrError) {
|
|
61
|
+
if (ctxOrError?.currentStore) {
|
|
62
|
+
ctxOrError.currentStore?.span.setTag('error', ctxOrError?.error)
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
this.addError(ctxOrError)
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
addTraceSubs () {
|
|
@@ -91,7 +94,7 @@ class TracingPlugin extends Plugin {
|
|
|
91
94
|
}
|
|
92
95
|
|
|
93
96
|
addError (error, span = this.activeSpan) {
|
|
94
|
-
if (!span._spanContext._tags
|
|
97
|
+
if (!span._spanContext._tags.error) {
|
|
95
98
|
// Errors may be wrapped in a context.
|
|
96
99
|
error = (error && error.error) || error
|
|
97
100
|
span.setTag('error', error || 1)
|
|
@@ -288,7 +288,8 @@ function getTestSuitePath (testSuiteAbsolutePath, sourceRoot) {
|
|
|
288
288
|
return sourceRoot
|
|
289
289
|
}
|
|
290
290
|
const testSuitePath = testSuiteAbsolutePath === sourceRoot
|
|
291
|
-
? testSuiteAbsolutePath
|
|
291
|
+
? testSuiteAbsolutePath
|
|
292
|
+
: path.relative(sourceRoot, testSuiteAbsolutePath)
|
|
292
293
|
|
|
293
294
|
return testSuitePath.replace(path.sep, '/')
|
|
294
295
|
}
|
|
@@ -63,7 +63,7 @@ const web = {
|
|
|
63
63
|
if (!span) return
|
|
64
64
|
|
|
65
65
|
span.context()._name = `${name}.request`
|
|
66
|
-
span.context()._tags
|
|
66
|
+
span.context()._tags.component = name
|
|
67
67
|
|
|
68
68
|
web.setConfig(req, config)
|
|
69
69
|
},
|
|
@@ -263,7 +263,7 @@ const web = {
|
|
|
263
263
|
const context = contexts.get(req)
|
|
264
264
|
const span = context.span
|
|
265
265
|
const error = context.error
|
|
266
|
-
const hasExistingError = span.context()._tags
|
|
266
|
+
const hasExistingError = span.context()._tags.error || span.context()._tags[ERROR_MESSAGE]
|
|
267
267
|
|
|
268
268
|
if (!hasExistingError && !context.config.validateStatus(statusCode)) {
|
|
269
269
|
span.setTag(ERROR, error || true)
|
|
@@ -405,7 +405,7 @@ function addAllowHeaders (req, res, headers) {
|
|
|
405
405
|
}
|
|
406
406
|
|
|
407
407
|
function isOriginAllowed (req, headers) {
|
|
408
|
-
const origin = req.headers
|
|
408
|
+
const origin = req.headers.origin
|
|
409
409
|
const allowOrigin = headers['access-control-allow-origin']
|
|
410
410
|
|
|
411
411
|
return origin && (allowOrigin === '*' || allowOrigin === origin)
|
|
@@ -498,7 +498,7 @@ function extractURL (req) {
|
|
|
498
498
|
return `${headers[HTTP2_HEADER_SCHEME]}://${headers[HTTP2_HEADER_AUTHORITY]}${headers[HTTP2_HEADER_PATH]}`
|
|
499
499
|
} else {
|
|
500
500
|
const protocol = getProtocol(req)
|
|
501
|
-
return `${protocol}://${req.headers
|
|
501
|
+
return `${protocol}://${req.headers.host}${req.originalUrl || req.url}`
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
504
|
|