dd-trace 6.25.0 → 6.27.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/README.md +3 -0
- package/ci/cypress/support.js +2 -1
- package/ci/vitest-no-worker-init-node-setup.mjs +2 -1
- package/ci/vitest-no-worker-init-runner-setup.mjs +2 -1
- package/ci/vitest-no-worker-init-setup.mjs +729 -724
- package/ci/vitest-no-worker-init-v5-setup.mjs +2 -1
- package/index.d.ts +58 -1
- package/initialize.mjs +5 -3
- package/package.json +36 -32
- package/packages/datadog-esbuild/index.js +8 -15
- package/packages/datadog-esbuild/src/log.js +2 -29
- package/packages/datadog-instrumentations/src/ai.js +88 -122
- package/packages/datadog-instrumentations/src/aws-lambda.js +9 -0
- package/packages/datadog-instrumentations/src/cypress-config.js +20 -9
- package/packages/datadog-instrumentations/src/helpers/bundler-esm-exports.js +23 -1
- package/packages/datadog-instrumentations/src/helpers/bundler-log.js +38 -0
- package/packages/datadog-instrumentations/src/helpers/bundler-transform.js +9 -6
- package/packages/datadog-instrumentations/src/helpers/fetch.js +51 -6
- package/packages/datadog-instrumentations/src/helpers/hooks.js +0 -1
- package/packages/datadog-instrumentations/src/helpers/instrument.js +1 -3
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +6 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +12 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/ai.js +2 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql-jit.js +5 -3
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/modelcontextprotocol-client.js +30 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/modelcontextprotocol-server.js +23 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/next.js +21 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/postgres.js +33 -4
- package/packages/datadog-instrumentations/src/helpers/rewriter/target-patterns.json +30 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +6 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms/postgres.js +122 -0
- package/packages/datadog-instrumentations/src/microgateway-core.js +1 -2
- package/packages/datadog-instrumentations/src/modelcontextprotocol-client.js +21 -0
- package/packages/datadog-instrumentations/src/modelcontextprotocol-sdk.js +32 -2
- package/packages/datadog-instrumentations/src/modelcontextprotocol-server.js +43 -0
- package/packages/datadog-instrumentations/src/next.js +184 -20
- package/packages/datadog-instrumentations/src/path-to-regexp.js +11 -11
- package/packages/datadog-instrumentations/src/router.js +52 -13
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +1 -1
- package/packages/datadog-instrumentations/src/vitest-main.js +10 -2
- package/packages/datadog-plugin-aws-lambda/src/arn.js +41 -0
- package/packages/datadog-plugin-aws-lambda/src/context/events.js +167 -0
- package/packages/datadog-plugin-aws-lambda/src/context/extractor.js +153 -0
- package/packages/datadog-plugin-aws-lambda/src/context/http.js +50 -0
- package/packages/datadog-plugin-aws-lambda/src/context/span-context.js +26 -0
- package/packages/datadog-plugin-aws-lambda/src/context/step-functions.js +142 -0
- package/packages/datadog-plugin-aws-lambda/src/context/types.d.ts +17 -0
- package/packages/datadog-plugin-aws-lambda/src/context/xray.js +67 -0
- package/packages/datadog-plugin-aws-lambda/src/event-type-guards.js +170 -0
- package/packages/datadog-plugin-aws-lambda/src/index.js +52 -4
- package/packages/datadog-plugin-aws-lambda/src/trigger.js +339 -0
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +7 -0
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +32 -10
- package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +10 -1
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +4 -0
- package/packages/datadog-plugin-aws-sdk/src/services/stepfunctions.js +3 -0
- package/packages/datadog-plugin-azure-functions/src/index.js +68 -12
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +30 -4
- package/packages/datadog-plugin-cypress/src/support.mjs +1353 -0
- package/packages/datadog-plugin-express/src/code_origin.js +2 -2
- package/packages/datadog-plugin-fastify/src/code_origin.js +2 -2
- package/packages/datadog-plugin-fetch/src/index.js +7 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +10 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +2 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +7 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/resource-names.js +24 -0
- package/packages/datadog-plugin-graphql/src/tools/transforms.js +1 -0
- package/packages/datadog-plugin-http/src/client.js +14 -1
- package/packages/datadog-plugin-http/src/server.js +18 -4
- package/packages/datadog-plugin-http2/src/client.js +2 -1
- package/packages/datadog-plugin-modelcontextprotocol-sdk/src/tracing.js +28 -2
- package/packages/datadog-plugin-modelcontextprotocol-sdk/src/utils.js +1 -0
- package/packages/datadog-plugin-mongodb-core/src/query.js +17 -1
- package/packages/datadog-plugin-postgres/src/index.js +118 -41
- package/packages/datadog-plugin-supabase/src/supabase-auth-js-gotrueclient-getuser.js +18 -8
- package/packages/datadog-plugin-supabase/src/supabase-functions-js-functionsclient-invoke.js +49 -13
- package/packages/datadog-plugin-supabase/src/supabase-storage-js-handle-request.js +34 -9
- package/packages/datadog-plugin-vitest/src/index.js +3 -2
- package/packages/datadog-plugin-ws/src/close.js +3 -5
- package/packages/datadog-plugin-ws/src/producer.js +1 -4
- package/packages/datadog-plugin-ws/src/receiver.js +3 -5
- package/packages/datadog-plugin-ws/src/server.js +44 -13
- package/packages/datadog-vite/index.js +537 -0
- package/packages/datadog-vite/src/log.js +5 -0
- package/packages/datadog-webpack/src/log.js +2 -29
- package/packages/dd-trace/src/aiguard/client.js +7 -9
- package/packages/dd-trace/src/aiguard/evaluation.js +7 -2
- package/packages/dd-trace/src/aiguard/index.js +1 -1
- package/packages/dd-trace/src/aiguard/integrations/index.js +6 -5
- package/packages/dd-trace/src/aiguard/messages/utils.js +2 -2
- package/packages/dd-trace/src/aiguard/sdk.js +7 -2
- package/packages/dd-trace/src/appsec/api_security/normalized-route.js +273 -167
- package/packages/dd-trace/src/appsec/blocking/index.js +17 -1
- package/packages/dd-trace/src/appsec/channels.js +8 -0
- package/packages/dd-trace/src/appsec/downstream_requests.js +105 -0
- package/packages/dd-trace/src/appsec/graphql.js +10 -13
- package/packages/dd-trace/src/appsec/handlers/auth.js +1 -3
- package/packages/dd-trace/src/appsec/handlers/http-request.js +60 -65
- package/packages/dd-trace/src/appsec/handlers/http-response.js +61 -7
- package/packages/dd-trace/src/appsec/handlers/payments.js +23 -27
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +21 -14
- package/packages/dd-trace/src/appsec/index.js +9 -0
- package/packages/dd-trace/src/appsec/lambda.js +17 -17
- package/packages/dd-trace/src/appsec/rasp/command_injection.js +4 -4
- package/packages/dd-trace/src/appsec/rasp/index.js +64 -3
- package/packages/dd-trace/src/appsec/rasp/lfi.js +2 -2
- package/packages/dd-trace/src/appsec/rasp/sql_injection.js +7 -17
- package/packages/dd-trace/src/appsec/rasp/ssrf.js +80 -16
- package/packages/dd-trace/src/appsec/rasp/utils.js +47 -3
- package/packages/dd-trace/src/appsec/recommended.json +70 -3
- package/packages/dd-trace/src/appsec/reporter.js +9 -0
- package/packages/dd-trace/src/appsec/sdk/set_user.js +3 -3
- package/packages/dd-trace/src/appsec/sdk/track_event.js +4 -4
- package/packages/dd-trace/src/appsec/sdk/user_blocking.js +1 -1
- package/packages/dd-trace/src/appsec/user_tracking.js +6 -8
- package/packages/dd-trace/src/appsec/waf/index.js +65 -6
- package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +33 -38
- package/packages/dd-trace/src/appsec/waf/waf_manager.js +18 -2
- package/packages/dd-trace/src/carrier.js +7 -1
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +4 -2
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +31 -19
- package/packages/dd-trace/src/config/generated-config-types.d.ts +14 -5
- package/packages/dd-trace/src/config/index.js +73 -27
- package/packages/dd-trace/src/config/parsers.js +60 -0
- package/packages/dd-trace/src/config/remote-config-layers.js +38 -0
- package/packages/dd-trace/src/config/remote_config.js +2 -1
- package/packages/dd-trace/src/config/supported-configurations.json +41 -13
- package/packages/dd-trace/src/datastreams/fnv.js +27 -0
- package/packages/dd-trace/src/datastreams/http.js +57 -0
- package/packages/dd-trace/src/datastreams/index.js +24 -0
- package/packages/dd-trace/src/datastreams/pathway.js +142 -28
- package/packages/dd-trace/src/datastreams/processor.js +27 -7
- package/packages/dd-trace/src/debugger/config.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/request-options.js +7 -9
- package/packages/dd-trace/src/debugger/devtools_client/send.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/state.js +3 -1
- package/packages/dd-trace/src/debugger/devtools_client/tags.js +1 -1
- package/packages/dd-trace/src/debugger/index.js +2 -2
- package/packages/dd-trace/src/debugger/inspect-segment.js +3 -2
- package/packages/dd-trace/src/debugger/pause-duration-histogram.js +4 -1
- package/packages/dd-trace/src/debugger/probe_sampler.js +39 -17
- package/packages/dd-trace/src/debugger/unsupported-runtime.js +2 -0
- package/packages/dd-trace/src/git_metadata.js +2 -1
- package/packages/dd-trace/src/index.js +6 -3
- package/packages/dd-trace/src/lambda/facade.js +6 -5
- package/packages/dd-trace/src/lambda/handler-paths.js +1 -1
- package/packages/dd-trace/src/llmobs/constants/tags.js +1 -0
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/index.js +86 -3
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/utils.js +182 -1
- package/packages/dd-trace/src/llmobs/span_processor.js +3 -0
- package/packages/dd-trace/src/llmobs/tagger.js +9 -0
- package/packages/dd-trace/src/noop/span.js +0 -4
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +3 -0
- package/packages/dd-trace/src/openfeature/configuration_source.js +20 -0
- package/packages/dd-trace/src/openfeature/flagging_provider.js +17 -0
- package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +2 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_transformer.js +2 -1
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +16 -1
- package/packages/dd-trace/src/opentelemetry/trace/index.js +5 -4
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +10 -6
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +42 -26
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +4 -4
- package/packages/dd-trace/src/plugin_manager.js +2 -0
- package/packages/dd-trace/src/plugins/ci_plugin.js +104 -9
- package/packages/dd-trace/src/plugins/index.js +2 -0
- package/packages/dd-trace/src/plugins/util/ci.js +34 -0
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +9 -14
- package/packages/dd-trace/src/plugins/util/inferred_proxy.js +3 -5
- package/packages/dd-trace/src/plugins/util/test.js +28 -1
- package/packages/dd-trace/src/plugins/util/url.js +9 -6
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +4 -4
- package/packages/dd-trace/src/process-tags/index.js +1 -1
- package/packages/dd-trace/src/profiler.js +74 -12
- package/packages/dd-trace/src/profiling/profiler.js +30 -2
- package/packages/dd-trace/src/profiling/profilers/space.js +3 -1
- package/packages/dd-trace/src/profiling/profilers/wall.js +4 -4
- package/packages/dd-trace/src/profiling/remote-config.js +354 -0
- package/packages/dd-trace/src/profiling/runtime-capabilities.js +11 -0
- package/packages/dd-trace/src/propagation-hash/index.js +7 -0
- package/packages/dd-trace/src/proxy.js +13 -1
- package/packages/dd-trace/src/register-loader.js +43 -0
- package/register.js +10 -44
- package/register.mjs +27 -0
- package/vendor/dist/@opentelemetry/core/LICENSE +11 -0
- package/vendor/dist/@opentelemetry/core/index.js +1 -1
- package/vite.d.ts +7 -0
- package/vite.js +3 -0
- package/lambda.d.ts +0 -39
- package/lambda.js +0 -3
- package/packages/datadog-plugin-cypress/src/support.js +0 -1348
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
const crypto = require('crypto')
|
|
3
|
+
// Pathway hashes must equal dd-trace-java's for the same checkpoint, so a pathway that crosses
|
|
4
|
+
// tracers resolves to one set of nodes. The rules below mirror dd-trace-java's BaseHash and
|
|
5
|
+
// DataStreamsTags (node hash) and DefaultPathwayContext#generatePathwayHash (pathway hash).
|
|
7
6
|
const { LRUCache } = require('../../../../vendor/dist/lru-cache')
|
|
8
7
|
const {
|
|
9
8
|
hasDsmBase64,
|
|
@@ -15,8 +14,45 @@ const {
|
|
|
15
14
|
} = require('../carrier')
|
|
16
15
|
const log = require('../log')
|
|
17
16
|
const { encodeVarintInto, decodeVarint } = require('./encoding')
|
|
17
|
+
const { writeFnv64LE } = require('./fnv')
|
|
18
18
|
|
|
19
19
|
const cache = new LRUCache({ max: 500 })
|
|
20
|
+
const seeds = new LRUCache({ max: 100 })
|
|
21
|
+
let nextSeedId = 0
|
|
22
|
+
/** @type {{ id: number, state: Buffer } | undefined} */
|
|
23
|
+
let lastSeed
|
|
24
|
+
/** @type {unknown[]} */
|
|
25
|
+
let lastSeedInputs = []
|
|
26
|
+
|
|
27
|
+
// dd-trace-java hashes these tag keys in this order, not alphabetically. Keys it does not know are
|
|
28
|
+
// hashed after them, alphabetically.
|
|
29
|
+
const HASHED_TAG_RANK = new Map([
|
|
30
|
+
['bus', 0],
|
|
31
|
+
['direction', 1],
|
|
32
|
+
['exchange', 2],
|
|
33
|
+
['topic', 3],
|
|
34
|
+
['type', 4],
|
|
35
|
+
['subscription', 5],
|
|
36
|
+
['kafka_cluster_id', 6],
|
|
37
|
+
])
|
|
38
|
+
const UNKNOWN_TAG_RANK = HASHED_TAG_RANK.size
|
|
39
|
+
|
|
40
|
+
// dd-trace-java reports these tags but keeps them out of the pathway hash.
|
|
41
|
+
const UNHASHED_TAG_KEYS = new Set([
|
|
42
|
+
'ds.name',
|
|
43
|
+
'ds.namespace',
|
|
44
|
+
'manual_checkpoint',
|
|
45
|
+
'group',
|
|
46
|
+
'consumer_group',
|
|
47
|
+
'partition',
|
|
48
|
+
'has_routing_key',
|
|
49
|
+
])
|
|
50
|
+
|
|
51
|
+
// dd-trace-java aggregates stats per pathway hash and these tags (DataStreamsTags aggregation tags), so
|
|
52
|
+
// has_routing_key and partition variants of one pathway share a stats point.
|
|
53
|
+
const AGGREGATION_TAG_PREFIXES = ['ds.name:', 'ds.namespace:', 'manual_checkpoint:', 'group:', 'consumer_group:']
|
|
54
|
+
/** @type {WeakMap<Buffer, string>} */
|
|
55
|
+
const statsPointKeys = new WeakMap()
|
|
20
56
|
|
|
21
57
|
const PATHWAY_CONTEXT_BYTES = 20
|
|
22
58
|
|
|
@@ -24,47 +60,124 @@ const PATHWAY_CONTEXT_BYTES = 20
|
|
|
24
60
|
// `Buffer.from(...)` copy-out so callers never observe mutation between checkpoints.
|
|
25
61
|
const pathwayScratch = Buffer.allocUnsafe(PATHWAY_CONTEXT_BYTES)
|
|
26
62
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
63
|
+
/**
|
|
64
|
+
* @param {string} tag
|
|
65
|
+
*/
|
|
66
|
+
function tagKey (tag) {
|
|
67
|
+
const colon = tag.indexOf(':')
|
|
68
|
+
return colon === -1 ? tag : tag.slice(0, colon)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @param {string} tag
|
|
73
|
+
*/
|
|
74
|
+
function tagRank (tag) {
|
|
75
|
+
return HASHED_TAG_RANK.get(tagKey(tag)) ?? UNKNOWN_TAG_RANK
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @param {string[]} sortedEdgeTags
|
|
80
|
+
*/
|
|
81
|
+
function hashedEdgeTags (sortedEdgeTags) {
|
|
82
|
+
return sortedEdgeTags
|
|
83
|
+
.filter(tag => !UNHASHED_TAG_KEYS.has(tagKey(tag)))
|
|
84
|
+
.sort((a, b) => tagRank(a) - tagRank(b))
|
|
85
|
+
.join('')
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Like dd-trace-java's BaseHash, the FNV state over service, env, process tags and container tags
|
|
90
|
+
* hash is computed once per distinct value and continued for every checkpoint. `id` stands in for
|
|
91
|
+
* that value in the checkpoint cache key; ids are never reused, so an evicted seed cannot alias another.
|
|
92
|
+
*
|
|
93
|
+
* @param {string} service
|
|
94
|
+
* @param {string | undefined} env
|
|
95
|
+
* @param {string | undefined} processTags
|
|
96
|
+
* @param {string | null | undefined} containerTagsHash
|
|
97
|
+
* @returns {{ id: number, state: Buffer }}
|
|
98
|
+
*/
|
|
99
|
+
function nodeHashSeed (service, env, processTags, containerTagsHash) {
|
|
100
|
+
if (
|
|
101
|
+
lastSeed !== undefined &&
|
|
102
|
+
lastSeedInputs[0] === service &&
|
|
103
|
+
lastSeedInputs[1] === env &&
|
|
104
|
+
lastSeedInputs[2] === processTags &&
|
|
105
|
+
lastSeedInputs[3] === containerTagsHash
|
|
106
|
+
) {
|
|
107
|
+
return lastSeed
|
|
108
|
+
}
|
|
109
|
+
// dd-trace-java folds the container tags hash only when it folds process tags.
|
|
110
|
+
const prefix = processTags
|
|
111
|
+
? `${service}${env ?? ''}${processTags}${containerTagsHash || ''}`
|
|
112
|
+
: `${service}${env ?? ''}`
|
|
113
|
+
let seed = seeds.get(prefix)
|
|
114
|
+
if (seed === undefined) {
|
|
115
|
+
const state = Buffer.alloc(8)
|
|
116
|
+
writeFnv64LE(Buffer.from(prefix, 'utf8'), state, 0)
|
|
117
|
+
seed = { id: nextSeedId++, state }
|
|
118
|
+
seeds.set(prefix, seed)
|
|
119
|
+
}
|
|
120
|
+
lastSeedInputs = [service, env, processTags, containerTagsHash]
|
|
121
|
+
lastSeed = seed
|
|
122
|
+
return seed
|
|
30
123
|
}
|
|
31
124
|
|
|
32
125
|
/**
|
|
126
|
+
* Sorts `edgeTags` in place.
|
|
127
|
+
*
|
|
33
128
|
* @param {string} service
|
|
34
|
-
* @param {string} env
|
|
129
|
+
* @param {string | undefined} env
|
|
35
130
|
* @param {string[]} edgeTags
|
|
36
|
-
* @param {Buffer} parentHash
|
|
37
|
-
* @param {
|
|
131
|
+
* @param {Buffer} parentHash Parent pathway hash as uint64 little-endian.
|
|
132
|
+
* @param {string} [processTags] Serialized process tags; omitted when process tags are off.
|
|
133
|
+
* @param {string | null} [containerTagsHash] Container tags hash from the agent.
|
|
134
|
+
* @returns {Buffer} Pathway hash as uint64 little-endian.
|
|
38
135
|
*/
|
|
39
|
-
function computeHash (service, env, edgeTags, parentHash,
|
|
136
|
+
function computeHash (service, env, edgeTags, parentHash, processTags, containerTagsHash) {
|
|
40
137
|
edgeTags.sort()
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
: edgeTags
|
|
44
|
-
|
|
45
|
-
// The cache key includes parentHash so a fan-in node with different parents
|
|
46
|
-
// gets distinct cache entries; the hash input below excludes parentHash and
|
|
47
|
-
// gets combined with it via a second sha pass to produce the final hash.
|
|
48
|
-
const joinedEdgeTags = hashableEdgeTags.join('')
|
|
49
|
-
const propagationHex = propagationHashBigInt ? propagationHashBigInt.toString(16) : ''
|
|
50
|
-
const propagationPart = propagationHex ? `:${propagationHex}` : ''
|
|
51
|
-
const key = `${service}${env}${joinedEdgeTags}${parentHash}${propagationPart}`
|
|
138
|
+
const seed = nodeHashSeed(service, env, processTags, containerTagsHash)
|
|
139
|
+
const key = `${seed.id}\0${edgeTags.join('\0')}\0${parentHash.toString('hex')}`
|
|
52
140
|
|
|
53
141
|
let value = cache.get(key)
|
|
54
142
|
if (value) {
|
|
55
143
|
return value
|
|
56
144
|
}
|
|
57
145
|
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
value = shaHash(buf.toString())
|
|
146
|
+
const pathwayInput = Buffer.alloc(16)
|
|
147
|
+
writeFnv64LE(Buffer.from(hashedEdgeTags(edgeTags), 'utf8'), pathwayInput, 0, seed.state)
|
|
148
|
+
parentHash.copy(pathwayInput, 8)
|
|
149
|
+
value = Buffer.allocUnsafe(8)
|
|
150
|
+
writeFnv64LE(pathwayInput, value, 0)
|
|
64
151
|
cache.set(key, value)
|
|
65
152
|
return value
|
|
66
153
|
}
|
|
67
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Key of the stats point a checkpoint aggregates into, as dd-trace-java's aggregation hash.
|
|
157
|
+
*
|
|
158
|
+
* A hash Buffer from computeHash always stands for one tag set, because its cache key holds every tag, so the key
|
|
159
|
+
* is built once per Buffer.
|
|
160
|
+
*
|
|
161
|
+
* @param {Buffer} hash Pathway hash as uint64 little-endian.
|
|
162
|
+
* @param {string[]} edgeTags
|
|
163
|
+
*/
|
|
164
|
+
function statsPointKey (hash, edgeTags) {
|
|
165
|
+
let key = statsPointKeys.get(hash)
|
|
166
|
+
if (key !== undefined) return key
|
|
167
|
+
|
|
168
|
+
key = hash.toString('latin1')
|
|
169
|
+
for (const tag of edgeTags) {
|
|
170
|
+
for (const prefix of AGGREGATION_TAG_PREFIXES) {
|
|
171
|
+
if (tag.startsWith(prefix)) {
|
|
172
|
+
key += `\0${tag}`
|
|
173
|
+
break
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
statsPointKeys.set(hash, key)
|
|
178
|
+
return key
|
|
179
|
+
}
|
|
180
|
+
|
|
68
181
|
/**
|
|
69
182
|
* @param {object} dataStreamsContext
|
|
70
183
|
* @param {Buffer} dataStreamsContext.hash
|
|
@@ -189,4 +302,5 @@ module.exports = {
|
|
|
189
302
|
encodePathwayContextBase64,
|
|
190
303
|
decodePathwayContextBase64,
|
|
191
304
|
DsmPathwayCodec,
|
|
305
|
+
statsPointKey,
|
|
192
306
|
}
|
|
@@ -8,7 +8,8 @@ const { PATHWAY_HASH, DSM_TRANSACTION_ID, DSM_TRANSACTION_CHECKPOINT } = require
|
|
|
8
8
|
const log = require('../log')
|
|
9
9
|
const processTags = require('../process-tags')
|
|
10
10
|
const propagationHash = require('../propagation-hash')
|
|
11
|
-
const
|
|
11
|
+
const telemetryMetrics = require('../telemetry/metrics')
|
|
12
|
+
const { computePathwayHash, statsPointKey } = require('./pathway')
|
|
12
13
|
const { DataStreamsWriter } = require('./writer')
|
|
13
14
|
const { getAmqpMessageSize, getHeadersSize, getMessageSize, getSizeOrZero, PATHWAY_FIELD_BYTES } = require('./size')
|
|
14
15
|
const { SchemaBuilder } = require('./schemas/schema_builder')
|
|
@@ -16,6 +17,11 @@ const { SchemaSampler } = require('./schemas/schema_sampler')
|
|
|
16
17
|
|
|
17
18
|
const ENTRY_PARENT_HASH = Buffer.from('0000000000000000', 'hex')
|
|
18
19
|
|
|
20
|
+
// Parent hashes come from inbound headers, so without a bound a caller can grow a bucket without limit.
|
|
21
|
+
const MAX_CHECKPOINTS_PER_BUCKET = 2000
|
|
22
|
+
|
|
23
|
+
const tracerMetrics = telemetryMetrics.manager.namespace('tracers')
|
|
24
|
+
|
|
19
25
|
class StatsPoint {
|
|
20
26
|
constructor (hash, parentHash, edgeTags) {
|
|
21
27
|
this.hash = hash.readBigUInt64LE()
|
|
@@ -149,11 +155,20 @@ class StatsBucket {
|
|
|
149
155
|
return Buffer.concat(this._transactionChunks)
|
|
150
156
|
}
|
|
151
157
|
|
|
158
|
+
/**
|
|
159
|
+
* @param {object} checkpoint
|
|
160
|
+
* @param {Buffer} checkpoint.hash
|
|
161
|
+
* @param {Buffer} checkpoint.parentHash
|
|
162
|
+
* @param {string[]} checkpoint.edgeTags
|
|
163
|
+
* @returns {StatsPoint | undefined} `undefined` when the bucket already holds the maximum number of checkpoints.
|
|
164
|
+
*/
|
|
152
165
|
forCheckpoint ({ hash, parentHash, edgeTags }) {
|
|
153
|
-
|
|
166
|
+
const key = statsPointKey(hash, edgeTags)
|
|
167
|
+
let checkpoint = this._checkpoints.get(key)
|
|
154
168
|
if (!checkpoint) {
|
|
169
|
+
if (this._checkpoints.size >= MAX_CHECKPOINTS_PER_BUCKET) return
|
|
155
170
|
checkpoint = new StatsPoint(hash, parentHash, edgeTags)
|
|
156
|
-
this._checkpoints.set(
|
|
171
|
+
this._checkpoints.set(key, checkpoint)
|
|
157
172
|
}
|
|
158
173
|
|
|
159
174
|
return checkpoint
|
|
@@ -275,6 +290,10 @@ class DataStreamsProcessor {
|
|
|
275
290
|
recordCheckpoint (checkpoint, span = null) {
|
|
276
291
|
if (!this.enabled) return
|
|
277
292
|
const statsPoint = this.bucketFromTimestamp(checkpoint.currentTimestamp).forCheckpoint(checkpoint)
|
|
293
|
+
if (statsPoint === undefined) {
|
|
294
|
+
tracerMetrics.count('data_streams.checkpoints_dropped', ['reason:bucket_full']).inc()
|
|
295
|
+
return
|
|
296
|
+
}
|
|
278
297
|
statsPoint.addLatencies(checkpoint)
|
|
279
298
|
if (span) {
|
|
280
299
|
// StatsPoint already converted the 8-byte Buffer hash to a uint64 BigInt.
|
|
@@ -332,10 +351,11 @@ class DataStreamsProcessor {
|
|
|
332
351
|
)
|
|
333
352
|
}
|
|
334
353
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
354
|
+
const hash = propagationHash.isEnabled()
|
|
355
|
+
? computePathwayHash(
|
|
356
|
+
this.service, this.env, edgeTags, parentHash, processTags.serialized, propagationHash.getContainerTagsHash()
|
|
357
|
+
)
|
|
358
|
+
: computePathwayHash(this.service, this.env, edgeTags, parentHash)
|
|
339
359
|
const edgeLatencyNs = nowNs - edgeStartNs
|
|
340
360
|
const pathwayLatencyNs = nowNs - pathwayStartNs
|
|
341
361
|
const dataStreamsContext = {
|
|
@@ -27,7 +27,7 @@ module.exports = function getDebuggerConfig (config, inputPath) {
|
|
|
27
27
|
repositoryUrl,
|
|
28
28
|
runtimeId: config.tags['runtime-id'],
|
|
29
29
|
service: config.service,
|
|
30
|
-
url:
|
|
30
|
+
url: agentlessUrl === undefined ? config.url.toString() : agentlessUrl.origin,
|
|
31
31
|
version: config.version,
|
|
32
32
|
inputPath,
|
|
33
33
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @param {ReturnType<import('../config')
|
|
4
|
+
* @param {NonNullable<ReturnType<import('../config')>>} config - Debugger configuration
|
|
5
5
|
* @param {string} path - Request path
|
|
6
6
|
* @param {Record<string, string>} headers - Payload headers
|
|
7
7
|
* @returns {{
|
|
@@ -12,17 +12,15 @@
|
|
|
12
12
|
* }}
|
|
13
13
|
*/
|
|
14
14
|
module.exports = function getRequestOptions (config, path, headers) {
|
|
15
|
-
const options = {
|
|
16
|
-
method: 'POST',
|
|
17
|
-
url: config.url,
|
|
18
|
-
path,
|
|
19
|
-
headers,
|
|
20
|
-
}
|
|
21
|
-
|
|
22
15
|
if (config.agentless) {
|
|
23
16
|
if (config.apiKey !== undefined) headers['DD-API-KEY'] = config.apiKey
|
|
24
17
|
headers['DD-EVP-ORIGIN'] = 'agent-debugger'
|
|
25
18
|
}
|
|
26
19
|
|
|
27
|
-
return
|
|
20
|
+
return {
|
|
21
|
+
method: 'POST',
|
|
22
|
+
url: config.url,
|
|
23
|
+
path,
|
|
24
|
+
headers,
|
|
25
|
+
}
|
|
28
26
|
}
|
|
@@ -131,7 +131,7 @@ function onFlush (payload, done) {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
|
-
* @param {number} statusCode - The status code of the response
|
|
134
|
+
* @param {number | undefined} statusCode - The status code of the response, if one was received
|
|
135
135
|
* @param {string} payload - The payload to send
|
|
136
136
|
* @param {() => void} done - Releases the payload from the upload queue
|
|
137
137
|
*/
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { join, dirname } = require('path')
|
|
4
|
-
const { normalize } =
|
|
4
|
+
const { normalize } = /** @type {{ normalize: (path: string) => string }} */ (
|
|
5
|
+
require('../../../../../vendor/dist/source-map/lib/util')
|
|
6
|
+
)
|
|
5
7
|
const { loadSourceMapSync, getOriginalPosition } = require('./source-maps')
|
|
6
8
|
const session = require('./session')
|
|
7
9
|
const log = require('./log')
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const { GIT_COMMIT_SHA, GIT_REPOSITORY_URL } = require('../../plugins/util/tags')
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @param {ReturnType<import('../config')
|
|
6
|
+
* @param {NonNullable<ReturnType<import('../config')>>} config - Debugger configuration
|
|
7
7
|
* @param {string} hostname - Host name
|
|
8
8
|
* @param {string} debuggerVersion - Debugger version
|
|
9
9
|
* @param {typeof import('./log')} log - Debugger logger
|
|
@@ -231,7 +231,7 @@ function logWorkerError (error, reason = error.reason) {
|
|
|
231
231
|
* Sends the new configuration to the worker thread via the config channel.
|
|
232
232
|
* Does nothing if the worker is not started.
|
|
233
233
|
*
|
|
234
|
-
* @param {
|
|
234
|
+
* @param {Config} config - The updated tracer configuration object
|
|
235
235
|
*/
|
|
236
236
|
function configure (config) {
|
|
237
237
|
if (configChannel === null) return
|
|
@@ -339,7 +339,7 @@ function detectDebuggerEndpoint (config, cb) {
|
|
|
339
339
|
|
|
340
340
|
log.debug('[debugger] Detecting available debugger endpoints...')
|
|
341
341
|
|
|
342
|
-
fetchAgentInfo(config.url, (err, agentInfo) => {
|
|
342
|
+
fetchAgentInfo(/** @type {URL} */ (config.url), (err, agentInfo) => {
|
|
343
343
|
if (err) {
|
|
344
344
|
log.warn('[debugger] Failed to query agent %s endpoint, falling back to %s',
|
|
345
345
|
DEBUGGER_INPUT_V2,
|
|
@@ -8,13 +8,14 @@ const { REDACTED_PLACEHOLDER } = require('./redaction')
|
|
|
8
8
|
/** @typedef {NonNullable<ReturnType<typeof globalThis.Object.getOwnPropertyDescriptor>>} PropertyDescriptor */
|
|
9
9
|
/** @typedef {Map<unknown, unknown> | Set<unknown>} Collection */
|
|
10
10
|
/** @typedef {(name: string) => boolean} IsRedactedIdentifier */
|
|
11
|
+
/** @typedef {{ get: (this: Collection) => number }} SizeDescriptor */
|
|
11
12
|
|
|
12
13
|
const mapEntries = Map.prototype.entries
|
|
13
14
|
const mapKeys = Map.prototype.keys
|
|
14
15
|
const mapSet = Map.prototype.set
|
|
15
|
-
const mapSizeGetter = Object.getOwnPropertyDescriptor(Map.prototype, 'size').get
|
|
16
|
+
const mapSizeGetter = /** @type {SizeDescriptor} */ (Object.getOwnPropertyDescriptor(Map.prototype, 'size')).get
|
|
16
17
|
const setAdd = Set.prototype.add
|
|
17
|
-
const setSizeGetter = Object.getOwnPropertyDescriptor(Set.prototype, 'size').get
|
|
18
|
+
const setSizeGetter = /** @type {SizeDescriptor} */ (Object.getOwnPropertyDescriptor(Set.prototype, 'size')).get
|
|
18
19
|
const setValues = Set.prototype.values
|
|
19
20
|
const mapIteratorNext = Object.getPrototypeOf(mapEntries.call(new Map())).next
|
|
20
21
|
const setIteratorNext = Object.getPrototypeOf(setValues.call(new Set())).next
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/** @typedef {typeof import('../../../../vendor/node_modules/@datadog/sketches-js')} Sketches */
|
|
4
|
+
const { LogCollapsingLowestDenseDDSketch } = /** @type {Sketches} */ (
|
|
5
|
+
require('../../../../vendor/dist/@datadog/sketches-js')
|
|
6
|
+
)
|
|
4
7
|
const { TELEMETRY_DISTRIBUTION_RELATIVE_ACCURACY } = require('../constants')
|
|
5
8
|
|
|
6
9
|
/**
|
|
@@ -103,9 +103,14 @@ function installProbeSampler (guardrailMetrics, config) {
|
|
|
103
103
|
Atomics.store(sampledProbeIndexes, SAMPLED_PROBE_COUNT_INDEX, 0)
|
|
104
104
|
Atomics.store(sampledProbeIndexes, SAMPLED_PROBE_OVERFLOW_INDEX, 0)
|
|
105
105
|
|
|
106
|
-
const
|
|
106
|
+
const ONE_SECOND_NS = 1_000_000_000n
|
|
107
107
|
let globalSnapshotSamplingRateWindowStart = 0n
|
|
108
|
-
|
|
108
|
+
/**
|
|
109
|
+
* The snapshots counted toward the global snapshot rate limit in the current window. Later probes in a sampled trace
|
|
110
|
+
* aren't limited by it, so this can exceed the limit. The excess is carried over into the following windows, which
|
|
111
|
+
* keeps the overall volume within the limit on average.
|
|
112
|
+
*/
|
|
113
|
+
let snapshotsCountedInWindow = 0
|
|
109
114
|
|
|
110
115
|
ddTraceGlobal[Symbol.for(PROBE_SAMPLER_SYMBOL)] = {
|
|
111
116
|
/**
|
|
@@ -274,8 +279,9 @@ function installProbeSampler (guardrailMetrics, config) {
|
|
|
274
279
|
* Sample a snapshot-producing probe hit using the sampling decision of its trace. The first such probe hit in the
|
|
275
280
|
* trace makes the decision for all of them, subject to its per-probe rate limit and the global snapshot rate limit.
|
|
276
281
|
* If the trace is sampled, each probe then emits once in it without being subject to the rate limits, so the trace
|
|
277
|
-
* emits a complete set of snapshots. Those snapshots still count toward the rate limits
|
|
278
|
-
*
|
|
282
|
+
* emits a complete set of snapshots. Those snapshots still count toward the rate limits. Any that exceed the global
|
|
283
|
+
* snapshot rate limit are carried over into its following windows, so later traces are less likely to be sampled
|
|
284
|
+
* until the excess is made up.
|
|
279
285
|
*
|
|
280
286
|
* @param {LocalTrace} trace - The trace the probe was hit in.
|
|
281
287
|
* @param {number} probeIndex - The worker-side probe sampling index.
|
|
@@ -325,14 +331,33 @@ function installProbeSampler (guardrailMetrics, config) {
|
|
|
325
331
|
return true
|
|
326
332
|
}
|
|
327
333
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
snapshotsSampledWithinTheLastSecond >= MAX_SNAPSHOTS_PER_SECOND_GLOBALLY) {
|
|
331
|
-
guardrailMetrics.eventSkipped(SKIPPED_REASON.RATE_LIMIT_GLOBAL, EVENT_TYPE.SNAPSHOT)
|
|
332
|
-
return true
|
|
333
|
-
}
|
|
334
|
+
return isSnapshotProducingProbe && isGloballyRateLimited(now)
|
|
335
|
+
}
|
|
334
336
|
|
|
335
|
-
|
|
337
|
+
/**
|
|
338
|
+
* Check the global snapshot rate limit, recording the skip if it is reached.
|
|
339
|
+
*
|
|
340
|
+
* @param {bigint} now - The current time.
|
|
341
|
+
*/
|
|
342
|
+
function isGloballyRateLimited (now) {
|
|
343
|
+
advanceGlobalSnapshotWindow(now)
|
|
344
|
+
if (snapshotsCountedInWindow < MAX_SNAPSHOTS_PER_SECOND_GLOBALLY) return false
|
|
345
|
+
guardrailMetrics.eventSkipped(SKIPPED_REASON.RATE_LIMIT_GLOBAL, EVENT_TYPE.SNAPSHOT)
|
|
346
|
+
return true
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Start a new window of the global snapshot rate limit if the current one has passed. Snapshots counted in excess of
|
|
351
|
+
* the limit are carried over, reduced by the limit for each window that has passed since.
|
|
352
|
+
*
|
|
353
|
+
* @param {bigint} now - The current time.
|
|
354
|
+
*/
|
|
355
|
+
function advanceGlobalSnapshotWindow (now) {
|
|
356
|
+
const elapsedNs = now - globalSnapshotSamplingRateWindowStart
|
|
357
|
+
if (elapsedNs <= ONE_SECOND_NS) return
|
|
358
|
+
const allowance = Number(elapsedNs / ONE_SECOND_NS) * MAX_SNAPSHOTS_PER_SECOND_GLOBALLY
|
|
359
|
+
snapshotsCountedInWindow = Math.max(snapshotsCountedInWindow - allowance, 0)
|
|
360
|
+
globalSnapshotSamplingRateWindowStart = now
|
|
336
361
|
}
|
|
337
362
|
|
|
338
363
|
/**
|
|
@@ -347,12 +372,8 @@ function installProbeSampler (guardrailMetrics, config) {
|
|
|
347
372
|
if (!storeSampledProbeIndex(probeIndex)) return false
|
|
348
373
|
|
|
349
374
|
if (isSnapshotProducingProbe) {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
globalSnapshotSamplingRateWindowStart = now
|
|
353
|
-
} else {
|
|
354
|
-
snapshotsSampledWithinTheLastSecond++
|
|
355
|
-
}
|
|
375
|
+
advanceGlobalSnapshotWindow(now)
|
|
376
|
+
snapshotsCountedInWindow++
|
|
356
377
|
}
|
|
357
378
|
|
|
358
379
|
lastCaptureNsByProbeId.set(probeId, now)
|
|
@@ -441,6 +462,7 @@ function truncateErrorDescription (description) {
|
|
|
441
462
|
*
|
|
442
463
|
* @param {object} error - The thrown object to inspect.
|
|
443
464
|
* @param {'name' | 'message'} property - The property to find.
|
|
465
|
+
* @returns {string | void}
|
|
444
466
|
*/
|
|
445
467
|
function getErrorStringProperty (error, property) {
|
|
446
468
|
while (error !== null) {
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* few of its methods, never returns their results, and never emits its events. Deno doesn't let worker threads
|
|
8
8
|
* connect to the main thread inspector. Deno reports a Node.js `process.version`, so both runtimes are detected by
|
|
9
9
|
* their own `process.versions` entry instead.
|
|
10
|
+
*
|
|
11
|
+
* @returns {'Bun' | 'Deno' | void}
|
|
10
12
|
*/
|
|
11
13
|
function getUnsupportedRuntime () {
|
|
12
14
|
if (process.versions.bun !== undefined) return 'Bun'
|
|
@@ -19,7 +19,8 @@ const {
|
|
|
19
19
|
const cache = {}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* @param {import('./config/config-types').ConfigProperties
|
|
22
|
+
* @param {Pick<import('./config/config-types').ConfigProperties, 'DD_GIT_COMMIT_SHA' | 'DD_GIT_FOLDER_PATH' |
|
|
23
|
+
* 'DD_GIT_PROPERTIES_FILE' | 'DD_GIT_REPOSITORY_URL' | 'DD_TRACE_GIT_METADATA_ENABLED' | 'tags'>} config
|
|
23
24
|
*/
|
|
24
25
|
function getGitMetadata (config) {
|
|
25
26
|
if (!config.DD_TRACE_GIT_METADATA_ENABLED) {
|
|
@@ -6,13 +6,16 @@ const { isTrue } = require('./util')
|
|
|
6
6
|
// Global `jest` is only present in Jest workers.
|
|
7
7
|
const inJestWorker = typeof jest !== 'undefined'
|
|
8
8
|
|
|
9
|
-
// skipDefault: distinguish an unset DD_TRACE_ENABLED (fall back to the OTel
|
|
10
|
-
// explicit value; the registered default would otherwise mask the
|
|
9
|
+
// skipDefault: distinguish an unset DD_TRACE_ENABLED (fall back to the OTel settings) from an
|
|
10
|
+
// explicit value; the registered default would otherwise mask the OTel checks.
|
|
11
11
|
const ddTraceEnabled = getValueFromEnvSources('DD_TRACE_ENABLED', true)
|
|
12
12
|
const agentlessTracingEnabled = getValueFromEnvSources('DD_AGENTLESS_ENABLED') ||
|
|
13
13
|
isTrue(getEnvironmentVariable('_DD_APM_TRACING_AGENTLESS_ENABLED'))
|
|
14
|
+
// OTEL_SDK_DISABLED turns the whole SDK off, while OTEL_TRACES_EXPORTER only selects a trace
|
|
15
|
+
// transport, which agentless mode replaces.
|
|
14
16
|
const ddTraceDisabled = ddTraceEnabled === undefined
|
|
15
|
-
?
|
|
17
|
+
? getValueFromEnvSources('OTEL_SDK_DISABLED') ||
|
|
18
|
+
(!agentlessTracingEnabled && getValueFromEnvSources('OTEL_TRACES_EXPORTER') === 'none')
|
|
16
19
|
: ddTraceEnabled === false
|
|
17
20
|
|
|
18
21
|
module.exports = ddTraceDisabled || inJestWorker
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
// Internal bridge for datadog-lambda-js. Applications should use that package's wrapper API.
|
|
4
|
+
|
|
3
5
|
const tracer = require('../../../..')
|
|
4
6
|
const { AUTO_KEEP } = require('../../../../ext/priority')
|
|
5
7
|
const { writeDatadogTraceId, writeDatadogParentId, writeDatadogSamplingPriority } = require('../carrier')
|
|
@@ -52,17 +54,16 @@ function reportInitFailure (failure) {
|
|
|
52
54
|
/**
|
|
53
55
|
* Builds the message for a facade entry point whose implementation has not landed yet.
|
|
54
56
|
*
|
|
55
|
-
* The
|
|
56
|
-
*
|
|
57
|
-
* metrics with no error anywhere, which is the failure mode this migration exists to avoid.
|
|
57
|
+
* The shim requires the same internal contract on each supported tracer line. Throwing keeps the gap loud:
|
|
58
|
+
* a silent no-op here would drop customer metrics with no error anywhere.
|
|
58
59
|
* The shim's integration lands only after these are implemented, so the throw never ships to a
|
|
59
60
|
* shim user.
|
|
60
61
|
*
|
|
61
62
|
* @param {string} name Facade entry point.
|
|
62
63
|
*/
|
|
63
64
|
function notImplemented (name) {
|
|
64
|
-
return `
|
|
65
|
-
'
|
|
65
|
+
return `Internal Lambda ${name}() is not implemented yet. ` +
|
|
66
|
+
'Keep using datadog-lambda-js for custom metrics until the metrics pipeline is ported.'
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
module.exports = {
|
|
@@ -27,7 +27,7 @@ function extractModuleRootAndHandler (fullHandler) {
|
|
|
27
27
|
* @throws {Error} When the handler is not of the form `<module>.<path>`.
|
|
28
28
|
*/
|
|
29
29
|
function extractModuleNameAndHandlerPath (handler) {
|
|
30
|
-
const match =
|
|
30
|
+
const match = /^([^.]*)\.(.*)$/.exec(handler)
|
|
31
31
|
if (!match || match.length !== 3) {
|
|
32
32
|
throw new Error(`Malformed handler name: ${handler}`)
|
|
33
33
|
}
|
|
@@ -28,6 +28,7 @@ module.exports = {
|
|
|
28
28
|
AGENT_VERSION_TAG_KEY: 'agent_version',
|
|
29
29
|
METRICS: '_ml_obs.metrics',
|
|
30
30
|
TOOL_DEFINITIONS: '_ml_obs.meta.tool_definitions',
|
|
31
|
+
INTENT: '_ml_obs.meta.intent',
|
|
31
32
|
ML_APP: '_ml_obs.meta.ml_app',
|
|
32
33
|
PROPAGATED_PARENT_ID_KEY: '_dd.p.llmobs_parent_id',
|
|
33
34
|
PROPAGATED_ML_APP_KEY: '_dd.p.llmobs_ml_app',
|