dd-trace 5.96.0 → 5.98.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/index.d.ts +60 -2
- package/package.json +9 -7
- package/packages/datadog-esbuild/index.js +20 -9
- package/packages/datadog-instrumentations/src/child_process.js +7 -17
- package/packages/datadog-instrumentations/src/crypto.js +1 -2
- package/packages/datadog-instrumentations/src/cucumber.js +69 -4
- package/packages/datadog-instrumentations/src/cypress-config.js +318 -0
- package/packages/datadog-instrumentations/src/cypress.js +86 -4
- package/packages/datadog-instrumentations/src/dns.js +1 -2
- package/packages/datadog-instrumentations/src/express.js +4 -4
- package/packages/datadog-instrumentations/src/fs.js +27 -29
- package/packages/datadog-instrumentations/src/graphql.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/bundler-register.js +41 -13
- package/packages/datadog-instrumentations/src/helpers/hook.js +31 -6
- package/packages/datadog-instrumentations/src/helpers/hooks.js +12 -19
- package/packages/datadog-instrumentations/src/helpers/instrument.js +27 -13
- package/packages/datadog-instrumentations/src/helpers/register.js +103 -142
- package/packages/datadog-instrumentations/src/http/client.js +2 -3
- package/packages/datadog-instrumentations/src/http/server.js +2 -5
- package/packages/datadog-instrumentations/src/http2/client.js +1 -3
- package/packages/datadog-instrumentations/src/http2/server.js +1 -3
- package/packages/datadog-instrumentations/src/jest.js +117 -16
- package/packages/datadog-instrumentations/src/limitd-client.js +1 -1
- package/packages/datadog-instrumentations/src/mocha/utils.js +12 -1
- package/packages/datadog-instrumentations/src/net.js +2 -8
- package/packages/datadog-instrumentations/src/pino.js +1 -1
- package/packages/datadog-instrumentations/src/playwright.js +4 -1
- package/packages/datadog-instrumentations/src/prisma.js +1 -2
- package/packages/datadog-instrumentations/src/redis.js +12 -6
- package/packages/datadog-instrumentations/src/selenium.js +4 -1
- package/packages/datadog-instrumentations/src/sequelize.js +1 -1
- package/packages/datadog-instrumentations/src/url.js +1 -3
- package/packages/datadog-instrumentations/src/vitest.js +5 -1
- package/packages/datadog-instrumentations/src/vm.js +1 -3
- package/packages/datadog-plugin-aws-sdk/src/base.js +5 -4
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +1 -0
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +1 -0
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +1 -0
- package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +1 -0
- package/packages/datadog-plugin-aws-sdk/src/services/sns.js +1 -0
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +1 -0
- package/packages/datadog-plugin-cucumber/src/index.js +13 -3
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +166 -6
- package/packages/datadog-plugin-cypress/src/index.js +59 -2
- package/packages/datadog-plugin-fs/src/index.js +1 -1
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +2 -1
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +2 -7
- package/packages/datadog-plugin-graphql/src/resolve.js +1 -1
- package/packages/datadog-plugin-http/src/client.js +1 -1
- package/packages/datadog-plugin-http/src/server.js +10 -2
- package/packages/datadog-plugin-http2/src/client.js +1 -1
- package/packages/datadog-plugin-http2/src/server.js +10 -2
- package/packages/datadog-plugin-jest/src/index.js +4 -2
- package/packages/datadog-plugin-kafkajs/src/batch-consumer.js +31 -4
- package/packages/datadog-plugin-mocha/src/index.js +5 -2
- package/packages/datadog-plugin-mongodb-core/src/index.js +3 -3
- package/packages/datadog-plugin-mysql/src/index.js +1 -1
- package/packages/datadog-plugin-next/src/index.js +10 -16
- package/packages/datadog-plugin-openai/src/services.js +1 -0
- package/packages/datadog-plugin-pg/src/index.js +1 -1
- package/packages/datadog-plugin-tedious/src/index.js +1 -1
- package/packages/datadog-plugin-ws/src/close.js +1 -1
- package/packages/datadog-plugin-ws/src/receiver.js +1 -1
- package/packages/datadog-webpack/index.js +3 -3
- package/packages/dd-trace/index.js +12 -10
- package/packages/dd-trace/src/agent/url.js +2 -2
- package/packages/dd-trace/src/aiguard/sdk.js +26 -22
- package/packages/dd-trace/src/appsec/blocked_templates.js +4 -3
- package/packages/dd-trace/src/appsec/blocking.js +64 -33
- package/packages/dd-trace/src/appsec/iast/iast-plugin.js +1 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +1 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +1 -1
- package/packages/dd-trace/src/appsec/remote_config.js +1 -0
- package/packages/dd-trace/src/appsec/sdk/index.js +4 -0
- package/packages/dd-trace/src/appsec/sdk/set_user.js +1 -1
- package/packages/dd-trace/src/appsec/sdk/track_event.js +5 -5
- package/packages/dd-trace/src/appsec/sdk/user_blocking.js +2 -2
- package/packages/dd-trace/src/appsec/sdk/utils.js +4 -2
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +6 -1
- package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +4 -0
- package/packages/dd-trace/src/config/defaults.js +315 -146
- package/packages/dd-trace/src/config/generated-config-types.d.ts +9 -1
- package/packages/dd-trace/src/config/helper.js +59 -10
- package/packages/dd-trace/src/config/index.js +587 -1496
- package/packages/dd-trace/src/config/parsers.js +256 -0
- package/packages/dd-trace/src/config/remote_config.js +59 -2
- package/packages/dd-trace/src/config/supported-configurations.json +406 -432
- package/packages/dd-trace/src/constants.js +1 -0
- package/packages/dd-trace/src/crashtracking/crashtracker.js +7 -1
- package/packages/dd-trace/src/crashtracking/index.js +1 -7
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +5 -2
- package/packages/dd-trace/src/debugger/index.js +1 -1
- package/packages/dd-trace/src/dogstatsd.js +12 -9
- package/packages/dd-trace/src/encode/0.4.js +8 -7
- package/packages/dd-trace/src/encode/span-stats.js +4 -1
- package/packages/dd-trace/src/exporters/agent/writer.js +7 -1
- package/packages/dd-trace/src/exporters/common/request.js +9 -0
- package/packages/dd-trace/src/exporters/common/writer.js +12 -2
- package/packages/dd-trace/src/heap_snapshots.js +3 -0
- package/packages/dd-trace/src/index.js +5 -2
- package/packages/dd-trace/src/lambda/runtime/ritm.js +6 -6
- package/packages/dd-trace/src/llmobs/index.js +4 -1
- package/packages/dd-trace/src/llmobs/plugins/ai/index.js +5 -1
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +60 -12
- package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +4 -2
- package/packages/dd-trace/src/llmobs/sdk.js +12 -8
- package/packages/dd-trace/src/llmobs/span_processor.js +1 -1
- package/packages/dd-trace/src/llmobs/tagger.js +9 -6
- package/packages/dd-trace/src/llmobs/writers/base.js +2 -0
- package/packages/dd-trace/src/llmobs/writers/util.js +3 -0
- package/packages/dd-trace/src/log/index.js +20 -59
- package/packages/dd-trace/src/log/writer.js +7 -19
- package/packages/dd-trace/src/noop/proxy.js +8 -0
- package/packages/dd-trace/src/openfeature/remote_config.js +6 -1
- package/packages/dd-trace/src/opentelemetry/context_manager.js +6 -4
- package/packages/dd-trace/src/opentelemetry/logs/index.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +1 -1
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +17 -2
- package/packages/dd-trace/src/opentelemetry/otlp/protobuf_loader.js +14 -2
- package/packages/dd-trace/src/opentelemetry/otlp/trace.proto +358 -0
- package/packages/dd-trace/src/opentelemetry/otlp/trace_service.proto +78 -0
- package/packages/dd-trace/src/opentelemetry/trace/index.js +75 -0
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +66 -0
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +332 -0
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +9 -4
- package/packages/dd-trace/src/opentracing/tracer.js +9 -4
- package/packages/dd-trace/src/payload-tagging/config/index.js +6 -5
- package/packages/dd-trace/src/plugin_manager.js +8 -6
- package/packages/dd-trace/src/plugins/ci_plugin.js +4 -0
- package/packages/dd-trace/src/plugins/log_plugin.js +3 -0
- package/packages/dd-trace/src/plugins/plugin.js +11 -13
- package/packages/dd-trace/src/plugins/storage.js +2 -2
- package/packages/dd-trace/src/plugins/tracing.js +22 -5
- package/packages/dd-trace/src/plugins/util/test.js +2 -0
- package/packages/dd-trace/src/plugins/util/web.js +6 -88
- package/packages/dd-trace/src/process-tags/index.js +3 -0
- package/packages/dd-trace/src/profiler.js +27 -2
- package/packages/dd-trace/src/profiling/config.js +73 -241
- package/packages/dd-trace/src/profiling/exporter_cli.js +1 -4
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +6 -2
- package/packages/dd-trace/src/profiling/profiler.js +78 -109
- package/packages/dd-trace/src/profiling/profilers/events.js +2 -3
- package/packages/dd-trace/src/profiling/profilers/wall.js +89 -6
- package/packages/dd-trace/src/profiling/ssi-heuristics.js +4 -1
- package/packages/dd-trace/src/propagation-hash/index.js +2 -1
- package/packages/dd-trace/src/proxy.js +40 -6
- package/packages/dd-trace/src/remote_config/index.js +3 -0
- package/packages/dd-trace/src/require-package-json.js +8 -4
- package/packages/dd-trace/src/ritm.js +58 -26
- package/packages/dd-trace/src/runtime_metrics/index.js +3 -0
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +18 -11
- package/packages/dd-trace/src/sampler.js +1 -1
- package/packages/dd-trace/src/service-naming/index.js +1 -1
- package/packages/dd-trace/src/service-naming/schemas/definition.js +4 -1
- package/packages/dd-trace/src/service-naming/schemas/util.js +15 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +24 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +60 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/web.js +17 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/websocket.js +5 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +17 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/web.js +11 -1
- package/packages/dd-trace/src/service-naming/schemas/v1/websocket.js +6 -0
- package/packages/dd-trace/src/span_stats.js +5 -1
- package/packages/dd-trace/src/standalone/index.js +3 -0
- package/packages/dd-trace/src/telemetry/index.js +2 -3
- package/packages/dd-trace/src/telemetry/send-data.js +5 -19
- package/packages/dd-trace/src/telemetry/session-propagation.js +19 -44
- package/packages/dd-trace/src/telemetry/telemetry.js +28 -171
- package/packages/dd-trace/src/tracer.js +2 -2
- package/packages/dd-trace/src/util.js +0 -9
- package/vendor/dist/@apm-js-collab/code-transformer/index.js +28 -6
- package/vendor/dist/protobufjs/index.js +1 -1
- package/packages/dd-trace/src/log/utils.js +0 -16
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
// Vendored from: https://github.com/open-telemetry/opentelemetry-proto/blob/v1.7.0/opentelemetry/proto/trace/v1/trace.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.trace.v1;
|
|
19
|
+
|
|
20
|
+
import "common.proto";
|
|
21
|
+
import "resource.proto";
|
|
22
|
+
|
|
23
|
+
option csharp_namespace = "OpenTelemetry.Proto.Trace.V1";
|
|
24
|
+
option java_multiple_files = true;
|
|
25
|
+
option java_package = "io.opentelemetry.proto.trace.v1";
|
|
26
|
+
option java_outer_classname = "TraceProto";
|
|
27
|
+
option go_package = "go.opentelemetry.io/proto/otlp/trace/v1";
|
|
28
|
+
|
|
29
|
+
// TracesData represents the traces data that can be stored in a persistent storage,
|
|
30
|
+
// OR can be embedded by other protocols that transfer OTLP traces data but do
|
|
31
|
+
// not implement the OTLP protocol.
|
|
32
|
+
//
|
|
33
|
+
// The main difference between this message and collector protocol is that
|
|
34
|
+
// in this message there will not be any "control" or "metadata" specific to
|
|
35
|
+
// OTLP protocol.
|
|
36
|
+
//
|
|
37
|
+
// When new fields are added into this message, the OTLP request MUST be updated
|
|
38
|
+
// as well.
|
|
39
|
+
message TracesData {
|
|
40
|
+
// An array of ResourceSpans.
|
|
41
|
+
// For data coming from a single resource this array will typically contain
|
|
42
|
+
// one element. Intermediary nodes that receive data from multiple origins
|
|
43
|
+
// typically batch the data before forwarding further and in that case this
|
|
44
|
+
// array will contain multiple elements.
|
|
45
|
+
repeated ResourceSpans resource_spans = 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// A collection of ScopeSpans from a Resource.
|
|
49
|
+
message ResourceSpans {
|
|
50
|
+
reserved 1000;
|
|
51
|
+
|
|
52
|
+
// The resource for the spans in this message.
|
|
53
|
+
// If this field is not set then no resource info is known.
|
|
54
|
+
opentelemetry.proto.resource.v1.Resource resource = 1;
|
|
55
|
+
|
|
56
|
+
// A list of ScopeSpans that originate from a resource.
|
|
57
|
+
repeated ScopeSpans scope_spans = 2;
|
|
58
|
+
|
|
59
|
+
// The Schema URL, if known. This is the identifier of the Schema that the resource data
|
|
60
|
+
// is recorded in. Notably, the last part of the URL path is the version number of the
|
|
61
|
+
// schema: http[s]://server[:port]/path/<version>. To learn more about Schema URL see
|
|
62
|
+
// https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
|
|
63
|
+
// This schema_url applies to the data in the "resource" field. It does not apply
|
|
64
|
+
// to the data in the "scope_spans" field which have their own schema_url field.
|
|
65
|
+
string schema_url = 3;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// A collection of Spans produced by an InstrumentationScope.
|
|
69
|
+
message ScopeSpans {
|
|
70
|
+
// The instrumentation scope information for the spans in this message.
|
|
71
|
+
// Semantically when InstrumentationScope isn't set, it is equivalent with
|
|
72
|
+
// an empty instrumentation scope name (unknown).
|
|
73
|
+
opentelemetry.proto.common.v1.InstrumentationScope scope = 1;
|
|
74
|
+
|
|
75
|
+
// A list of Spans that originate from an instrumentation scope.
|
|
76
|
+
repeated Span spans = 2;
|
|
77
|
+
|
|
78
|
+
// The Schema URL, if known. This is the identifier of the Schema that the span data
|
|
79
|
+
// is recorded in. Notably, the last part of the URL path is the version number of the
|
|
80
|
+
// schema: http[s]://server[:port]/path/<version>. To learn more about Schema URL see
|
|
81
|
+
// https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
|
|
82
|
+
// This schema_url applies to all spans and span events in the "spans" field.
|
|
83
|
+
string schema_url = 3;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// A Span represents a single operation performed by a single component of the system.
|
|
87
|
+
//
|
|
88
|
+
// The next available field id is 17.
|
|
89
|
+
message Span {
|
|
90
|
+
// A unique identifier for a trace. All spans from the same trace share
|
|
91
|
+
// the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes OR
|
|
92
|
+
// of length other than 16 bytes is considered invalid (empty string in OTLP/JSON
|
|
93
|
+
// is zero-length and thus is also invalid).
|
|
94
|
+
//
|
|
95
|
+
// This field is required.
|
|
96
|
+
bytes trace_id = 1;
|
|
97
|
+
|
|
98
|
+
// A unique identifier for a span within a trace, assigned when the span
|
|
99
|
+
// is created. The ID is an 8-byte array. An ID with all zeroes OR of length
|
|
100
|
+
// other than 8 bytes is considered invalid (empty string in OTLP/JSON
|
|
101
|
+
// is zero-length and thus is also invalid).
|
|
102
|
+
//
|
|
103
|
+
// This field is required.
|
|
104
|
+
bytes span_id = 2;
|
|
105
|
+
|
|
106
|
+
// trace_state conveys information about request position in multiple distributed tracing graphs.
|
|
107
|
+
// It is a trace_state in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header
|
|
108
|
+
// See also https://github.com/w3c/distributed-tracing for more details about this field.
|
|
109
|
+
string trace_state = 3;
|
|
110
|
+
|
|
111
|
+
// The `span_id` of this span's parent span. If this is a root span, then this
|
|
112
|
+
// field must be empty. The ID is an 8-byte array.
|
|
113
|
+
bytes parent_span_id = 4;
|
|
114
|
+
|
|
115
|
+
// Flags, a bit field.
|
|
116
|
+
//
|
|
117
|
+
// Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace
|
|
118
|
+
// Context specification. To read the 8-bit W3C trace flag, use
|
|
119
|
+
// `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
|
|
120
|
+
//
|
|
121
|
+
// See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
|
|
122
|
+
//
|
|
123
|
+
// Bits 8 and 9 represent the 3 states of whether a span's parent
|
|
124
|
+
// is remote. The states are (unknown, is not remote, is remote).
|
|
125
|
+
// To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`.
|
|
126
|
+
// To read whether the span is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`.
|
|
127
|
+
//
|
|
128
|
+
// When creating span messages, if the message is logically forwarded from another source
|
|
129
|
+
// with an equivalent flags fields (i.e., usually another OTLP span message), the field SHOULD
|
|
130
|
+
// be copied as-is. If creating from a source that does not have an equivalent flags field
|
|
131
|
+
// (such as a runtime representation of an OpenTelemetry span), the high 22 bits MUST
|
|
132
|
+
// be set to zero.
|
|
133
|
+
// Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.
|
|
134
|
+
//
|
|
135
|
+
// [Optional].
|
|
136
|
+
fixed32 flags = 16;
|
|
137
|
+
|
|
138
|
+
// A description of the span's operation.
|
|
139
|
+
//
|
|
140
|
+
// For example, the name can be a qualified method name or a file name
|
|
141
|
+
// and a line number where the operation is called. A best practice is to use
|
|
142
|
+
// the same display name at the same call point in an application.
|
|
143
|
+
// This makes it easier to correlate spans in different traces.
|
|
144
|
+
//
|
|
145
|
+
// This field is semantically required to be set to non-empty string.
|
|
146
|
+
// Empty value is equivalent to an unknown span name.
|
|
147
|
+
//
|
|
148
|
+
// This field is required.
|
|
149
|
+
string name = 5;
|
|
150
|
+
|
|
151
|
+
// SpanKind is the type of span. Can be used to specify additional relationships between spans
|
|
152
|
+
// in addition to a parent/child relationship.
|
|
153
|
+
enum SpanKind {
|
|
154
|
+
// Unspecified. Do NOT use as default.
|
|
155
|
+
// Implementations MAY assume SpanKind to be INTERNAL when receiving UNSPECIFIED.
|
|
156
|
+
SPAN_KIND_UNSPECIFIED = 0;
|
|
157
|
+
|
|
158
|
+
// Indicates that the span represents an internal operation within an application,
|
|
159
|
+
// as opposed to an operation happening at the boundaries. Default value.
|
|
160
|
+
SPAN_KIND_INTERNAL = 1;
|
|
161
|
+
|
|
162
|
+
// Indicates that the span covers server-side handling of an RPC or other
|
|
163
|
+
// remote network request.
|
|
164
|
+
SPAN_KIND_SERVER = 2;
|
|
165
|
+
|
|
166
|
+
// Indicates that the span describes a request to some remote service.
|
|
167
|
+
SPAN_KIND_CLIENT = 3;
|
|
168
|
+
|
|
169
|
+
// Indicates that the span describes a producer sending a message to a broker.
|
|
170
|
+
// Unlike CLIENT and SERVER, there is often no direct critical path latency relationship
|
|
171
|
+
// between producer and consumer spans. A PRODUCER span ends when the message was accepted
|
|
172
|
+
// by the broker while the logical processing of the message might span a much longer time.
|
|
173
|
+
SPAN_KIND_PRODUCER = 4;
|
|
174
|
+
|
|
175
|
+
// Indicates that the span describes consumer receiving a message from a broker.
|
|
176
|
+
// Like the PRODUCER kind, there is often no direct critical path latency relationship
|
|
177
|
+
// between producer and consumer spans.
|
|
178
|
+
SPAN_KIND_CONSUMER = 5;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Distinguishes between spans generated in a particular context. For example,
|
|
182
|
+
// two spans with the same name may be distinguished using `CLIENT` (caller)
|
|
183
|
+
// and `SERVER` (callee) to identify queueing latency associated with the span.
|
|
184
|
+
SpanKind kind = 6;
|
|
185
|
+
|
|
186
|
+
// start_time_unix_nano is the start time of the span. On the client side, this is the time
|
|
187
|
+
// kept by the local machine where the span execution starts. On the server side, this
|
|
188
|
+
// is the time when the server's application handler starts running.
|
|
189
|
+
// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
|
|
190
|
+
//
|
|
191
|
+
// This field is semantically required and it is expected that end_time >= start_time.
|
|
192
|
+
fixed64 start_time_unix_nano = 7;
|
|
193
|
+
|
|
194
|
+
// end_time_unix_nano is the end time of the span. On the client side, this is the time
|
|
195
|
+
// kept by the local machine where the span execution ends. On the server side, this
|
|
196
|
+
// is the time when the server application handler stops running.
|
|
197
|
+
// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
|
|
198
|
+
//
|
|
199
|
+
// This field is semantically required and it is expected that end_time >= start_time.
|
|
200
|
+
fixed64 end_time_unix_nano = 8;
|
|
201
|
+
|
|
202
|
+
// attributes is a collection of key/value pairs. Note, global attributes
|
|
203
|
+
// like server name can be set using the resource API. Examples of attributes:
|
|
204
|
+
//
|
|
205
|
+
// "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
|
|
206
|
+
// "/http/server_latency": 300
|
|
207
|
+
// "example.com/myattribute": true
|
|
208
|
+
// "example.com/score": 10.239
|
|
209
|
+
//
|
|
210
|
+
// The OpenTelemetry API specification further restricts the allowed value types:
|
|
211
|
+
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute
|
|
212
|
+
// Attribute keys MUST be unique (it is not allowed to have more than one
|
|
213
|
+
// attribute with the same key).
|
|
214
|
+
repeated opentelemetry.proto.common.v1.KeyValue attributes = 9;
|
|
215
|
+
|
|
216
|
+
// dropped_attributes_count is the number of attributes that were discarded. Attributes
|
|
217
|
+
// can be discarded because their keys are too long or because there are too many
|
|
218
|
+
// attributes. If this value is 0, then no attributes were dropped.
|
|
219
|
+
uint32 dropped_attributes_count = 10;
|
|
220
|
+
|
|
221
|
+
// Event is a time-stamped annotation of the span, consisting of user-supplied
|
|
222
|
+
// text description and key-value pairs.
|
|
223
|
+
message Event {
|
|
224
|
+
// time_unix_nano is the time the event occurred.
|
|
225
|
+
fixed64 time_unix_nano = 1;
|
|
226
|
+
|
|
227
|
+
// name of the event.
|
|
228
|
+
// This field is semantically required to be set to non-empty string.
|
|
229
|
+
string name = 2;
|
|
230
|
+
|
|
231
|
+
// attributes is a collection of attribute key/value pairs on the event.
|
|
232
|
+
// Attribute keys MUST be unique (it is not allowed to have more than one
|
|
233
|
+
// attribute with the same key).
|
|
234
|
+
repeated opentelemetry.proto.common.v1.KeyValue attributes = 3;
|
|
235
|
+
|
|
236
|
+
// dropped_attributes_count is the number of dropped attributes. If the value is 0,
|
|
237
|
+
// then no attributes were dropped.
|
|
238
|
+
uint32 dropped_attributes_count = 4;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// events is a collection of Event items.
|
|
242
|
+
repeated Event events = 11;
|
|
243
|
+
|
|
244
|
+
// dropped_events_count is the number of dropped events. If the value is 0, then no
|
|
245
|
+
// events were dropped.
|
|
246
|
+
uint32 dropped_events_count = 12;
|
|
247
|
+
|
|
248
|
+
// A pointer from the current span to another span in the same trace or in a
|
|
249
|
+
// different trace. For example, this can be used in batching operations,
|
|
250
|
+
// where a single batch handler processes multiple requests from different
|
|
251
|
+
// traces or when the handler receives a request from a different project.
|
|
252
|
+
message Link {
|
|
253
|
+
// A unique identifier of a trace that this linked span is part of. The ID is a
|
|
254
|
+
// 16-byte array.
|
|
255
|
+
bytes trace_id = 1;
|
|
256
|
+
|
|
257
|
+
// A unique identifier for the linked span. The ID is an 8-byte array.
|
|
258
|
+
bytes span_id = 2;
|
|
259
|
+
|
|
260
|
+
// The trace_state associated with the link.
|
|
261
|
+
string trace_state = 3;
|
|
262
|
+
|
|
263
|
+
// attributes is a collection of attribute key/value pairs on the link.
|
|
264
|
+
// Attribute keys MUST be unique (it is not allowed to have more than one
|
|
265
|
+
// attribute with the same key).
|
|
266
|
+
repeated opentelemetry.proto.common.v1.KeyValue attributes = 4;
|
|
267
|
+
|
|
268
|
+
// dropped_attributes_count is the number of dropped attributes. If the value is 0,
|
|
269
|
+
// then no attributes were dropped.
|
|
270
|
+
uint32 dropped_attributes_count = 5;
|
|
271
|
+
|
|
272
|
+
// Flags, a bit field.
|
|
273
|
+
//
|
|
274
|
+
// Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace
|
|
275
|
+
// Context specification. To read the 8-bit W3C trace flag, use
|
|
276
|
+
// `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
|
|
277
|
+
//
|
|
278
|
+
// See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
|
|
279
|
+
//
|
|
280
|
+
// Bits 8 and 9 represent the 3 states of whether the link is remote.
|
|
281
|
+
// The states are (unknown, is not remote, is remote).
|
|
282
|
+
// To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`.
|
|
283
|
+
// To read whether the link is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`.
|
|
284
|
+
//
|
|
285
|
+
// Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.
|
|
286
|
+
// When creating new spans, bits 10-31 (most-significant 22-bits) MUST be zero.
|
|
287
|
+
//
|
|
288
|
+
// [Optional].
|
|
289
|
+
fixed32 flags = 6;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// links is a collection of Links, which are references from this span to a span
|
|
293
|
+
// in the same or different trace.
|
|
294
|
+
repeated Link links = 13;
|
|
295
|
+
|
|
296
|
+
// dropped_links_count is the number of dropped links after the maximum size was
|
|
297
|
+
// enforced. If this value is 0, then no links were dropped.
|
|
298
|
+
uint32 dropped_links_count = 14;
|
|
299
|
+
|
|
300
|
+
// An optional final status for this span. Semantically when Status isn't set, it means
|
|
301
|
+
// span's status code is unset, i.e. assume STATUS_CODE_UNSET (code = 0).
|
|
302
|
+
Status status = 15;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// The Status type defines a logical error model that is suitable for different
|
|
306
|
+
// programming environments, including REST APIs and RPC APIs.
|
|
307
|
+
message Status {
|
|
308
|
+
reserved 1;
|
|
309
|
+
|
|
310
|
+
// A developer-facing human readable error message.
|
|
311
|
+
string message = 2;
|
|
312
|
+
|
|
313
|
+
// For the semantics of status codes see
|
|
314
|
+
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status
|
|
315
|
+
enum StatusCode {
|
|
316
|
+
// The default status.
|
|
317
|
+
STATUS_CODE_UNSET = 0;
|
|
318
|
+
// The Span has been validated by an Application developer or Operator to
|
|
319
|
+
// have completed successfully.
|
|
320
|
+
STATUS_CODE_OK = 1;
|
|
321
|
+
// The Span contains an error.
|
|
322
|
+
STATUS_CODE_ERROR = 2;
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
// The status code.
|
|
326
|
+
StatusCode code = 3;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// SpanFlags represents constants used to interpret the
|
|
330
|
+
// Span.flags field, which is protobuf 'fixed32' type and is to
|
|
331
|
+
// be used as bit-fields. Each non-zero value defined in this enum is
|
|
332
|
+
// a bit-mask. To extract the bit-field, for example, use an
|
|
333
|
+
// expression like:
|
|
334
|
+
//
|
|
335
|
+
// (span.flags & SPAN_FLAGS_TRACE_FLAGS_MASK)
|
|
336
|
+
//
|
|
337
|
+
// See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
|
|
338
|
+
//
|
|
339
|
+
// Note that Span flags were introduced in version 1.1 of the
|
|
340
|
+
// OpenTelemetry protocol. Older Span producers do not set this
|
|
341
|
+
// field, consequently consumers should not rely on the absence of a
|
|
342
|
+
// particular flag bit to indicate the presence of a particular feature.
|
|
343
|
+
enum SpanFlags {
|
|
344
|
+
// The zero value for the enum. Should not be used for comparisons.
|
|
345
|
+
// Instead use bitwise "and" with the appropriate mask as shown above.
|
|
346
|
+
SPAN_FLAGS_DO_NOT_USE = 0;
|
|
347
|
+
|
|
348
|
+
// Bits 0-7 are used for trace flags.
|
|
349
|
+
SPAN_FLAGS_TRACE_FLAGS_MASK = 0x000000FF;
|
|
350
|
+
|
|
351
|
+
// Bits 8 and 9 are used to indicate that the parent span or link span is remote.
|
|
352
|
+
// Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known.
|
|
353
|
+
// Bit 9 (`IS_REMOTE`) indicates whether the span or link is remote.
|
|
354
|
+
SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = 0x00000100;
|
|
355
|
+
SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 0x00000200;
|
|
356
|
+
|
|
357
|
+
// Bits 10-31 are reserved for future use.
|
|
358
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Vendored from: https://github.com/open-telemetry/opentelemetry-proto/blob/v1.7.0/opentelemetry/proto/collector/trace/v1/trace_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.trace.v1;
|
|
19
|
+
|
|
20
|
+
import "trace.proto";
|
|
21
|
+
|
|
22
|
+
option csharp_namespace = "OpenTelemetry.Proto.Collector.Trace.V1";
|
|
23
|
+
option java_multiple_files = true;
|
|
24
|
+
option java_package = "io.opentelemetry.proto.collector.trace.v1";
|
|
25
|
+
option java_outer_classname = "TraceServiceProto";
|
|
26
|
+
option go_package = "go.opentelemetry.io/proto/otlp/collector/trace/v1";
|
|
27
|
+
|
|
28
|
+
// Service that can be used to push spans between one Application instrumented with
|
|
29
|
+
// OpenTelemetry and a collector, or between a collector and a central collector (in this
|
|
30
|
+
// case spans are sent/received to/from multiple Applications).
|
|
31
|
+
service TraceService {
|
|
32
|
+
rpc Export(ExportTraceServiceRequest) returns (ExportTraceServiceResponse) {}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
message ExportTraceServiceRequest {
|
|
36
|
+
// An array of ResourceSpans.
|
|
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.trace.v1.ResourceSpans resource_spans = 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
message ExportTraceServiceResponse {
|
|
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
|
+
ExportTracePartialSuccess partial_success = 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
message ExportTracePartialSuccess {
|
|
64
|
+
// The number of rejected spans.
|
|
65
|
+
//
|
|
66
|
+
// A `rejected_<signal>` field holding a `0` value indicates that the
|
|
67
|
+
// request was fully accepted.
|
|
68
|
+
int64 rejected_spans = 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,75 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { VERSION } = require('../../../../../version')
|
|
4
|
+
const OtlpHttpTraceExporter = require('./otlp_http_trace_exporter')
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {import('../../config')} Config
|
|
8
|
+
* @typedef {import('../../opentracing/tracer')} DatadogTracer
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* OpenTelemetry Trace Export for dd-trace-js
|
|
13
|
+
*
|
|
14
|
+
* This module provides OTLP trace export support that integrates with
|
|
15
|
+
* the existing Datadog tracing pipeline. When enabled, the OTLP exporter
|
|
16
|
+
* replaces the default Datadog Agent exporter at tracer initialization time.
|
|
17
|
+
*
|
|
18
|
+
* Key Components:
|
|
19
|
+
* - OtlpHttpTraceExporter: Exports spans via OTLP over HTTP/JSON (port 4318)
|
|
20
|
+
* - OtlpTraceTransformer: Transforms DD-formatted spans to OTLP JSON format
|
|
21
|
+
*
|
|
22
|
+
* When enabled, traces are exported exclusively via OTLP. The original
|
|
23
|
+
* Datadog Agent exporter is replaced.
|
|
24
|
+
*
|
|
25
|
+
* @package
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Builds resource attributes from the tracer configuration.
|
|
30
|
+
*
|
|
31
|
+
* @param {Config} config - Tracer configuration instance
|
|
32
|
+
* @returns {import('@opentelemetry/api').Attributes} Resource attributes
|
|
33
|
+
*/
|
|
34
|
+
function buildResourceAttributes (config) {
|
|
35
|
+
const resourceAttributes = {
|
|
36
|
+
'service.name': config.service || config.tags.service,
|
|
37
|
+
'telemetry.sdk.name': 'datadog',
|
|
38
|
+
'telemetry.sdk.version': VERSION,
|
|
39
|
+
'telemetry.sdk.language': 'nodejs',
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const env = config.env || config.tags.env
|
|
43
|
+
if (env) resourceAttributes['deployment.environment'] = env
|
|
44
|
+
const version = config.version || config.tags.version
|
|
45
|
+
if (version) resourceAttributes['service.version'] = version
|
|
46
|
+
|
|
47
|
+
if (config.tags) {
|
|
48
|
+
const { service, version, env, ...filteredTags } = config.tags
|
|
49
|
+
Object.assign(resourceAttributes, filteredTags)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return resourceAttributes
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Creates the OTLP HTTP/JSON trace exporter.
|
|
57
|
+
*
|
|
58
|
+
* @param {Config} config - Tracer configuration instance
|
|
59
|
+
* @param {import('@opentelemetry/api').Attributes} resourceAttributes - Resource attributes
|
|
60
|
+
* @returns {OtlpHttpTraceExporter} The OTLP HTTP/JSON exporter
|
|
61
|
+
*/
|
|
62
|
+
function createOtlpTraceExporter (config, resourceAttributes) {
|
|
63
|
+
return new OtlpHttpTraceExporter(
|
|
64
|
+
config.otelTracesUrl,
|
|
65
|
+
config.otelTracesHeaders,
|
|
66
|
+
config.otelTracesTimeout,
|
|
67
|
+
resourceAttributes
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
module.exports = {
|
|
72
|
+
OtlpHttpTraceExporter,
|
|
73
|
+
buildResourceAttributes,
|
|
74
|
+
createOtlpTraceExporter,
|
|
75
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const OtlpHttpExporterBase = require('../otlp/otlp_http_exporter_base')
|
|
4
|
+
const { SAMPLING_PRIORITY_KEY } = require('../../constants')
|
|
5
|
+
const { AUTO_KEEP } = require('../../../../../ext/priority')
|
|
6
|
+
const OtlpTraceTransformer = require('./otlp_transformer')
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* OtlpHttpTraceExporter exports DD-formatted spans via OTLP over HTTP/JSON.
|
|
10
|
+
*
|
|
11
|
+
* This implementation follows the OTLP HTTP v1.7.0 specification:
|
|
12
|
+
* https://opentelemetry.io/docs/specs/otlp/#otlphttp
|
|
13
|
+
*
|
|
14
|
+
* It receives DD-formatted spans (from span_format.js), transforms them
|
|
15
|
+
* to OTLP ExportTraceServiceRequest JSON format, and sends them to the
|
|
16
|
+
* configured OTLP endpoint via HTTP POST.
|
|
17
|
+
*
|
|
18
|
+
* @class OtlpHttpTraceExporter
|
|
19
|
+
* @augments OtlpHttpExporterBase
|
|
20
|
+
*/
|
|
21
|
+
class OtlpHttpTraceExporter extends OtlpHttpExporterBase {
|
|
22
|
+
#transformer
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new OtlpHttpTraceExporter instance.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} url - OTLP endpoint URL
|
|
28
|
+
* @param {string} headers - Additional HTTP headers as comma-separated key=value string
|
|
29
|
+
* @param {number} timeout - Request timeout in milliseconds
|
|
30
|
+
* @param {import('@opentelemetry/api').Attributes} resourceAttributes - Resource attributes
|
|
31
|
+
*/
|
|
32
|
+
constructor (url, headers, timeout, resourceAttributes) {
|
|
33
|
+
super(url, headers, timeout, 'http/json', '/v1/traces', 'traces')
|
|
34
|
+
this.#transformer = new OtlpTraceTransformer(resourceAttributes)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Exports DD-formatted spans via OTLP over HTTP.
|
|
39
|
+
*
|
|
40
|
+
* @param {import('./otlp_transformer').DDFormattedSpan[]} spans - Array of DD-formatted spans to export
|
|
41
|
+
* @returns {void}
|
|
42
|
+
*/
|
|
43
|
+
export (spans) {
|
|
44
|
+
if (spans.length === 0) {
|
|
45
|
+
return
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Drop unsampled traces — OTLP endpoints have no agent-side sampling.
|
|
49
|
+
const priority = spans[0]?.metrics?.[SAMPLING_PRIORITY_KEY]
|
|
50
|
+
if (priority !== undefined && priority < AUTO_KEEP) {
|
|
51
|
+
return
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const additionalTags = [`spans:${spans.length}`]
|
|
55
|
+
this.recordTelemetry('otel.traces_export_attempts', 1, additionalTags)
|
|
56
|
+
|
|
57
|
+
const payload = this.#transformer.transformSpans(spans)
|
|
58
|
+
this.sendPayload(payload, (result) => {
|
|
59
|
+
if (result.code === 0) {
|
|
60
|
+
this.recordTelemetry('otel.traces_export_successes', 1, additionalTags)
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
module.exports = OtlpHttpTraceExporter
|