dd-trace 5.94.0 → 5.95.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 +46 -44
- package/index.d.ts +182 -13
- package/package.json +1 -1
- package/packages/datadog-instrumentations/src/anthropic.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/{orchestrion/compiler.js → compiler.js} +4 -13
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +16 -2
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/langgraph.js +2 -2
- package/packages/datadog-instrumentations/src/helpers/rewriter/{orchestrion/transforms.js → transforms.js} +3 -89
- package/packages/datadog-plugin-dd-trace-api/src/index.js +1 -4
- package/packages/dd-trace/src/azure_metadata.js +15 -15
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +73 -1
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +76 -1
- package/packages/dd-trace/src/ci-visibility/requests/fs-cache.js +259 -0
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +56 -0
- package/packages/dd-trace/src/config/config-base.d.ts +7 -0
- package/packages/dd-trace/src/config/config-base.js +5 -0
- package/packages/dd-trace/src/config/config-types.d.ts +78 -0
- package/packages/dd-trace/src/config/generated-config-types.d.ts +582 -0
- package/packages/dd-trace/src/config/supported-configurations.json +7 -0
- package/packages/dd-trace/src/llmobs/constants/tags.js +1 -0
- package/packages/dd-trace/src/llmobs/constants/text.js +1 -1
- package/packages/dd-trace/src/llmobs/constants/writers.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/anthropic.js +11 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/index.js +4 -1
- package/packages/dd-trace/src/llmobs/writers/spans.js +1 -1
- package/packages/dd-trace/src/priority_sampler.js +1 -1
- package/packages/dd-trace/src/rate_limiter.js +2 -1
- package/packages/dd-trace/src/tagger.js +31 -35
- package/vendor/dist/@apm-js-collab/code-transformer/LICENSE +28 -0
- package/vendor/dist/@apm-js-collab/code-transformer/index.js +133 -0
- package/vendor/dist/@opentelemetry/core/index.js +1 -1
- package/vendor/dist/@opentelemetry/resources/index.js +1 -1
- package/vendor/dist/esquery/index.js +1 -1
- package/vendor/dist/meriyah/index.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/orchestrion/index.js +0 -43
- package/packages/datadog-instrumentations/src/helpers/rewriter/orchestrion/matcher.js +0 -49
- package/packages/datadog-instrumentations/src/helpers/rewriter/orchestrion/transformer.js +0 -121
- package/vendor/dist/astring/LICENSE +0 -19
- package/vendor/dist/astring/index.js +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { UNKNOWN_MODEL_PROVIDER } = require('../constants/tags')
|
|
3
4
|
const LLMObsPlugin = require('./base')
|
|
4
5
|
|
|
5
6
|
const ALLOWED_METADATA_KEYS = new Set([
|
|
@@ -108,16 +109,24 @@ class AnthropicLLMObsPlugin extends LLMObsPlugin {
|
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
getLLMObsSpanRegisterOptions (ctx) {
|
|
111
|
-
const { options } = ctx
|
|
112
|
+
const { options, baseUrl } = ctx
|
|
112
113
|
const { model } = options
|
|
114
|
+
const modelProvider = this._getModelProvider(baseUrl)
|
|
113
115
|
|
|
114
116
|
return {
|
|
115
117
|
kind: 'llm',
|
|
116
118
|
modelName: model,
|
|
117
|
-
modelProvider
|
|
119
|
+
modelProvider,
|
|
118
120
|
}
|
|
119
121
|
}
|
|
120
122
|
|
|
123
|
+
_getModelProvider (baseUrl = '') {
|
|
124
|
+
if (baseUrl.includes('anthropic')) {
|
|
125
|
+
return 'anthropic'
|
|
126
|
+
}
|
|
127
|
+
return UNKNOWN_MODEL_PROVIDER
|
|
128
|
+
}
|
|
129
|
+
|
|
121
130
|
setLLMObsTags (ctx) {
|
|
122
131
|
const span = ctx.currentStore?.span
|
|
123
132
|
if (!span) return
|
|
@@ -5,6 +5,7 @@ const {
|
|
|
5
5
|
PROMPT_TRACKING_INSTRUMENTATION_METHOD,
|
|
6
6
|
PROMPT_MULTIMODAL,
|
|
7
7
|
INSTRUMENTATION_METHOD_AUTO,
|
|
8
|
+
UNKNOWN_MODEL_PROVIDER,
|
|
8
9
|
} = require('../../constants/tags')
|
|
9
10
|
const {
|
|
10
11
|
extractChatTemplateFromInstructions,
|
|
@@ -90,10 +91,12 @@ class OpenAiLLMObsPlugin extends LLMObsPlugin {
|
|
|
90
91
|
_getModelProviderAndClient (baseUrl = '') {
|
|
91
92
|
if (baseUrl.includes('azure')) {
|
|
92
93
|
return { modelProvider: 'azure_openai', client: 'AzureOpenAI' }
|
|
94
|
+
} else if (baseUrl.includes('openai')) {
|
|
95
|
+
return { modelProvider: 'openai', client: 'OpenAI' }
|
|
93
96
|
} else if (baseUrl.includes('deepseek')) {
|
|
94
97
|
return { modelProvider: 'deepseek', client: 'DeepSeek' }
|
|
95
98
|
}
|
|
96
|
-
return { modelProvider:
|
|
99
|
+
return { modelProvider: UNKNOWN_MODEL_PROVIDER, client: 'OpenAI' }
|
|
97
100
|
}
|
|
98
101
|
|
|
99
102
|
_extractMetrics (response) {
|
|
@@ -32,7 +32,7 @@ class LLMObsSpanWriter extends BaseWriter {
|
|
|
32
32
|
let processedEventSizeBytes = eventSizeBytes
|
|
33
33
|
|
|
34
34
|
if (shouldTruncate) {
|
|
35
|
-
logger.warn(`Dropping event input/output because its size (${eventSizeBytes}) exceeds the
|
|
35
|
+
logger.warn(`Dropping event input/output because its size (${eventSizeBytes}) exceeds the 5MB event size limit`)
|
|
36
36
|
event = this._truncateSpanEvent(event)
|
|
37
37
|
processedEventSizeBytes = Buffer.byteLength(JSON.stringify(event))
|
|
38
38
|
}
|
|
@@ -249,7 +249,7 @@ class PrioritySampler {
|
|
|
249
249
|
}
|
|
250
250
|
const rawPriority = tags[SAMPLING_PRIORITY]
|
|
251
251
|
if (rawPriority !== undefined) {
|
|
252
|
-
const priority =
|
|
252
|
+
const priority = Math.trunc(rawPriority)
|
|
253
253
|
|
|
254
254
|
if (priority === 1 || priority === 2) {
|
|
255
255
|
return USER_KEEP
|
|
@@ -8,7 +8,8 @@ class RateLimiter {
|
|
|
8
8
|
* @param {'second'|'minute'|'hour'|'day'} [interval='second'] - Time window for the limiter.
|
|
9
9
|
*/
|
|
10
10
|
constructor (rateLimit, interval = 'second') {
|
|
11
|
-
|
|
11
|
+
// TODO: Change rateLimit to integers. Right now these are sometimes strings, sometimes numbers.
|
|
12
|
+
this._rateLimit = Math.trunc(rateLimit)
|
|
12
13
|
// The limiter constructor accepts a token count number and an interval string
|
|
13
14
|
this._limiter = new limiter.RateLimiter(this._rateLimit, interval)
|
|
14
15
|
this._tokensRequested = 0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// TODO: Rename and move file. This is a general purpose helper for adding tags to a carrier.
|
|
4
4
|
|
|
5
5
|
function addNonEmpty (carrier, key, value) {
|
|
6
6
|
if (key !== '') {
|
|
@@ -11,47 +11,43 @@ function addNonEmpty (carrier, key, value) {
|
|
|
11
11
|
function add (carrier, keyValuePairs) {
|
|
12
12
|
if (!carrier) return
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let keyStart = 0
|
|
18
|
-
|
|
19
|
-
for (let i = 0; i < keyValuePairs.length; i++) {
|
|
20
|
-
const char = keyValuePairs[i]
|
|
21
|
-
|
|
22
|
-
if (char === ':') {
|
|
23
|
-
if (valueStart === 0) {
|
|
24
|
-
valueStart = i
|
|
25
|
-
}
|
|
26
|
-
} else if (char === ',') {
|
|
27
|
-
valueStart ||= i
|
|
28
|
-
addNonEmpty(
|
|
29
|
-
carrier,
|
|
30
|
-
keyValuePairs.slice(keyStart, valueStart).trim(),
|
|
31
|
-
keyValuePairs.slice(valueStart + 1, i).trim()
|
|
32
|
-
)
|
|
33
|
-
keyStart = i + 1
|
|
34
|
-
valueStart = 0
|
|
35
|
-
}
|
|
36
|
-
}
|
|
14
|
+
if (typeof keyValuePairs === 'string') {
|
|
15
|
+
let valueStart = 0
|
|
16
|
+
let keyStart = 0
|
|
37
17
|
|
|
38
|
-
|
|
39
|
-
|
|
18
|
+
for (let i = 0; i < keyValuePairs.length; i++) {
|
|
19
|
+
const char = keyValuePairs[i]
|
|
20
|
+
|
|
21
|
+
if (char === ':') {
|
|
22
|
+
if (valueStart === 0) {
|
|
23
|
+
valueStart = i
|
|
24
|
+
}
|
|
25
|
+
} else if (char === ',') {
|
|
26
|
+
valueStart ||= i
|
|
40
27
|
addNonEmpty(
|
|
41
28
|
carrier,
|
|
42
29
|
keyValuePairs.slice(keyStart, valueStart).trim(),
|
|
43
|
-
keyValuePairs.slice(valueStart + 1).trim()
|
|
30
|
+
keyValuePairs.slice(valueStart + 1, i).trim()
|
|
44
31
|
)
|
|
32
|
+
keyStart = i + 1
|
|
33
|
+
valueStart = 0
|
|
45
34
|
}
|
|
46
|
-
} else if (Array.isArray(keyValuePairs)) {
|
|
47
|
-
for (const tags of keyValuePairs) {
|
|
48
|
-
add(carrier, tags)
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
Object.assign(carrier, keyValuePairs)
|
|
52
35
|
}
|
|
53
|
-
|
|
54
|
-
|
|
36
|
+
|
|
37
|
+
if (keyValuePairs.at(-1) !== ',') {
|
|
38
|
+
valueStart ||= keyValuePairs.length
|
|
39
|
+
addNonEmpty(
|
|
40
|
+
carrier,
|
|
41
|
+
keyValuePairs.slice(keyStart, valueStart).trim(),
|
|
42
|
+
keyValuePairs.slice(valueStart + 1).trim()
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
} else if (Array.isArray(keyValuePairs)) {
|
|
46
|
+
for (const tags of keyValuePairs) {
|
|
47
|
+
add(carrier, tags)
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
Object.assign(carrier, keyValuePairs)
|
|
55
51
|
}
|
|
56
52
|
}
|
|
57
53
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
Copyright (c) 2009-2011, Mozilla Foundation and contributors
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
* Neither the names of the Mozilla Foundation nor the names of project
|
|
16
|
+
contributors may be used to endorse or promote products derived from this
|
|
17
|
+
software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
20
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
21
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|