dd-trace 5.58.0 → 5.59.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 +1 -0
- package/ci/cypress/after-run.js +2 -0
- package/ci/cypress/after-spec.js +2 -0
- package/ci/cypress/plugin.js +2 -0
- package/ci/cypress/polyfills.js +2 -0
- package/ci/cypress/support.js +2 -0
- package/ci/init.js +2 -0
- package/index.d.ts +7 -0
- package/init.js +0 -2
- package/initialize.mjs +2 -0
- package/package.json +36 -7
- package/packages/datadog-code-origin/index.js +14 -9
- package/packages/datadog-instrumentations/src/apollo.js +7 -10
- package/packages/datadog-instrumentations/src/avsc.js +2 -0
- package/packages/datadog-instrumentations/src/child_process.js +21 -42
- package/packages/datadog-instrumentations/src/cucumber.js +10 -8
- package/packages/datadog-instrumentations/src/cypress.js +2 -0
- package/packages/datadog-instrumentations/src/fastify.js +19 -1
- package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -0
- package/packages/datadog-instrumentations/src/helpers/register.js +1 -1
- package/packages/datadog-instrumentations/src/hono.js +102 -0
- package/packages/datadog-instrumentations/src/langchain.js +21 -0
- package/packages/datadog-instrumentations/src/mocha/common.js +2 -0
- package/packages/datadog-instrumentations/src/mocha.js +2 -0
- package/packages/datadog-instrumentations/src/nyc.js +2 -0
- package/packages/datadog-instrumentations/src/orchestrion-config/index.js +32 -0
- package/packages/datadog-instrumentations/src/playwright.js +5 -1
- package/packages/datadog-instrumentations/src/protobufjs.js +2 -0
- package/packages/datadog-instrumentations/src/selenium.js +2 -0
- package/packages/datadog-instrumentations/src/vitest.js +2 -0
- package/packages/datadog-plugin-avsc/src/index.js +2 -0
- package/packages/datadog-plugin-avsc/src/schema_iterator.js +2 -0
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/index.js +2 -0
- package/packages/datadog-plugin-child_process/src/index.js +30 -10
- package/packages/datadog-plugin-cypress/src/after-run.js +2 -0
- package/packages/datadog-plugin-cypress/src/after-spec.js +2 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +8 -3
- package/packages/datadog-plugin-cypress/src/index.js +2 -0
- package/packages/datadog-plugin-cypress/src/plugin.js +2 -0
- package/packages/datadog-plugin-cypress/src/support.js +4 -2
- package/packages/datadog-plugin-google-cloud-vertexai/src/utils.js +2 -0
- package/packages/datadog-plugin-graphql/src/utils.js +2 -0
- package/packages/datadog-plugin-hono/src/index.js +28 -0
- package/packages/datadog-plugin-jest/src/index.js +2 -0
- package/packages/datadog-plugin-jest/src/util.js +2 -0
- package/packages/datadog-plugin-kafkajs/src/batch-consumer.js +2 -0
- package/packages/datadog-plugin-langchain/src/tracing.js +36 -4
- package/packages/datadog-plugin-nyc/src/index.js +2 -0
- package/packages/datadog-plugin-oracledb/src/connection-parser.js +2 -0
- package/packages/datadog-plugin-protobufjs/src/index.js +2 -0
- package/packages/datadog-plugin-protobufjs/src/schema_iterator.js +2 -0
- package/packages/datadog-plugin-selenium/src/index.js +2 -0
- package/packages/datadog-plugin-vitest/src/index.js +2 -0
- package/packages/dd-trace/src/appsec/iast/iast-context.js +5 -1
- package/packages/dd-trace/src/appsec/iast/index.js +2 -0
- package/packages/dd-trace/src/appsec/iast/overhead-controller.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter-esm.mjs +0 -2
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +2 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-regex.js +2 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities.js +2 -0
- package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +3 -3
- package/packages/dd-trace/src/appsec/rasp/fs-plugin.js +18 -11
- package/packages/dd-trace/src/appsec/rasp/utils.js +1 -1
- package/packages/dd-trace/src/appsec/recommended.json +88 -2
- package/packages/dd-trace/src/appsec/reporter.js +7 -7
- package/packages/dd-trace/src/appsec/stack_trace.js +11 -11
- package/packages/dd-trace/src/appsec/telemetry/common.js +1 -1
- package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +2 -2
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +3 -3
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +2 -0
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +3 -1
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +2 -0
- package/packages/dd-trace/src/ci-visibility/log-submission/log-submission-plugin.js +2 -0
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +2 -0
- package/packages/dd-trace/src/ci-visibility/telemetry.js +2 -0
- package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +2 -0
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +7 -3
- package/packages/dd-trace/src/config.js +4 -0
- package/packages/dd-trace/src/config_stable.js +2 -0
- package/packages/dd-trace/src/datastreams/checkpointer.js +2 -0
- package/packages/dd-trace/src/datastreams/context.js +2 -0
- package/packages/dd-trace/src/datastreams/encoding.js +2 -0
- package/packages/dd-trace/src/datastreams/fnv.js +2 -0
- package/packages/dd-trace/src/datastreams/pathway.js +11 -9
- package/packages/dd-trace/src/datastreams/processor.js +8 -7
- package/packages/dd-trace/src/datastreams/schemas/schema.js +2 -0
- package/packages/dd-trace/src/datastreams/schemas/schema_builder.js +45 -36
- package/packages/dd-trace/src/datastreams/schemas/schema_sampler.js +2 -0
- package/packages/dd-trace/src/datastreams/writer.js +2 -0
- package/packages/dd-trace/src/debugger/devtools_client/index.js +12 -4
- package/packages/dd-trace/src/debugger/devtools_client/inspector_promises_polyfill.js +2 -0
- package/packages/dd-trace/src/debugger/devtools_client/remote_config.js +8 -5
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/symbols.js +1 -1
- package/packages/dd-trace/src/debugger/index.js +36 -9
- package/packages/dd-trace/src/encode/tags-processors.js +2 -0
- package/packages/dd-trace/src/exporters/common/agent-info-exporter.js +2 -0
- package/packages/dd-trace/src/exporters/common/util.js +2 -0
- package/packages/dd-trace/src/exporters/span-stats/index.js +2 -0
- package/packages/dd-trace/src/exporters/span-stats/writer.js +2 -0
- package/packages/dd-trace/src/external-logger/src/index.js +2 -0
- package/packages/dd-trace/src/git_metadata_tagger.js +2 -0
- package/packages/dd-trace/src/git_properties.js +2 -0
- package/packages/dd-trace/src/guardrails/index.js +3 -4
- package/packages/dd-trace/src/guardrails/log.js +2 -2
- package/packages/dd-trace/src/guardrails/telemetry.js +16 -14
- package/packages/dd-trace/src/guardrails/util.js +0 -2
- package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +2 -0
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/index.js +5 -0
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/tool.js +15 -0
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/vectorstore.js +36 -0
- package/packages/dd-trace/src/llmobs/plugins/langchain/index.js +47 -4
- package/packages/dd-trace/src/llmobs/tagger.js +10 -1
- package/packages/dd-trace/src/noop/dogstatsd.js +2 -0
- package/packages/dd-trace/src/opentracing/propagation/text_map_dsm.js +2 -0
- package/packages/dd-trace/src/payload-tagging/config/index.js +2 -0
- package/packages/dd-trace/src/payload-tagging/index.js +2 -0
- package/packages/dd-trace/src/payload-tagging/tagging.js +2 -0
- package/packages/dd-trace/src/plugins/apollo.js +2 -0
- package/packages/dd-trace/src/plugins/ci_plugin.js +8 -3
- package/packages/dd-trace/src/plugins/index.js +1 -0
- package/packages/dd-trace/src/plugins/util/ci.js +2 -0
- package/packages/dd-trace/src/plugins/util/env.js +2 -0
- package/packages/dd-trace/src/plugins/util/git.js +40 -5
- package/packages/dd-trace/src/plugins/util/inferred_proxy.js +2 -0
- package/packages/dd-trace/src/plugins/util/llm.js +2 -0
- package/packages/dd-trace/src/plugins/util/serverless.js +2 -0
- package/packages/dd-trace/src/plugins/util/stacktrace.js +178 -50
- package/packages/dd-trace/src/plugins/util/tags.js +17 -1
- package/packages/dd-trace/src/plugins/util/test.js +9 -4
- package/packages/dd-trace/src/plugins/util/url.js +2 -0
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +2 -0
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +4 -0
- package/packages/dd-trace/src/profiling/profiler.js +89 -70
- package/packages/dd-trace/src/profiling/profilers/event_plugins/dns.js +2 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_lookup.js +2 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_lookupservice.js +2 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_resolve.js +2 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_reverse.js +2 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/event.js +2 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/fs.js +2 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/net.js +2 -0
- package/packages/dd-trace/src/profiling/profilers/events.js +2 -0
- package/packages/dd-trace/src/profiling/webspan-utils.js +2 -0
- package/packages/dd-trace/src/remote_config/capabilities.js +3 -1
- package/packages/dd-trace/src/remote_config/index.js +4 -0
- package/packages/dd-trace/src/service-naming/index.js +2 -0
- package/packages/dd-trace/src/service-naming/schemas/definition.js +2 -0
- package/packages/dd-trace/src/service-naming/schemas/util.js +2 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/graphql.js +2 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/index.js +2 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +2 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/serverless.js +2 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +2 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/web.js +2 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/graphql.js +2 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/index.js +2 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +2 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/serverless.js +2 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +2 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/web.js +2 -0
- package/packages/dd-trace/src/span_stats.js +2 -0
- package/packages/dd-trace/src/supported-configurations.json +2 -0
- package/packages/dd-trace/src/telemetry/send-data.js +2 -0
- package/register.js +4 -0
- package/version.js +0 -3
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
1
3
|
module.exports = `
|
|
2
4
|
version: 1
|
|
3
5
|
dc_module: dc-polyfill
|
|
@@ -51,4 +53,34 @@ instrumentations:
|
|
|
51
53
|
class: Embeddings
|
|
52
54
|
operator: traceSync
|
|
53
55
|
channel_name: "Embeddings_constructor"
|
|
56
|
+
- module_name: "@langchain/core"
|
|
57
|
+
version_range: ">=0.1.0"
|
|
58
|
+
file_path: dist/tools/index.js
|
|
59
|
+
function_query:
|
|
60
|
+
name: invoke
|
|
61
|
+
type: method
|
|
62
|
+
kind: async
|
|
63
|
+
class: StructuredTool
|
|
64
|
+
operator: tracePromise
|
|
65
|
+
channel_name: "Tool_invoke"
|
|
66
|
+
- module_name: "@langchain/core"
|
|
67
|
+
version_range: ">=0.1.0"
|
|
68
|
+
file_path: dist/vectorstores.js
|
|
69
|
+
function_query:
|
|
70
|
+
name: similaritySearch
|
|
71
|
+
type: method
|
|
72
|
+
kind: async
|
|
73
|
+
class: VectorStore
|
|
74
|
+
operator: tracePromise
|
|
75
|
+
channel_name: "VectorStore_similaritySearch"
|
|
76
|
+
- module_name: "@langchain/core"
|
|
77
|
+
version_range: ">=0.1.0"
|
|
78
|
+
file_path: dist/vectorstores.js
|
|
79
|
+
function_query:
|
|
80
|
+
name: similaritySearchWithScore
|
|
81
|
+
type: method
|
|
82
|
+
kind: async
|
|
83
|
+
class: VectorStore
|
|
84
|
+
operator: tracePromise
|
|
85
|
+
channel_name: "VectorStore_similaritySearchWithScore"
|
|
54
86
|
`
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
1
3
|
const satisfies = require('semifies')
|
|
2
4
|
|
|
3
5
|
const { addHook, channel } = require('./helpers/instrument')
|
|
@@ -335,7 +337,9 @@ function testEndHandler (test, annotations, testStatus, error, isTimeout, isMain
|
|
|
335
337
|
testStatuses.push(testStatus)
|
|
336
338
|
}
|
|
337
339
|
|
|
338
|
-
|
|
340
|
+
const testProperties = getTestProperties(test)
|
|
341
|
+
|
|
342
|
+
if (testStatuses.length === testManagementAttemptToFixRetries + 1 && testProperties.attemptToFix) {
|
|
339
343
|
if (testStatuses.includes('fail')) {
|
|
340
344
|
test._ddHasFailedAttemptToFixRetries = true
|
|
341
345
|
}
|
|
@@ -35,7 +35,9 @@ class ChildProcessPlugin extends TracingPlugin {
|
|
|
35
35
|
return this._tracer
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
start (
|
|
38
|
+
start (ctx) {
|
|
39
|
+
const { command, shell } = ctx
|
|
40
|
+
|
|
39
41
|
if (typeof command !== 'string') {
|
|
40
42
|
return
|
|
41
43
|
}
|
|
@@ -58,10 +60,13 @@ class ChildProcessPlugin extends TracingPlugin {
|
|
|
58
60
|
resource: (shell === true) ? 'sh' : cmdFields[0],
|
|
59
61
|
type: 'system',
|
|
60
62
|
meta
|
|
61
|
-
})
|
|
63
|
+
}, ctx)
|
|
64
|
+
|
|
65
|
+
return ctx.currentStore
|
|
62
66
|
}
|
|
63
67
|
|
|
64
|
-
end (
|
|
68
|
+
end (ctx) {
|
|
69
|
+
const { result, error } = ctx
|
|
65
70
|
let exitCode
|
|
66
71
|
|
|
67
72
|
if (result !== undefined) {
|
|
@@ -74,17 +79,32 @@ class ChildProcessPlugin extends TracingPlugin {
|
|
|
74
79
|
exitCode = error?.status || error?.code || 0
|
|
75
80
|
}
|
|
76
81
|
|
|
77
|
-
this.activeSpan
|
|
78
|
-
|
|
82
|
+
const span = ctx.currentStore?.span || this.activeSpan
|
|
83
|
+
|
|
84
|
+
span?.setTag('cmd.exit_code', `${exitCode}`)
|
|
85
|
+
span?.finish()
|
|
86
|
+
|
|
87
|
+
return ctx.parentStore
|
|
79
88
|
}
|
|
80
89
|
|
|
81
|
-
error (
|
|
82
|
-
|
|
90
|
+
error (ctx) {
|
|
91
|
+
const { error } = ctx
|
|
92
|
+
|
|
93
|
+
const span = ctx.currentStore?.span || this.activeSpan
|
|
94
|
+
this.addError(error, span)
|
|
95
|
+
|
|
96
|
+
return ctx.parentStore
|
|
83
97
|
}
|
|
84
98
|
|
|
85
|
-
asyncEnd (
|
|
86
|
-
|
|
87
|
-
|
|
99
|
+
asyncEnd (ctx) {
|
|
100
|
+
const { result } = ctx
|
|
101
|
+
|
|
102
|
+
const span = ctx.currentStore?.span || this.activeSpan
|
|
103
|
+
|
|
104
|
+
span?.setTag('cmd.exit_code', `${result}`)
|
|
105
|
+
span?.finish()
|
|
106
|
+
|
|
107
|
+
return ctx.parentStore
|
|
88
108
|
}
|
|
89
109
|
}
|
|
90
110
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
1
3
|
const {
|
|
2
4
|
TEST_STATUS,
|
|
3
5
|
TEST_IS_RUM_ACTIVE,
|
|
@@ -76,7 +78,8 @@ const {
|
|
|
76
78
|
GIT_TAG,
|
|
77
79
|
GIT_PULL_REQUEST_BASE_BRANCH_SHA,
|
|
78
80
|
GIT_COMMIT_HEAD_SHA,
|
|
79
|
-
GIT_PULL_REQUEST_BASE_BRANCH
|
|
81
|
+
GIT_PULL_REQUEST_BASE_BRANCH,
|
|
82
|
+
GIT_COMMIT_HEAD_MESSAGE
|
|
80
83
|
} = require('../../dd-trace/src/plugins/util/tags')
|
|
81
84
|
const {
|
|
82
85
|
OS_VERSION,
|
|
@@ -238,7 +241,8 @@ class CypressPlugin {
|
|
|
238
241
|
[GIT_COMMIT_MESSAGE]: commitMessage,
|
|
239
242
|
[GIT_TAG]: tag,
|
|
240
243
|
[GIT_PULL_REQUEST_BASE_BRANCH_SHA]: pullRequestBaseSha,
|
|
241
|
-
[GIT_COMMIT_HEAD_SHA]: commitHeadSha
|
|
244
|
+
[GIT_COMMIT_HEAD_SHA]: commitHeadSha,
|
|
245
|
+
[GIT_COMMIT_HEAD_MESSAGE]: commitHeadMessage
|
|
242
246
|
} = this.testEnvironmentMetadata
|
|
243
247
|
|
|
244
248
|
this.repositoryRoot = repositoryRoot || process.cwd()
|
|
@@ -258,7 +262,8 @@ class CypressPlugin {
|
|
|
258
262
|
commitMessage,
|
|
259
263
|
tag,
|
|
260
264
|
pullRequestBaseSha,
|
|
261
|
-
commitHeadSha
|
|
265
|
+
commitHeadSha,
|
|
266
|
+
commitHeadMessage
|
|
262
267
|
}
|
|
263
268
|
this.finishedTestsByFile = {}
|
|
264
269
|
this.testStatuses = {}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
1
3
|
let isEarlyFlakeDetectionEnabled = false
|
|
2
4
|
let isKnownTestsEnabled = false
|
|
3
5
|
let knownTestsForSuite = []
|
|
@@ -28,8 +30,8 @@ function isNewTest (test) {
|
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
function getTestProperties (testName) {
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
+
// TODO: Use optional chaining when we drop support for older Cypress versions, which will happen when dd-trace@5 is
|
|
34
|
+
// EoL. Until then, this files needs to support Node.js 16.
|
|
33
35
|
const properties = testManagementTests[testName] && testManagementTests[testName].properties || {}
|
|
34
36
|
|
|
35
37
|
const { attempt_to_fix: isAttemptToFix, disabled: isDisabled, quarantined: isQuarantined } = properties
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const RouterPlugin = require('../../datadog-plugin-router/src')
|
|
4
|
+
const web = require('../../dd-trace/src/plugins/util/web')
|
|
5
|
+
|
|
6
|
+
class HonoPlugin extends RouterPlugin {
|
|
7
|
+
static get id () {
|
|
8
|
+
return 'hono'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
constructor (...args) {
|
|
12
|
+
super(...args)
|
|
13
|
+
|
|
14
|
+
this.addSub('apm:hono:request:handle', ({ req }) => {
|
|
15
|
+
this.setFramework(req, 'hono', this.config)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
this.addSub('apm:hono:request:route', ({ req, route }) => {
|
|
19
|
+
web.setRoute(req, route)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
this.addSub('apm:hono:request:error', ({ req, error }) => {
|
|
23
|
+
web.addError(req, error)
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = HonoPlugin
|
|
@@ -40,9 +40,14 @@ class BaseLangChainTracingPlugin extends TracingPlugin {
|
|
|
40
40
|
|
|
41
41
|
// Runnable interfaces have an `lc_namespace` property
|
|
42
42
|
const ns = ctx.self.lc_namespace || ctx.namespace
|
|
43
|
-
const resource = ctx.resource = [...ns, ctx.self.constructor.name].join('.')
|
|
44
43
|
|
|
45
|
-
const
|
|
44
|
+
const resourceParts = [...ns, ctx.self.constructor.name]
|
|
45
|
+
if (type === 'tool') {
|
|
46
|
+
resourceParts.push(ctx.instance.name)
|
|
47
|
+
}
|
|
48
|
+
const resource = ctx.resource = resourceParts.join('.')
|
|
49
|
+
|
|
50
|
+
const handler = this.handlers[type] || this.handlers.default
|
|
46
51
|
|
|
47
52
|
const instance = ctx.instance
|
|
48
53
|
const apiKey = handler.extractApiKey(instance)
|
|
@@ -78,7 +83,7 @@ class BaseLangChainTracingPlugin extends TracingPlugin {
|
|
|
78
83
|
|
|
79
84
|
const { type } = ctx
|
|
80
85
|
|
|
81
|
-
const handler = this.handlers[type]
|
|
86
|
+
const handler = this.handlers[type] || this.handlers.default
|
|
82
87
|
const tags = handler.getSpanEndTags(ctx, span) || {}
|
|
83
88
|
|
|
84
89
|
span.addTags(tags)
|
|
@@ -139,11 +144,38 @@ class EmbeddingsEmbedDocumentsPlugin extends BaseLangChainTracingPlugin {
|
|
|
139
144
|
}
|
|
140
145
|
}
|
|
141
146
|
|
|
147
|
+
class ToolInvokePlugin extends BaseLangChainTracingPlugin {
|
|
148
|
+
static get id () { return 'langchain_tool_invoke' }
|
|
149
|
+
static get lcType () { return 'tool' }
|
|
150
|
+
static get prefix () {
|
|
151
|
+
return 'tracing:orchestrion:@langchain/core:Tool_invoke'
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
class VectorStoreSimilaritySearchPlugin extends BaseLangChainTracingPlugin {
|
|
156
|
+
static get id () { return 'langchain_vectorstore_similarity_search' }
|
|
157
|
+
static get lcType () { return 'similarity_search' }
|
|
158
|
+
static get prefix () {
|
|
159
|
+
return 'tracing:orchestrion:@langchain/core:VectorStore_similaritySearch'
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
class VectorStoreSimilaritySearchWithScorePlugin extends BaseLangChainTracingPlugin {
|
|
164
|
+
static get id () { return 'langchain_vectorstore_similarity_search_with_score' }
|
|
165
|
+
static get lcType () { return 'similarity_search' }
|
|
166
|
+
static get prefix () {
|
|
167
|
+
return 'tracing:orchestrion:@langchain/core:VectorStore_similaritySearchWithScore'
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
142
171
|
module.exports = [
|
|
143
172
|
RunnableSequenceInvokePlugin,
|
|
144
173
|
RunnableSequenceBatchPlugin,
|
|
145
174
|
BaseChatModelGeneratePlugin,
|
|
146
175
|
BaseLLMGeneratePlugin,
|
|
147
176
|
EmbeddingsEmbedQueryPlugin,
|
|
148
|
-
EmbeddingsEmbedDocumentsPlugin
|
|
177
|
+
EmbeddingsEmbedDocumentsPlugin,
|
|
178
|
+
ToolInvokePlugin,
|
|
179
|
+
VectorStoreSimilaritySearchPlugin,
|
|
180
|
+
VectorStoreSimilaritySearchWithScorePlugin
|
|
149
181
|
]
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
1
3
|
const IAST_CONTEXT_KEY = Symbol('_dd.iast.context')
|
|
2
4
|
const IAST_TRANSACTION_ID = Symbol('_dd.iast.transactionId')
|
|
3
5
|
|
|
@@ -52,7 +54,9 @@ function cleanIastContext (store, context, iastContext) {
|
|
|
52
54
|
context[IAST_CONTEXT_KEY] = null
|
|
53
55
|
}
|
|
54
56
|
if (iastContext) {
|
|
55
|
-
|
|
57
|
+
if (typeof iastContext === 'object') { // eslint-disable-line eslint-rules/eslint-safe-typeof-object
|
|
58
|
+
Object.keys(iastContext).forEach(key => delete iastContext[key])
|
|
59
|
+
}
|
|
56
60
|
return true
|
|
57
61
|
}
|
|
58
62
|
return false
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
1
3
|
// eslint-disable-next-line @stylistic/max-len
|
|
2
4
|
const DEFAULT_IAST_REDACTION_NAME_PATTERN = '(?: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)?|(?:sur|last)name|user(?:name)?|address|e?mail)'
|
|
3
5
|
// eslint-disable-next-line @stylistic/max-len
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const { LRUCache } = require('lru-cache')
|
|
4
4
|
const vulnerabilitiesFormatter = require('./vulnerabilities-formatter')
|
|
5
5
|
const { IAST_ENABLED_TAG_KEY, IAST_JSON_TAG_KEY } = require('./tags')
|
|
6
6
|
const { keepTrace } = require('../../priority_sampler')
|
|
@@ -10,7 +10,7 @@ const { ASM } = require('../../standalone/product')
|
|
|
10
10
|
|
|
11
11
|
const VULNERABILITIES_KEY = 'vulnerabilities'
|
|
12
12
|
const VULNERABILITY_HASHES_MAX_SIZE = 1000
|
|
13
|
-
const VULNERABILITY_HASHES = new
|
|
13
|
+
const VULNERABILITY_HASHES = new LRUCache({ max: VULNERABILITY_HASHES_MAX_SIZE })
|
|
14
14
|
const RESET_VULNERABILITY_CACHE_INTERVAL = 60 * 60 * 1000 // 1 hour
|
|
15
15
|
|
|
16
16
|
let tracer
|
|
@@ -114,7 +114,7 @@ function isDuplicatedVulnerability (vulnerability) {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
function getVulnerabilityCallSiteFrames () {
|
|
117
|
-
return getCallsiteFrames(stackTraceMaxDepth)
|
|
117
|
+
return getCallsiteFrames(stackTraceMaxDepth, getVulnerabilityCallSiteFrames)
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
function replaceCallSiteFromSourceMap (callsite) {
|
|
@@ -14,25 +14,31 @@ const enabledFor = {
|
|
|
14
14
|
|
|
15
15
|
let fsPlugin
|
|
16
16
|
|
|
17
|
-
function
|
|
17
|
+
function getStoreToStart (fsProps, store = storage('legacy').getStore()) {
|
|
18
18
|
if (store && !store.fs?.opExcluded) {
|
|
19
|
-
|
|
19
|
+
return {
|
|
20
20
|
...store,
|
|
21
21
|
fs: {
|
|
22
22
|
...store.fs,
|
|
23
23
|
...fsProps,
|
|
24
24
|
parentStore: store
|
|
25
25
|
}
|
|
26
|
-
}
|
|
26
|
+
}
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
return store
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
class AppsecFsPlugin extends Plugin {
|
|
31
33
|
enable () {
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
34
|
+
this.addBind('apm:fs:operation:start', this._onFsOperationStart)
|
|
35
|
+
this.addBind('apm:fs:operation:finish', this._onFsOperationFinishOrRenderEnd)
|
|
36
|
+
this.addBind('tracing:datadog:express:response:render:start', this._onResponseRenderStart)
|
|
37
|
+
this.addBind('tracing:datadog:express:response:render:end', this._onFsOperationFinishOrRenderEnd)
|
|
38
|
+
// TODO Remove this when dc-polyfill is fixed&updated
|
|
39
|
+
// hack to node 18 and early 20.x
|
|
40
|
+
// with dc-polyfill addBind is not enough to force a channel.hasSubscribers === true
|
|
41
|
+
this.addSub('tracing:datadog:express:response:render:start', () => {})
|
|
36
42
|
|
|
37
43
|
super.configure(true)
|
|
38
44
|
}
|
|
@@ -44,19 +50,20 @@ class AppsecFsPlugin extends Plugin {
|
|
|
44
50
|
_onFsOperationStart () {
|
|
45
51
|
const store = storage('legacy').getStore()
|
|
46
52
|
if (store) {
|
|
47
|
-
|
|
53
|
+
return getStoreToStart({ root: store.fs?.root === undefined }, store)
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
56
|
|
|
51
57
|
_onResponseRenderStart () {
|
|
52
|
-
|
|
58
|
+
return getStoreToStart({ opExcluded: true })
|
|
53
59
|
}
|
|
54
60
|
|
|
55
61
|
_onFsOperationFinishOrRenderEnd () {
|
|
56
62
|
const store = storage('legacy').getStore()
|
|
57
|
-
if (store?.fs
|
|
58
|
-
|
|
63
|
+
if (store?.fs) {
|
|
64
|
+
return store.fs.parentStore
|
|
59
65
|
}
|
|
66
|
+
return store
|
|
60
67
|
}
|
|
61
68
|
}
|
|
62
69
|
|
|
@@ -41,7 +41,7 @@ function handleResult (result, req, res, abortController, config, raspRule) {
|
|
|
41
41
|
const ruleTriggered = !!result?.events?.length
|
|
42
42
|
|
|
43
43
|
if (generateStackTraceAction && enabled && canReportStackTrace(rootSpan, maxStackTraces)) {
|
|
44
|
-
const frames = getCallsiteFrames(maxDepth)
|
|
44
|
+
const frames = getCallsiteFrames(maxDepth, handleResult)
|
|
45
45
|
|
|
46
46
|
reportStackTrace(
|
|
47
47
|
rootSpan,
|