dd-trace 5.103.0 → 5.104.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.
Files changed (90) hide show
  1. package/index.d.ts +25 -3
  2. package/package.json +4 -3
  3. package/packages/datadog-instrumentations/src/aws-sdk.js +2 -2
  4. package/packages/datadog-instrumentations/src/cassandra-driver.js +5 -2
  5. package/packages/datadog-instrumentations/src/cucumber.js +103 -30
  6. package/packages/datadog-instrumentations/src/elasticsearch.js +4 -4
  7. package/packages/datadog-instrumentations/src/graphql.js +0 -5
  8. package/packages/datadog-instrumentations/src/grpc/client.js +48 -32
  9. package/packages/datadog-instrumentations/src/helpers/callback-instrumentor.js +1 -1
  10. package/packages/datadog-instrumentations/src/helpers/kafka.js +17 -0
  11. package/packages/datadog-instrumentations/src/helpers/rewriter/compiler.js +3 -2
  12. package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +19 -5
  13. package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +14 -13
  14. package/packages/datadog-instrumentations/src/http/client.js +2 -2
  15. package/packages/datadog-instrumentations/src/ioredis.js +3 -3
  16. package/packages/datadog-instrumentations/src/jest.js +33 -36
  17. package/packages/datadog-instrumentations/src/kafkajs.js +25 -6
  18. package/packages/datadog-instrumentations/src/mariadb.js +1 -1
  19. package/packages/datadog-instrumentations/src/memcached.js +2 -1
  20. package/packages/datadog-instrumentations/src/mocha/main.js +272 -91
  21. package/packages/datadog-instrumentations/src/mocha/utils.js +48 -8
  22. package/packages/datadog-instrumentations/src/mongodb-core.js +1 -1
  23. package/packages/datadog-instrumentations/src/mongoose.js +10 -12
  24. package/packages/datadog-instrumentations/src/mysql.js +2 -2
  25. package/packages/datadog-instrumentations/src/mysql2.js +1 -1
  26. package/packages/datadog-instrumentations/src/pg.js +1 -1
  27. package/packages/datadog-instrumentations/src/playwright.js +22 -5
  28. package/packages/datadog-instrumentations/src/router.js +4 -2
  29. package/packages/datadog-instrumentations/src/vitest.js +246 -149
  30. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +26 -19
  31. package/packages/datadog-plugin-elasticsearch/src/index.js +28 -8
  32. package/packages/datadog-plugin-graphql/src/utils.js +4 -1
  33. package/packages/datadog-plugin-kafkajs/src/producer.js +32 -0
  34. package/packages/datadog-plugin-mongodb-core/src/index.js +54 -19
  35. package/packages/datadog-plugin-redis/src/index.js +37 -2
  36. package/packages/datadog-plugin-undici/src/index.js +19 -0
  37. package/packages/datadog-plugin-vitest/src/index.js +19 -7
  38. package/packages/datadog-shimmer/src/shimmer.js +35 -0
  39. package/packages/dd-trace/src/appsec/blocking.js +2 -2
  40. package/packages/dd-trace/src/appsec/index.js +10 -3
  41. package/packages/dd-trace/src/appsec/reporter.js +19 -5
  42. package/packages/dd-trace/src/ci-visibility/requests/request.js +3 -1
  43. package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +5 -3
  44. package/packages/dd-trace/src/config/generated-config-types.d.ts +1 -0
  45. package/packages/dd-trace/src/config/supported-configurations.json +9 -0
  46. package/packages/dd-trace/src/crashtracking/crashtracker.js +15 -3
  47. package/packages/dd-trace/src/datastreams/context.js +4 -2
  48. package/packages/dd-trace/src/encode/agentless-ci-visibility.js +26 -19
  49. package/packages/dd-trace/src/exporters/common/agents.js +3 -1
  50. package/packages/dd-trace/src/exporters/common/request.js +3 -1
  51. package/packages/dd-trace/src/id.js +17 -4
  52. package/packages/dd-trace/src/lambda/handler.js +2 -4
  53. package/packages/dd-trace/src/llmobs/sdk.js +10 -0
  54. package/packages/dd-trace/src/log/writer.js +3 -1
  55. package/packages/dd-trace/src/noop/span.js +3 -1
  56. package/packages/dd-trace/src/openfeature/writers/exposures.js +51 -20
  57. package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +1 -1
  58. package/packages/dd-trace/src/plugins/apollo.js +3 -1
  59. package/packages/dd-trace/src/plugins/ci_plugin.js +3 -13
  60. package/packages/dd-trace/src/plugins/log_plugin.js +3 -1
  61. package/packages/dd-trace/src/plugins/tracing.js +5 -3
  62. package/packages/dd-trace/src/plugins/util/git.js +3 -1
  63. package/packages/dd-trace/src/plugins/util/test.js +82 -0
  64. package/packages/dd-trace/src/plugins/util/web.js +11 -0
  65. package/packages/dd-trace/src/scope.js +7 -5
  66. package/packages/dd-trace/src/service-naming/extra-services.js +14 -0
  67. package/vendor/dist/opentracing/LICENSE +0 -201
  68. package/vendor/dist/opentracing/binary_carrier.d.ts +0 -11
  69. package/vendor/dist/opentracing/constants.d.ts +0 -61
  70. package/vendor/dist/opentracing/examples/demo/demo.d.ts +0 -2
  71. package/vendor/dist/opentracing/ext/tags.d.ts +0 -90
  72. package/vendor/dist/opentracing/functions.d.ts +0 -20
  73. package/vendor/dist/opentracing/global_tracer.d.ts +0 -14
  74. package/vendor/dist/opentracing/index.d.ts +0 -12
  75. package/vendor/dist/opentracing/index.js +0 -1
  76. package/vendor/dist/opentracing/mock_tracer/index.d.ts +0 -5
  77. package/vendor/dist/opentracing/mock_tracer/mock_context.d.ts +0 -13
  78. package/vendor/dist/opentracing/mock_tracer/mock_report.d.ts +0 -16
  79. package/vendor/dist/opentracing/mock_tracer/mock_span.d.ts +0 -50
  80. package/vendor/dist/opentracing/mock_tracer/mock_tracer.d.ts +0 -26
  81. package/vendor/dist/opentracing/noop.d.ts +0 -8
  82. package/vendor/dist/opentracing/reference.d.ts +0 -33
  83. package/vendor/dist/opentracing/span.d.ts +0 -147
  84. package/vendor/dist/opentracing/span_context.d.ts +0 -26
  85. package/vendor/dist/opentracing/test/api_compatibility.d.ts +0 -16
  86. package/vendor/dist/opentracing/test/mocktracer_implemenation.d.ts +0 -3
  87. package/vendor/dist/opentracing/test/noop_implementation.d.ts +0 -4
  88. package/vendor/dist/opentracing/test/opentracing_api.d.ts +0 -3
  89. package/vendor/dist/opentracing/test/unittest.d.ts +0 -2
  90. package/vendor/dist/opentracing/tracer.d.ts +0 -127
@@ -1,33 +0,0 @@
1
- import Span from './span';
2
- import SpanContext from './span_context';
3
- /**
4
- * Reference pairs a reference type constant (e.g., REFERENCE_CHILD_OF or
5
- * REFERENCE_FOLLOWS_FROM) with the SpanContext it points to.
6
- *
7
- * See the exported childOf() and followsFrom() functions at the package level.
8
- */
9
- export default class Reference {
10
- protected _type: string;
11
- protected _referencedContext: SpanContext;
12
- /**
13
- * @return {string} The Reference type (e.g., REFERENCE_CHILD_OF or
14
- * REFERENCE_FOLLOWS_FROM).
15
- */
16
- type(): string;
17
- /**
18
- * @return {SpanContext} The SpanContext being referred to (e.g., the
19
- * parent in a REFERENCE_CHILD_OF Reference).
20
- */
21
- referencedContext(): SpanContext;
22
- /**
23
- * Initialize a new Reference instance.
24
- *
25
- * @param {string} type - the Reference type constant (e.g.,
26
- * REFERENCE_CHILD_OF or REFERENCE_FOLLOWS_FROM).
27
- * @param {SpanContext} referencedContext - the SpanContext being referred
28
- * to. As a convenience, a Span instance may be passed in instead
29
- * (in which case its .context() is used here).
30
- */
31
- constructor(type: string, referencedContext: SpanContext | Span);
32
- }
33
- //# sourceMappingURL=reference.d.ts.map
@@ -1,147 +0,0 @@
1
- import SpanContext from './span_context';
2
- import Tracer from './tracer';
3
- /**
4
- * Span represents a logical unit of work as part of a broader Trace. Examples
5
- * of span might include remote procedure calls or a in-process function calls
6
- * to sub-components. A Trace has a single, top-level "root" Span that in turn
7
- * may have zero or more child Spans, which in turn may have children.
8
- */
9
- export declare class Span {
10
- /**
11
- * Returns the SpanContext object associated with this Span.
12
- *
13
- * @return {SpanContext}
14
- */
15
- context(): SpanContext;
16
- /**
17
- * Returns the Tracer object used to create this Span.
18
- *
19
- * @return {Tracer}
20
- */
21
- tracer(): Tracer;
22
- /**
23
- * Sets the string name for the logical operation this span represents.
24
- *
25
- * @param {string} name
26
- */
27
- setOperationName(name: string): this;
28
- /**
29
- * Sets a key:value pair on this Span that also propagates to future
30
- * children of the associated Span.
31
- *
32
- * setBaggageItem() enables powerful functionality given a full-stack
33
- * opentracing integration (e.g., arbitrary application data from a web
34
- * client can make it, transparently, all the way into the depths of a
35
- * storage system), and with it some powerful costs: use this feature with
36
- * care.
37
- *
38
- * IMPORTANT NOTE #1: setBaggageItem() will only propagate baggage items to
39
- * *future* causal descendants of the associated Span.
40
- *
41
- * IMPORTANT NOTE #2: Use this thoughtfully and with care. Every key and
42
- * value is copied into every local *and remote* child of the associated
43
- * Span, and that can add up to a lot of network and cpu overhead.
44
- *
45
- * @param {string} key
46
- * @param {string} value
47
- */
48
- setBaggageItem(key: string, value: string): this;
49
- /**
50
- * Returns the value for a baggage item given its key.
51
- *
52
- * @param {string} key
53
- * The key for the given trace attribute.
54
- * @return {string}
55
- * String value for the given key, or undefined if the key does not
56
- * correspond to a set trace attribute.
57
- */
58
- getBaggageItem(key: string): string | undefined;
59
- /**
60
- * Adds a single tag to the span. See `addTags()` for details.
61
- *
62
- * @param {string} key
63
- * @param {any} value
64
- */
65
- setTag(key: string, value: any): this;
66
- /**
67
- * Adds the given key value pairs to the set of span tags.
68
- *
69
- * Multiple calls to addTags() results in the tags being the superset of
70
- * all calls.
71
- *
72
- * The behavior of setting the same key multiple times on the same span
73
- * is undefined.
74
- *
75
- * The supported type of the values is implementation-dependent.
76
- * Implementations are expected to safely handle all types of values but
77
- * may choose to ignore unrecognized / unhandle-able values (e.g. objects
78
- * with cyclic references, function objects).
79
- *
80
- * @return {[type]} [description]
81
- */
82
- addTags(keyValueMap: {
83
- [key: string]: any;
84
- }): this;
85
- /**
86
- * Add a log record to this Span, optionally at a user-provided timestamp.
87
- *
88
- * For example:
89
- *
90
- * span.log({
91
- * size: rpc.size(), // numeric value
92
- * URI: rpc.URI(), // string value
93
- * payload: rpc.payload(), // Object value
94
- * "keys can be arbitrary strings": rpc.foo(),
95
- * });
96
- *
97
- * span.log({
98
- * "error.description": someError.description(),
99
- * }, someError.timestampMillis());
100
- *
101
- * @param {object} keyValuePairs
102
- * An object mapping string keys to arbitrary value types. All
103
- * Tracer implementations should support bool, string, and numeric
104
- * value types, and some may also support Object values.
105
- * @param {number} timestamp
106
- * An optional parameter specifying the timestamp in milliseconds
107
- * since the Unix epoch. Fractional values are allowed so that
108
- * timestamps with sub-millisecond accuracy can be represented. If
109
- * not specified, the implementation is expected to use its notion
110
- * of the current time of the call.
111
- */
112
- log(keyValuePairs: {
113
- [key: string]: any;
114
- }, timestamp?: number): this;
115
- /**
116
- * DEPRECATED
117
- */
118
- logEvent(eventName: string, payload: any): void;
119
- /**
120
- * Sets the end timestamp and finalizes Span state.
121
- *
122
- * With the exception of calls to Span.context() (which are always allowed),
123
- * finish() must be the last call made to any span instance, and to do
124
- * otherwise leads to undefined behavior.
125
- *
126
- * @param {number} finishTime
127
- * Optional finish time in milliseconds as a Unix timestamp. Decimal
128
- * values are supported for timestamps with sub-millisecond accuracy.
129
- * If not specified, the current time (as defined by the
130
- * implementation) will be used.
131
- */
132
- finish(finishTime?: number): void;
133
- protected _context(): SpanContext;
134
- protected _tracer(): Tracer;
135
- protected _setOperationName(name: string): void;
136
- protected _setBaggageItem(key: string, value: string): void;
137
- protected _getBaggageItem(key: string): string | undefined;
138
- protected _addTags(keyValuePairs: {
139
- [key: string]: any;
140
- }): void;
141
- protected _log(keyValuePairs: {
142
- [key: string]: any;
143
- }, timestamp?: number): void;
144
- protected _finish(finishTime?: number): void;
145
- }
146
- export default Span;
147
- //# sourceMappingURL=span.d.ts.map
@@ -1,26 +0,0 @@
1
- /**
2
- * SpanContext represents Span state that must propagate to descendant Spans
3
- * and across process boundaries.
4
- *
5
- * SpanContext is logically divided into two pieces: the user-level "Baggage"
6
- * (see setBaggageItem and getBaggageItem) that propagates across Span
7
- * boundaries and any Tracer-implementation-specific fields that are needed to
8
- * identify or otherwise contextualize the associated Span instance (e.g., a
9
- * <trace_id, span_id, sampled> tuple).
10
- */
11
- export declare class SpanContext {
12
- /**
13
- * Returns a string representation of the implementation internal trace ID.
14
- *
15
- * @returns {string}
16
- */
17
- toTraceId(): string;
18
- /**
19
- * Returns a string representation of the implementation internal span ID.
20
- *
21
- * @returns {string}
22
- */
23
- toSpanId(): string;
24
- }
25
- export default SpanContext;
26
- //# sourceMappingURL=span_context.d.ts.map
@@ -1,16 +0,0 @@
1
- import { Tracer } from '../index';
2
- export interface ApiCompatibilityChecksOptions {
3
- /** a boolean that controls whether or not to verify certain API functionality */
4
- skipBaggageChecks?: boolean;
5
- skipInjectExtractChecks?: boolean;
6
- }
7
- /**
8
- * A function that takes a tracer factory, and tests wheter the initialized tracer
9
- * fulfills Opentracing's api requirements.
10
- *
11
- * @param {object} createTracer - a factory function that allocates a tracer.
12
- * @param {object} [options] - the options to be set on api compatibility
13
- */
14
- declare function apiCompatibilityChecks(createTracer?: () => Tracer, options?: ApiCompatibilityChecksOptions): void;
15
- export default apiCompatibilityChecks;
16
- //# sourceMappingURL=api_compatibility.d.ts.map
@@ -1,3 +0,0 @@
1
- declare function mockTracerimplementationTests(): void;
2
- export default mockTracerimplementationTests;
3
- //# sourceMappingURL=mocktracer_implemenation.d.ts.map
@@ -1,4 +0,0 @@
1
- import { Tracer } from '../index';
2
- export declare function noopImplementationTests(createTracer?: () => Tracer): void;
3
- export default noopImplementationTests;
4
- //# sourceMappingURL=noop_implementation.d.ts.map
@@ -1,3 +0,0 @@
1
- export declare function opentracingAPITests(): void;
2
- export default opentracingAPITests;
3
- //# sourceMappingURL=opentracing_api.d.ts.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=unittest.d.ts.map
@@ -1,127 +0,0 @@
1
- import Reference from './reference';
2
- import Span from './span';
3
- import SpanContext from './span_context';
4
- export interface SpanOptions {
5
- /**
6
- * a parent SpanContext (or Span, for convenience) that the newly-started
7
- * span will be the child of (per REFERENCE_CHILD_OF). If specified,
8
- * `references` must be unspecified.
9
- */
10
- childOf?: Span | SpanContext;
11
- /**
12
- * an array of Reference instances, each pointing to a causal parent
13
- * SpanContext. If specified, `fields.childOf` must be unspecified.
14
- */
15
- references?: Reference[];
16
- /**
17
- * set of key-value pairs which will be set as tags on the newly created
18
- * Span. Ownership of the object is passed to the created span for
19
- * efficiency reasons (the caller should not modify this object after
20
- * calling startSpan).
21
- */
22
- tags?: {
23
- [key: string]: any;
24
- };
25
- /**
26
- * a manually specified start time for the created Span object. The time
27
- * should be specified in milliseconds as Unix timestamp. Decimal value are
28
- * supported to represent time values with sub-millisecond accuracy.
29
- */
30
- startTime?: number;
31
- }
32
- /**
33
- * Tracer is the entry-point between the instrumentation API and the tracing
34
- * implementation.
35
- *
36
- * The default object acts as a no-op implementation.
37
- *
38
- * Note to implementators: derived classes can choose to directly implement the
39
- * methods in the "OpenTracing API methods" section, or optionally the subset of
40
- * underscore-prefixed methods to pick up the argument checking and handling
41
- * automatically from the base class.
42
- */
43
- export declare class Tracer {
44
- /**
45
- * Starts and returns a new Span representing a logical unit of work.
46
- *
47
- * For example:
48
- *
49
- * // Start a new (parentless) root Span:
50
- * var parent = Tracer.startSpan('DoWork');
51
- *
52
- * // Start a new (child) Span:
53
- * var child = Tracer.startSpan('load-from-db', {
54
- * childOf: parent.context(),
55
- * });
56
- *
57
- * // Start a new async (FollowsFrom) Span:
58
- * var child = Tracer.startSpan('async-cache-write', {
59
- * references: [
60
- * opentracing.followsFrom(parent.context())
61
- * ],
62
- * });
63
- *
64
- * @param {string} name - the name of the operation (REQUIRED).
65
- * @param {SpanOptions} [options] - options for the newly created span.
66
- * @return {Span} - a new Span object.
67
- */
68
- startSpan(name: string, options?: SpanOptions): Span;
69
- /**
70
- * Injects the given SpanContext instance for cross-process propagation
71
- * within `carrier`. The expected type of `carrier` depends on the value of
72
- * `format.
73
- *
74
- * OpenTracing defines a common set of `format` values (see
75
- * FORMAT_TEXT_MAP, FORMAT_HTTP_HEADERS, and FORMAT_BINARY), and each has
76
- * an expected carrier type.
77
- *
78
- * Consider this pseudocode example:
79
- *
80
- * var clientSpan = ...;
81
- * ...
82
- * // Inject clientSpan into a text carrier.
83
- * var headersCarrier = {};
84
- * Tracer.inject(clientSpan.context(), Tracer.FORMAT_HTTP_HEADERS, headersCarrier);
85
- * // Incorporate the textCarrier into the outbound HTTP request header
86
- * // map.
87
- * Object.assign(outboundHTTPReq.headers, headersCarrier);
88
- * // ... send the httpReq
89
- *
90
- * @param {SpanContext} spanContext - the SpanContext to inject into the
91
- * carrier object. As a convenience, a Span instance may be passed
92
- * in instead (in which case its .context() is used for the
93
- * inject()).
94
- * @param {string} format - the format of the carrier.
95
- * @param {any} carrier - see the documentation for the chosen `format`
96
- * for a description of the carrier object.
97
- */
98
- inject(spanContext: SpanContext | Span, format: string, carrier: any): void;
99
- /**
100
- * Returns a SpanContext instance extracted from `carrier` in the given
101
- * `format`.
102
- *
103
- * OpenTracing defines a common set of `format` values (see
104
- * FORMAT_TEXT_MAP, FORMAT_HTTP_HEADERS, and FORMAT_BINARY), and each has
105
- * an expected carrier type.
106
- *
107
- * Consider this pseudocode example:
108
- *
109
- * // Use the inbound HTTP request's headers as a text map carrier.
110
- * var headersCarrier = inboundHTTPReq.headers;
111
- * var wireCtx = Tracer.extract(Tracer.FORMAT_HTTP_HEADERS, headersCarrier);
112
- * var serverSpan = Tracer.startSpan('...', { childOf : wireCtx });
113
- *
114
- * @param {string} format - the format of the carrier.
115
- * @param {any} carrier - the type of the carrier object is determined by
116
- * the format.
117
- * @return {SpanContext}
118
- * The extracted SpanContext, or null if no such SpanContext could
119
- * be found in `carrier`
120
- */
121
- extract(format: string, carrier: any): SpanContext | null;
122
- protected _startSpan(name: string, fields: SpanOptions): Span;
123
- protected _inject(spanContext: SpanContext, format: string, carrier: any): void;
124
- protected _extract(format: string, carrier: any): SpanContext | null;
125
- }
126
- export default Tracer;
127
- //# sourceMappingURL=tracer.d.ts.map