dd-trace 5.71.0 → 5.73.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 +7 -0
- package/index.d.ts +114 -1
- package/package.json +25 -4
- package/packages/datadog-esbuild/index.js +8 -0
- package/packages/datadog-instrumentations/src/azure-event-hubs.js +37 -0
- package/packages/datadog-instrumentations/src/azure-functions.js +3 -0
- package/packages/datadog-instrumentations/src/azure-service-bus.js +49 -22
- package/packages/datadog-instrumentations/src/cookie-parser.js +2 -0
- package/packages/datadog-instrumentations/src/cucumber.js +7 -7
- package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -0
- package/packages/datadog-instrumentations/src/jest.js +85 -47
- package/packages/datadog-instrumentations/src/mocha/main.js +8 -9
- package/packages/datadog-instrumentations/src/mocha/utils.js +4 -5
- package/packages/datadog-instrumentations/src/mocha/worker.js +2 -2
- package/packages/datadog-instrumentations/src/pg.js +1 -1
- package/packages/datadog-instrumentations/src/playwright.js +5 -5
- package/packages/datadog-instrumentations/src/vitest.js +8 -8
- package/packages/datadog-plugin-amqplib/src/consumer.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +73 -27
- package/packages/datadog-plugin-azure-event-hubs/src/index.js +15 -0
- package/packages/datadog-plugin-azure-event-hubs/src/producer.js +82 -0
- package/packages/datadog-plugin-azure-functions/src/index.js +50 -3
- package/packages/datadog-plugin-azure-service-bus/src/index.js +1 -1
- package/packages/datadog-plugin-azure-service-bus/src/producer.js +60 -12
- package/packages/datadog-plugin-cucumber/src/index.js +3 -3
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +9 -9
- package/packages/datadog-plugin-jest/src/index.js +53 -18
- package/packages/datadog-plugin-jest/src/util.js +10 -2
- package/packages/datadog-plugin-mocha/src/index.js +2 -2
- package/packages/datadog-plugin-playwright/src/index.js +2 -2
- package/packages/datadog-plugin-vitest/src/index.js +2 -2
- package/packages/datadog-plugin-ws/src/close.js +1 -1
- package/packages/datadog-plugin-ws/src/producer.js +1 -1
- package/packages/datadog-plugin-ws/src/receiver.js +1 -1
- package/packages/datadog-plugin-ws/src/server.js +5 -3
- package/packages/dd-trace/src/appsec/index.js +9 -1
- package/packages/dd-trace/src/appsec/reporter.js +2 -3
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +5 -0
- package/packages/dd-trace/src/config.js +108 -26
- package/packages/dd-trace/src/config_defaults.js +12 -0
- package/packages/dd-trace/src/git_properties.js +90 -5
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +8 -3
- package/packages/dd-trace/src/llmobs/plugins/base.js +11 -12
- package/packages/dd-trace/src/llmobs/sdk.js +20 -4
- package/packages/dd-trace/src/llmobs/tagger.js +12 -0
- package/packages/dd-trace/src/noop/proxy.js +3 -0
- package/packages/dd-trace/src/openfeature/constants/constants.js +51 -0
- package/packages/dd-trace/src/openfeature/flagging_provider.js +45 -0
- package/packages/dd-trace/src/openfeature/index.js +77 -0
- package/packages/dd-trace/src/openfeature/noop.js +101 -0
- package/packages/dd-trace/src/openfeature/writers/base.js +181 -0
- package/packages/dd-trace/src/openfeature/writers/exposures.js +173 -0
- package/packages/dd-trace/src/openfeature/writers/util.js +43 -0
- package/packages/dd-trace/src/opentelemetry/logs/batch_log_processor.js +100 -0
- package/packages/dd-trace/src/opentelemetry/logs/index.js +87 -0
- package/packages/dd-trace/src/opentelemetry/logs/logger.js +77 -0
- package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +126 -0
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +53 -0
- package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +252 -0
- package/packages/dd-trace/src/opentelemetry/otlp/common.proto +116 -0
- package/packages/dd-trace/src/opentelemetry/otlp/logs.proto +226 -0
- package/packages/dd-trace/src/opentelemetry/otlp/logs_service.proto +78 -0
- package/packages/dd-trace/src/opentelemetry/otlp/metrics.proto +720 -0
- package/packages/dd-trace/src/opentelemetry/otlp/metrics_service.proto +78 -0
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +177 -0
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +163 -0
- package/packages/dd-trace/src/opentelemetry/otlp/protobuf_loader.js +66 -0
- package/packages/dd-trace/src/opentelemetry/otlp/resource.proto +45 -0
- package/packages/dd-trace/src/plugins/ci_plugin.js +7 -6
- package/packages/dd-trace/src/plugins/index.js +1 -0
- package/packages/dd-trace/src/plugins/util/test.js +6 -5
- package/packages/dd-trace/src/profiling/config.js +21 -1
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +3 -2
- package/packages/dd-trace/src/profiling/profiler.js +44 -22
- package/packages/dd-trace/src/profiling/profilers/events.js +12 -3
- package/packages/dd-trace/src/profiling/profilers/space.js +35 -24
- package/packages/dd-trace/src/profiling/profilers/wall.js +14 -6
- package/packages/dd-trace/src/proxy.js +22 -1
- package/packages/dd-trace/src/remote_config/capabilities.js +1 -0
- package/packages/dd-trace/src/remote_config/index.js +1 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +4 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +8 -0
- package/packages/dd-trace/src/supported-configurations.json +18 -0
- package/packages/dd-trace/src/telemetry/telemetry.js +13 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Vendored from: https://github.com/open-telemetry/opentelemetry-proto/blob/v1.7.0/opentelemetry/proto/collector/metrics/v1/metrics_service.proto
|
|
2
|
+
// Copyright 2019, OpenTelemetry Authors
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
|
|
16
|
+
syntax = "proto3";
|
|
17
|
+
|
|
18
|
+
package opentelemetry.proto.collector.metrics.v1;
|
|
19
|
+
|
|
20
|
+
import "metrics.proto";
|
|
21
|
+
|
|
22
|
+
option csharp_namespace = "OpenTelemetry.Proto.Collector.Metrics.V1";
|
|
23
|
+
option java_multiple_files = true;
|
|
24
|
+
option java_package = "io.opentelemetry.proto.collector.metrics.v1";
|
|
25
|
+
option java_outer_classname = "MetricsServiceProto";
|
|
26
|
+
option go_package = "go.opentelemetry.io/proto/otlp/collector/metrics/v1";
|
|
27
|
+
|
|
28
|
+
// Service that can be used to push metrics between one Application
|
|
29
|
+
// instrumented with OpenTelemetry and a collector, or between a collector and a
|
|
30
|
+
// central collector.
|
|
31
|
+
service MetricsService {
|
|
32
|
+
rpc Export(ExportMetricsServiceRequest) returns (ExportMetricsServiceResponse) {}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
message ExportMetricsServiceRequest {
|
|
36
|
+
// An array of ResourceMetrics.
|
|
37
|
+
// For data coming from a single resource this array will typically contain one
|
|
38
|
+
// element. Intermediary nodes (such as OpenTelemetry Collector) that receive
|
|
39
|
+
// data from multiple origins typically batch the data before forwarding further and
|
|
40
|
+
// in that case this array will contain multiple elements.
|
|
41
|
+
repeated opentelemetry.proto.metrics.v1.ResourceMetrics resource_metrics = 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
message ExportMetricsServiceResponse {
|
|
45
|
+
// The details of a partially successful export request.
|
|
46
|
+
//
|
|
47
|
+
// If the request is only partially accepted
|
|
48
|
+
// (i.e. when the server accepts only parts of the data and rejects the rest)
|
|
49
|
+
// the server MUST initialize the `partial_success` field and MUST
|
|
50
|
+
// set the `rejected_<signal>` with the number of items it rejected.
|
|
51
|
+
//
|
|
52
|
+
// Servers MAY also make use of the `partial_success` field to convey
|
|
53
|
+
// warnings/suggestions to senders even when the request was fully accepted.
|
|
54
|
+
// In such cases, the `rejected_<signal>` MUST have a value of `0` and
|
|
55
|
+
// the `error_message` MUST be non-empty.
|
|
56
|
+
//
|
|
57
|
+
// A `partial_success` message with an empty value (rejected_<signal> = 0 and
|
|
58
|
+
// `error_message` = "") is equivalent to it not being set/present. Senders
|
|
59
|
+
// SHOULD interpret it the same way as in the full success case.
|
|
60
|
+
ExportMetricsPartialSuccess partial_success = 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
message ExportMetricsPartialSuccess {
|
|
64
|
+
// The number of rejected data points.
|
|
65
|
+
//
|
|
66
|
+
// A `rejected_<signal>` field holding a `0` value indicates that the
|
|
67
|
+
// request was fully accepted.
|
|
68
|
+
int64 rejected_data_points = 1;
|
|
69
|
+
|
|
70
|
+
// A developer-facing human-readable message in English. It should be used
|
|
71
|
+
// either to explain why the server rejected parts of the data during a partial
|
|
72
|
+
// success or to convey warnings/suggestions during a full success. The message
|
|
73
|
+
// should offer guidance on how users can address such issues.
|
|
74
|
+
//
|
|
75
|
+
// error_message is an optional field. An error_message with an empty value
|
|
76
|
+
// is equivalent to it not being set.
|
|
77
|
+
string error_message = 2;
|
|
78
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const http = require('http')
|
|
4
|
+
const { URL } = require('url')
|
|
5
|
+
const log = require('../../log')
|
|
6
|
+
const telemetryMetrics = require('../../telemetry/metrics')
|
|
7
|
+
|
|
8
|
+
const tracerMetrics = telemetryMetrics.manager.namespace('tracers')
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Base class for OTLP HTTP exporters.
|
|
12
|
+
*
|
|
13
|
+
* This implementation follows the OTLP HTTP specification:
|
|
14
|
+
* https://opentelemetry.io/docs/specs/otlp/#otlphttp
|
|
15
|
+
*
|
|
16
|
+
* @class OtlpHttpExporterBase
|
|
17
|
+
*/
|
|
18
|
+
class OtlpHttpExporterBase {
|
|
19
|
+
#telemetryTags
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new OtlpHttpExporterBase instance.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} url - OTLP endpoint URL
|
|
25
|
+
* @param {string} headers - Additional HTTP headers as comma-separated key=value string
|
|
26
|
+
* @param {number} timeout - Request timeout in milliseconds
|
|
27
|
+
* @param {string} protocol - OTLP protocol (http/protobuf or http/json)
|
|
28
|
+
* @param {string} defaultPath - Default path to use if URL has no path
|
|
29
|
+
* @param {string} signalType - Signal type for error messages (e.g., 'logs', 'metrics')
|
|
30
|
+
*/
|
|
31
|
+
constructor (url, headers, timeout, protocol, defaultPath, signalType) {
|
|
32
|
+
const parsedUrl = new URL(url)
|
|
33
|
+
|
|
34
|
+
this.protocol = protocol
|
|
35
|
+
this.signalType = signalType
|
|
36
|
+
|
|
37
|
+
// If no path is provided, use default path
|
|
38
|
+
const path = parsedUrl.pathname === '/' ? defaultPath : parsedUrl.pathname
|
|
39
|
+
const isJson = protocol === 'http/json'
|
|
40
|
+
|
|
41
|
+
this.options = {
|
|
42
|
+
hostname: parsedUrl.hostname,
|
|
43
|
+
port: parsedUrl.port,
|
|
44
|
+
path: path + parsedUrl.search,
|
|
45
|
+
method: 'POST',
|
|
46
|
+
timeout,
|
|
47
|
+
headers: {
|
|
48
|
+
'Content-Type': isJson ? 'application/json' : 'application/x-protobuf',
|
|
49
|
+
...this.#parseAdditionalHeaders(headers)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
this.#telemetryTags = [
|
|
53
|
+
'protocol:http',
|
|
54
|
+
`encoding:${isJson ? 'json' : 'protobuf'}`
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Gets the telemetry tags for this exporter.
|
|
60
|
+
* @returns {Array<string>} Telemetry tags
|
|
61
|
+
* @protected
|
|
62
|
+
*/
|
|
63
|
+
_getTelemetryTags () {
|
|
64
|
+
return this.#telemetryTags
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Records telemetry metrics for exported data.
|
|
69
|
+
* @param {string} metricName - Name of the metric to record
|
|
70
|
+
* @param {number} count - Count to increment
|
|
71
|
+
* @param {Array<string>} [tags] - Optional custom tags (defaults to this exporter's tags)
|
|
72
|
+
* @protected
|
|
73
|
+
*/
|
|
74
|
+
_recordTelemetry (metricName, count, tags) {
|
|
75
|
+
const telemetryTags = tags || this.#telemetryTags
|
|
76
|
+
tracerMetrics.count(metricName, telemetryTags).inc(count)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Sends the payload via HTTP request.
|
|
81
|
+
* @param {Buffer|string} payload - The payload to send
|
|
82
|
+
* @param {Function} resultCallback - Callback for the result
|
|
83
|
+
* @protected
|
|
84
|
+
*/
|
|
85
|
+
_sendPayload (payload, resultCallback) {
|
|
86
|
+
const options = {
|
|
87
|
+
...this.options,
|
|
88
|
+
headers: {
|
|
89
|
+
...this.options.headers,
|
|
90
|
+
'Content-Length': payload.length
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const req = http.request(options, (res) => {
|
|
95
|
+
let data = ''
|
|
96
|
+
|
|
97
|
+
res.on('data', (chunk) => {
|
|
98
|
+
data += chunk
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
res.on('end', () => {
|
|
102
|
+
if (res.statusCode >= 200 && res.statusCode < 300) {
|
|
103
|
+
resultCallback({ code: 0 })
|
|
104
|
+
} else {
|
|
105
|
+
const error = new Error(`HTTP ${res.statusCode}: ${data}`)
|
|
106
|
+
resultCallback({ code: 1, error })
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
req.on('error', (error) => {
|
|
112
|
+
log.error(`Error sending OTLP ${this.signalType}:`, error)
|
|
113
|
+
resultCallback({ code: 1, error })
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
req.on('timeout', () => {
|
|
117
|
+
req.destroy()
|
|
118
|
+
const error = new Error('Request timeout')
|
|
119
|
+
resultCallback({ code: 1, error })
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
req.write(payload)
|
|
123
|
+
req.end()
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Parses additional HTTP headers from a comma-separated string.
|
|
128
|
+
* @param {string} headersString - Comma-separated key=value pairs
|
|
129
|
+
* @returns {Record<string, string>} Parsed headers object
|
|
130
|
+
* @private
|
|
131
|
+
*/
|
|
132
|
+
#parseAdditionalHeaders (headersString) {
|
|
133
|
+
const headers = {}
|
|
134
|
+
let key = ''
|
|
135
|
+
let value = ''
|
|
136
|
+
let readingKey = true
|
|
137
|
+
|
|
138
|
+
for (const char of headersString) {
|
|
139
|
+
if (readingKey) {
|
|
140
|
+
if (char === '=') {
|
|
141
|
+
readingKey = false
|
|
142
|
+
key = key.trim()
|
|
143
|
+
} else {
|
|
144
|
+
key += char
|
|
145
|
+
}
|
|
146
|
+
} else if (char === ',') {
|
|
147
|
+
value = value.trim()
|
|
148
|
+
if (key && value) {
|
|
149
|
+
headers[key] = value
|
|
150
|
+
}
|
|
151
|
+
key = ''
|
|
152
|
+
value = ''
|
|
153
|
+
readingKey = true
|
|
154
|
+
} else {
|
|
155
|
+
value += char
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Add the last pair if present
|
|
160
|
+
if (!readingKey) {
|
|
161
|
+
value = value.trim()
|
|
162
|
+
if (value) {
|
|
163
|
+
headers[key] = value
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return headers
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Shuts down the exporter.
|
|
172
|
+
* Subclasses can override to add cleanup logic.
|
|
173
|
+
*/
|
|
174
|
+
shutdown () {}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
module.exports = OtlpHttpExporterBase
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const log = require('../../log')
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {import('@opentelemetry/api').Attributes} Attributes
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Base class for OTLP transformers.
|
|
11
|
+
*
|
|
12
|
+
* This implementation provides common functionality for transforming
|
|
13
|
+
* data to OTLP format (protobuf or JSON).
|
|
14
|
+
*
|
|
15
|
+
* @class OtlpTransformerBase
|
|
16
|
+
*/
|
|
17
|
+
class OtlpTransformerBase {
|
|
18
|
+
#resourceAttributes
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new OtlpTransformerBase instance.
|
|
22
|
+
*
|
|
23
|
+
* @param {Attributes} resourceAttributes - Resource attributes
|
|
24
|
+
* @param {string} protocol - OTLP protocol (http/protobuf or http/json)
|
|
25
|
+
* @param {string} signalType - Signal type for warning messages (e.g., 'logs', 'metrics')
|
|
26
|
+
*/
|
|
27
|
+
constructor (resourceAttributes, protocol, signalType) {
|
|
28
|
+
this.#resourceAttributes = this._transformAttributes(resourceAttributes)
|
|
29
|
+
if (protocol === 'grpc') {
|
|
30
|
+
log.warn(`OTLP gRPC protocol is not supported for ${signalType}. ` +
|
|
31
|
+
'Defaulting to http/protobuf. gRPC protobuf support may be added in a future release.')
|
|
32
|
+
protocol = 'http/protobuf'
|
|
33
|
+
}
|
|
34
|
+
this.protocol = protocol
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Groups items by instrumentation scope (name, version, schemaUrl, and attributes).
|
|
39
|
+
* @param {Array} items - Array of items to group
|
|
40
|
+
* @returns {Map<string, Array>} Map of instrumentation scope key to items
|
|
41
|
+
* @protected
|
|
42
|
+
*/
|
|
43
|
+
_groupByInstrumentationScope (items) {
|
|
44
|
+
const grouped = new Map()
|
|
45
|
+
|
|
46
|
+
for (const item of items) {
|
|
47
|
+
const instrumentationScope = item.instrumentationScope || { name: '', version: '', schemaUrl: '', attributes: {} }
|
|
48
|
+
const attrsKey = JSON.stringify(instrumentationScope.attributes || {})
|
|
49
|
+
const key = `${instrumentationScope.name}@${instrumentationScope.version}@` +
|
|
50
|
+
`${instrumentationScope.schemaUrl}@${attrsKey}`
|
|
51
|
+
|
|
52
|
+
const group = grouped.get(key)
|
|
53
|
+
if (group === undefined) {
|
|
54
|
+
grouped.set(key, [item])
|
|
55
|
+
} else {
|
|
56
|
+
group.push(item)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return grouped
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Transforms resource attributes to OTLP resource format.
|
|
64
|
+
* @returns {Object} OTLP resource object
|
|
65
|
+
* @protected
|
|
66
|
+
*/
|
|
67
|
+
_transformResource () {
|
|
68
|
+
return {
|
|
69
|
+
attributes: this.#resourceAttributes,
|
|
70
|
+
droppedAttributesCount: 0
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Transforms attributes to OTLP KeyValue format.
|
|
76
|
+
* @param {Object} attributes - Attributes to transform
|
|
77
|
+
* @returns {Object[]} Array of OTLP KeyValue objects
|
|
78
|
+
* @protected
|
|
79
|
+
*/
|
|
80
|
+
_transformAttributes (attributes) {
|
|
81
|
+
if (!attributes) return []
|
|
82
|
+
|
|
83
|
+
return Object.entries(attributes).map(([key, value]) => ({
|
|
84
|
+
key,
|
|
85
|
+
value: this._transformAnyValue(value)
|
|
86
|
+
}))
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Transforms attributes to JSON format (simplified).
|
|
91
|
+
* @param {Object} attributes - Attributes to transform
|
|
92
|
+
* @returns {Object[]} Array of OTLP KeyValue objects with string values
|
|
93
|
+
* @protected
|
|
94
|
+
*/
|
|
95
|
+
_attributesToJson (attributes) {
|
|
96
|
+
if (!attributes) return []
|
|
97
|
+
|
|
98
|
+
return Object.entries(attributes).map(([key, value]) => ({
|
|
99
|
+
key,
|
|
100
|
+
value: { stringValue: String(value) }
|
|
101
|
+
}))
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Transforms any value to OTLP AnyValue format.
|
|
106
|
+
* @param {any} value - Value to transform
|
|
107
|
+
* @returns {Object} OTLP AnyValue object
|
|
108
|
+
* @protected
|
|
109
|
+
*/
|
|
110
|
+
_transformAnyValue (value) {
|
|
111
|
+
if (typeof value === 'string') {
|
|
112
|
+
return { stringValue: value }
|
|
113
|
+
} else if (typeof value === 'number') {
|
|
114
|
+
if (Number.isInteger(value)) {
|
|
115
|
+
return { intValue: value }
|
|
116
|
+
}
|
|
117
|
+
return { doubleValue: value }
|
|
118
|
+
} else if (typeof value === 'boolean') {
|
|
119
|
+
return { boolValue: value }
|
|
120
|
+
} else if (Array.isArray(value)) {
|
|
121
|
+
return {
|
|
122
|
+
arrayValue: {
|
|
123
|
+
values: value.map(v => this._transformAnyValue(v))
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
} else if (value && typeof value === 'object') {
|
|
127
|
+
return {
|
|
128
|
+
kvlistValue: {
|
|
129
|
+
values: Object.entries(value).map(([k, v]) => ({
|
|
130
|
+
key: k,
|
|
131
|
+
value: this._transformAnyValue(v)
|
|
132
|
+
}))
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return { stringValue: String(value) }
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Serializes data to protobuf format.
|
|
141
|
+
* @param {Object} protoType - Protobuf type from protobuf_loader
|
|
142
|
+
* @param {Object} data - Data to serialize
|
|
143
|
+
* @returns {Buffer} Protobuf-encoded data
|
|
144
|
+
* @protected
|
|
145
|
+
*/
|
|
146
|
+
_serializeToProtobuf (protoType, data) {
|
|
147
|
+
const message = protoType.create(data)
|
|
148
|
+
const buffer = protoType.encode(message).finish()
|
|
149
|
+
return buffer
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Serializes data to JSON format.
|
|
154
|
+
* @param {Object} data - Data to serialize
|
|
155
|
+
* @returns {Buffer} JSON-encoded data
|
|
156
|
+
* @protected
|
|
157
|
+
*/
|
|
158
|
+
_serializeToJson (data) {
|
|
159
|
+
return Buffer.from(JSON.stringify(data))
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
module.exports = OtlpTransformerBase
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview Protobuf Loader for OpenTelemetry Logs and Metrics
|
|
5
|
+
*
|
|
6
|
+
* This module loads protobuf definitions for OpenTelemetry logs and metrics.
|
|
7
|
+
*
|
|
8
|
+
* VERSION SUPPORT:
|
|
9
|
+
* - OTLP Protocol: v1.7.0
|
|
10
|
+
* - Protobuf Definitions: v1.7.0 (vendored from opentelemetry-proto)
|
|
11
|
+
* - Other versions are not supported
|
|
12
|
+
*
|
|
13
|
+
* Reference:
|
|
14
|
+
* - https://github.com/open-telemetry/opentelemetry-proto (v1.7.0)
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const protobuf = require('protobufjs')
|
|
18
|
+
const path = require('path')
|
|
19
|
+
|
|
20
|
+
let _root = null
|
|
21
|
+
let protoLogsService = null
|
|
22
|
+
let protoSeverityNumber = null
|
|
23
|
+
let protoMetricsService = null
|
|
24
|
+
let protoAggregationTemporality = null
|
|
25
|
+
|
|
26
|
+
function getProtobufTypes () {
|
|
27
|
+
if (_root) {
|
|
28
|
+
return {
|
|
29
|
+
protoLogsService,
|
|
30
|
+
protoSeverityNumber,
|
|
31
|
+
protoMetricsService,
|
|
32
|
+
protoAggregationTemporality
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// Load the proto files
|
|
36
|
+
const protoDir = __dirname
|
|
37
|
+
const protoFiles = [
|
|
38
|
+
'common.proto',
|
|
39
|
+
'resource.proto',
|
|
40
|
+
'logs.proto',
|
|
41
|
+
'logs_service.proto',
|
|
42
|
+
'metrics.proto',
|
|
43
|
+
'metrics_service.proto'
|
|
44
|
+
].map(file => path.join(protoDir, file))
|
|
45
|
+
|
|
46
|
+
_root = protobuf.loadSync(protoFiles)
|
|
47
|
+
|
|
48
|
+
// Get the message types for logs
|
|
49
|
+
protoLogsService = _root.lookupType('opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest')
|
|
50
|
+
protoSeverityNumber = _root.lookupEnum('opentelemetry.proto.logs.v1.SeverityNumber')
|
|
51
|
+
|
|
52
|
+
// Get the message types for metrics
|
|
53
|
+
protoMetricsService = _root.lookupType('opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest')
|
|
54
|
+
protoAggregationTemporality = _root.lookupEnum('opentelemetry.proto.metrics.v1.AggregationTemporality')
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
protoLogsService,
|
|
58
|
+
protoSeverityNumber,
|
|
59
|
+
protoMetricsService,
|
|
60
|
+
protoAggregationTemporality
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = {
|
|
65
|
+
getProtobufTypes,
|
|
66
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Vendored from: https://github.com/open-telemetry/opentelemetry-proto/blob/v1.7.0/opentelemetry/proto/resource/v1/resource.proto
|
|
2
|
+
// Copyright 2019, OpenTelemetry Authors
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
|
|
16
|
+
syntax = "proto3";
|
|
17
|
+
|
|
18
|
+
package opentelemetry.proto.resource.v1;
|
|
19
|
+
|
|
20
|
+
import "common.proto";
|
|
21
|
+
|
|
22
|
+
option csharp_namespace = "OpenTelemetry.Proto.Resource.V1";
|
|
23
|
+
option java_multiple_files = true;
|
|
24
|
+
option java_package = "io.opentelemetry.proto.resource.v1";
|
|
25
|
+
option java_outer_classname = "ResourceProto";
|
|
26
|
+
option go_package = "go.opentelemetry.io/proto/otlp/resource/v1";
|
|
27
|
+
|
|
28
|
+
// Resource information.
|
|
29
|
+
message Resource {
|
|
30
|
+
// Set of attributes that describe the resource.
|
|
31
|
+
// Attribute keys MUST be unique (it is not allowed to have more than one
|
|
32
|
+
// attribute with the same key).
|
|
33
|
+
repeated opentelemetry.proto.common.v1.KeyValue attributes = 1;
|
|
34
|
+
|
|
35
|
+
// dropped_attributes_count is the number of dropped attributes. If the value is 0, then
|
|
36
|
+
// no attributes were dropped.
|
|
37
|
+
uint32 dropped_attributes_count = 2;
|
|
38
|
+
|
|
39
|
+
// Set of entities that participate in this Resource.
|
|
40
|
+
//
|
|
41
|
+
// Note: keys in the references MUST exist in attributes of this message.
|
|
42
|
+
//
|
|
43
|
+
// Status: [Development]
|
|
44
|
+
repeated opentelemetry.proto.common.v1.EntityRef entity_refs = 3;
|
|
45
|
+
}
|
|
@@ -33,7 +33,7 @@ const {
|
|
|
33
33
|
DI_DEBUG_ERROR_LINE_SUFFIX,
|
|
34
34
|
getLibraryCapabilitiesTags,
|
|
35
35
|
getPullRequestDiff,
|
|
36
|
-
|
|
36
|
+
getModifiedFilesFromDiff,
|
|
37
37
|
getPullRequestBaseBranch
|
|
38
38
|
} = require('./util/test')
|
|
39
39
|
const { getRepositoryRoot } = require('./util/git')
|
|
@@ -275,11 +275,11 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
275
275
|
})
|
|
276
276
|
})
|
|
277
277
|
|
|
278
|
-
this.addBind(`ci:${this.constructor.id}:modified-
|
|
278
|
+
this.addBind(`ci:${this.constructor.id}:modified-files`, (ctx) => {
|
|
279
279
|
return ctx.currentStore
|
|
280
280
|
})
|
|
281
281
|
|
|
282
|
-
this.addSub(`ci:${this.constructor.id}:modified-
|
|
282
|
+
this.addSub(`ci:${this.constructor.id}:modified-files`, ({ onDone }) => {
|
|
283
283
|
const {
|
|
284
284
|
[GIT_PULL_REQUEST_BASE_BRANCH]: pullRequestBaseBranch,
|
|
285
285
|
[GIT_PULL_REQUEST_BASE_BRANCH_SHA]: pullRequestBaseBranchSha,
|
|
@@ -290,9 +290,10 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
290
290
|
|
|
291
291
|
if (baseBranchSha) {
|
|
292
292
|
const diff = getPullRequestDiff(baseBranchSha, commitHeadSha)
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
|
|
293
|
+
const modifiedFiles = getModifiedFilesFromDiff(diff)
|
|
294
|
+
|
|
295
|
+
if (modifiedFiles) {
|
|
296
|
+
return onDone({ err: null, modifiedFiles })
|
|
296
297
|
}
|
|
297
298
|
}
|
|
298
299
|
|
|
@@ -4,6 +4,7 @@ module.exports = {
|
|
|
4
4
|
get '@anthropic-ai/sdk' () { return require('../../../datadog-plugin-anthropic/src') },
|
|
5
5
|
get '@apollo/gateway' () { return require('../../../datadog-plugin-apollo/src') },
|
|
6
6
|
get '@aws-sdk/smithy-client' () { return require('../../../datadog-plugin-aws-sdk/src') },
|
|
7
|
+
get '@azure/event-hubs' () { return require('../../../datadog-plugin-azure-event-hubs/src') },
|
|
7
8
|
get '@azure/functions' () { return require('../../../datadog-plugin-azure-functions/src') },
|
|
8
9
|
get '@azure/service-bus' () { return require('../../../datadog-plugin-azure-service-bus/src') },
|
|
9
10
|
get '@cucumber/cucumber' () { return require('../../../datadog-plugin-cucumber/src') },
|
|
@@ -301,7 +301,7 @@ module.exports = {
|
|
|
301
301
|
checkShaDiscrepancies,
|
|
302
302
|
getPullRequestDiff,
|
|
303
303
|
getPullRequestBaseBranch,
|
|
304
|
-
|
|
304
|
+
getModifiedFilesFromDiff,
|
|
305
305
|
isModifiedTest,
|
|
306
306
|
POSSIBLE_BASE_BRANCHES
|
|
307
307
|
}
|
|
@@ -1069,7 +1069,7 @@ function getPullRequestDiff (baseCommit, targetCommit) {
|
|
|
1069
1069
|
return getGitDiff(baseCommit, targetCommit)
|
|
1070
1070
|
}
|
|
1071
1071
|
|
|
1072
|
-
function
|
|
1072
|
+
function getModifiedFilesFromDiff (diff) {
|
|
1073
1073
|
if (!diff) return null
|
|
1074
1074
|
const result = {}
|
|
1075
1075
|
|
|
@@ -1110,12 +1110,13 @@ function getModifiedTestsFromDiff (diff) {
|
|
|
1110
1110
|
return result
|
|
1111
1111
|
}
|
|
1112
1112
|
|
|
1113
|
-
function isModifiedTest (testPath, testStartLine, testEndLine,
|
|
1114
|
-
if (
|
|
1113
|
+
function isModifiedTest (testPath, testStartLine, testEndLine, modifiedFiles, testFramework) {
|
|
1114
|
+
if (modifiedFiles === undefined) {
|
|
1115
1115
|
return false
|
|
1116
1116
|
}
|
|
1117
1117
|
|
|
1118
|
-
const lines =
|
|
1118
|
+
const lines = modifiedFiles[testPath]
|
|
1119
|
+
|
|
1119
1120
|
if (!lines) {
|
|
1120
1121
|
return false
|
|
1121
1122
|
}
|
|
@@ -25,6 +25,7 @@ class Config {
|
|
|
25
25
|
DD_AGENT_HOST,
|
|
26
26
|
DD_ENV,
|
|
27
27
|
DD_INTERNAL_PROFILING_TIMELINE_SAMPLING_ENABLED, // used for testing
|
|
28
|
+
DD_PROFILING_ASYNC_CONTEXT_FRAME_ENABLED,
|
|
28
29
|
DD_PROFILING_CODEHOTSPOTS_ENABLED,
|
|
29
30
|
DD_PROFILING_CPU_ENABLED,
|
|
30
31
|
DD_PROFILING_DEBUG_SOURCE_MAPS,
|
|
@@ -42,7 +43,6 @@ class Config {
|
|
|
42
43
|
DD_PROFILING_TIMELINE_ENABLED,
|
|
43
44
|
DD_PROFILING_UPLOAD_PERIOD,
|
|
44
45
|
DD_PROFILING_UPLOAD_TIMEOUT,
|
|
45
|
-
DD_PROFILING_ASYNC_CONTEXT_FRAME_ENABLED,
|
|
46
46
|
DD_PROFILING_V8_PROFILER_BUG_WORKAROUND,
|
|
47
47
|
DD_PROFILING_WALLTIME_ENABLED,
|
|
48
48
|
DD_SERVICE,
|
|
@@ -242,6 +242,26 @@ class Config {
|
|
|
242
242
|
|
|
243
243
|
this.profilers = ensureProfilers(profilers, this)
|
|
244
244
|
}
|
|
245
|
+
|
|
246
|
+
get systemInfoReport () {
|
|
247
|
+
const report = {
|
|
248
|
+
asyncContextFrameEnabled: this.asyncContextFrameEnabled,
|
|
249
|
+
codeHotspotsEnabled: this.codeHotspotsEnabled,
|
|
250
|
+
cpuProfilingEnabled: this.cpuProfilingEnabled,
|
|
251
|
+
debugSourceMaps: this.debugSourceMaps,
|
|
252
|
+
endpointCollectionEnabled: this.endpointCollectionEnabled,
|
|
253
|
+
heapSamplingInterval: this.heapSamplingInterval,
|
|
254
|
+
oomMonitoring: { ...this.oomMonitoring },
|
|
255
|
+
profilerTypes: this.profilers.map(p => p.type),
|
|
256
|
+
sourceMap: this.sourceMap,
|
|
257
|
+
timelineEnabled: this.timelineEnabled,
|
|
258
|
+
timelineSamplingEnabled: this.timelineSamplingEnabled,
|
|
259
|
+
uploadCompression: { ...this.uploadCompression },
|
|
260
|
+
v8ProfilerBugWorkaroundEnabled: this.v8ProfilerBugWorkaroundEnabled
|
|
261
|
+
}
|
|
262
|
+
delete report.oomMonitoring.exportCommand
|
|
263
|
+
return report
|
|
264
|
+
}
|
|
245
265
|
}
|
|
246
266
|
|
|
247
267
|
module.exports = { Config }
|
|
@@ -21,7 +21,7 @@ class EventSerializer {
|
|
|
21
21
|
return `${type}.pprof`
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
getEventJSON ({ profiles, start, end, tags = {}, endpointCounts }) {
|
|
24
|
+
getEventJSON ({ profiles, infos, start, end, tags = {}, endpointCounts }) {
|
|
25
25
|
return JSON.stringify({
|
|
26
26
|
attachments: Object.keys(profiles).map(t => this.typeToFile(t)),
|
|
27
27
|
start: start.toISOString(),
|
|
@@ -58,7 +58,8 @@ class EventSerializer {
|
|
|
58
58
|
ssi: {
|
|
59
59
|
mechanism: this._libraryInjected ? 'injected_agent' : 'none'
|
|
60
60
|
},
|
|
61
|
-
version
|
|
61
|
+
version,
|
|
62
|
+
...infos
|
|
62
63
|
},
|
|
63
64
|
runtime: {
|
|
64
65
|
available_processors: availableParallelism(),
|