dd-trace 5.4.0 → 5.6.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/CONTRIBUTING.md +98 -0
- package/README.md +8 -99
- package/ci/cypress/after-run.js +1 -0
- package/ci/cypress/after-spec.js +1 -0
- package/index.d.ts +1498 -1488
- package/package.json +3 -3
- package/packages/datadog-core/src/utils/src/get.js +11 -0
- package/packages/datadog-core/src/utils/src/has.js +14 -0
- package/packages/datadog-core/src/utils/src/set.js +16 -0
- package/packages/datadog-instrumentations/src/amqplib.js +1 -1
- package/packages/datadog-instrumentations/src/cucumber.js +157 -42
- package/packages/datadog-instrumentations/src/grpc/server.js +3 -1
- package/packages/datadog-instrumentations/src/jest.js +80 -40
- package/packages/datadog-instrumentations/src/mocha.js +4 -1
- package/packages/datadog-instrumentations/src/mongodb-core.js +34 -3
- package/packages/datadog-instrumentations/src/playwright.js +78 -16
- package/packages/datadog-plugin-amqplib/src/consumer.js +8 -4
- package/packages/datadog-plugin-amqplib/src/producer.js +3 -4
- package/packages/datadog-plugin-aws-sdk/src/base.js +3 -2
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +60 -57
- package/packages/datadog-plugin-aws-sdk/src/services/sns.js +42 -22
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +64 -30
- package/packages/datadog-plugin-cucumber/src/index.js +25 -9
- package/packages/datadog-plugin-cypress/src/after-run.js +3 -0
- package/packages/datadog-plugin-cypress/src/after-spec.js +3 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +625 -0
- package/packages/datadog-plugin-cypress/src/plugin.js +6 -549
- package/packages/datadog-plugin-cypress/src/support.js +50 -3
- package/packages/datadog-plugin-graphql/src/index.js +1 -1
- package/packages/datadog-plugin-graphql/src/resolve.js +10 -8
- package/packages/datadog-plugin-grpc/src/util.js +1 -1
- package/packages/datadog-plugin-jest/src/index.js +11 -2
- package/packages/datadog-plugin-kafkajs/src/consumer.js +4 -3
- package/packages/datadog-plugin-kafkajs/src/producer.js +3 -5
- package/packages/datadog-plugin-playwright/src/index.js +34 -3
- package/packages/datadog-plugin-rhea/src/consumer.js +8 -3
- package/packages/datadog-plugin-rhea/src/producer.js +3 -4
- package/packages/dd-trace/src/appsec/iast/index.js +10 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +18 -5
- package/packages/dd-trace/src/appsec/recommended.json +67 -27
- package/packages/dd-trace/src/appsec/remote_config/index.js +1 -1
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +1 -3
- package/packages/dd-trace/src/config.js +451 -459
- package/packages/dd-trace/src/data_streams_context.js +1 -1
- package/packages/dd-trace/src/datastreams/pathway.js +58 -1
- package/packages/dd-trace/src/datastreams/processor.js +3 -5
- package/packages/dd-trace/src/format.js +0 -1
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +2 -2
- package/packages/dd-trace/src/opentracing/span.js +4 -4
- package/packages/dd-trace/src/plugins/util/test.js +2 -0
- package/packages/dd-trace/src/plugins/util/web.js +1 -1
- package/packages/dd-trace/src/profiling/exporters/agent.js +77 -32
- package/packages/dd-trace/src/telemetry/index.js +22 -34
- package/packages/dd-trace/src/tracer.js +3 -3
- package/register.js +4 -0
- /package/packages/{utils → datadog-core/src/utils}/src/kebabcase.js +0 -0
- /package/packages/{utils → datadog-core/src/utils}/src/pick.js +0 -0
- /package/packages/{utils → datadog-core/src/utils}/src/uniq.js +0 -0
package/CONTRIBUTING.md
CHANGED
|
@@ -70,4 +70,102 @@ We follow an all-green policy which means that for any PR to be merged _all_ tes
|
|
|
70
70
|
|
|
71
71
|
Eventually we plan to look into putting these permission-required tests behind a label which team members can add to their PRs at creation to run the full CI and can add to outside contributor PRs to trigger the CI from their own user credentials. If the label is not present there will be another action which checks the label is present. Rather than showing a bunch of confusing failures to new contributors it would just show a single job failure which indicates an additional label is required, and we can name it in a way that makes it clear that it's not the responsibility of the outside contributor to add it. Something like `approve-full-ci` is one possible choice there.
|
|
72
72
|
|
|
73
|
+
## Development Requirements
|
|
74
|
+
|
|
75
|
+
Since this project supports multiple Node versions, using a version
|
|
76
|
+
manager such as [nvm](https://github.com/creationix/nvm) is recommended.
|
|
77
|
+
|
|
78
|
+
We use [yarn](https://yarnpkg.com/) for its workspace functionality, so make sure to install that as well.
|
|
79
|
+
|
|
80
|
+
To install dependencies once you have Node and yarn installed, run:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
$ yarn
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
## Testing
|
|
88
|
+
|
|
89
|
+
Before running _plugin_ tests, the data stores need to be running.
|
|
90
|
+
The easiest way to start all of them is to use the provided
|
|
91
|
+
docker-compose configuration:
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
$ docker-compose up -d -V --remove-orphans --force-recreate
|
|
95
|
+
$ yarn services
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
> **Note**
|
|
99
|
+
> The `couchbase`, `grpc` and `oracledb` instrumentations rely on native modules
|
|
100
|
+
> that do not compile on ARM64 devices (for example M1/M2 Mac) - their tests
|
|
101
|
+
> cannot be run locally on these devices.
|
|
102
|
+
|
|
103
|
+
### Unit Tests
|
|
104
|
+
|
|
105
|
+
There are several types of unit tests, for various types of components. The
|
|
106
|
+
following commands may be useful:
|
|
107
|
+
|
|
108
|
+
```sh
|
|
109
|
+
# Tracer core tests (i.e. testing `packages/dd-trace`)
|
|
110
|
+
$ yarn test:trace:core
|
|
111
|
+
# "Core" library tests (i.e. testing `packages/datadog-core`
|
|
112
|
+
$ yarn test:core
|
|
113
|
+
# Instrumentations tests (i.e. testing `packages/datadog-instrumentations`
|
|
114
|
+
$ yarn test:instrumentations
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Several other components have test commands as well. See `package.json` for
|
|
118
|
+
details.
|
|
119
|
+
|
|
120
|
+
To test _plugins_ (i.e. components in `packages/datadog-plugin-XXXX`
|
|
121
|
+
directories, set the `PLUGINS` environment variable to the plugin you're
|
|
122
|
+
interested in, and use `yarn test:plugins`. If you need to test multiple
|
|
123
|
+
plugins you may separate then with a pipe (`|`) delimiter. Here's an
|
|
124
|
+
example testing the `express` and `bluebird` plugins:
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
PLUGINS="express|bluebird" yarn test:plugins
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
### Memory Leaks
|
|
132
|
+
|
|
133
|
+
To run the memory leak tests, use:
|
|
134
|
+
|
|
135
|
+
```sh
|
|
136
|
+
$ yarn leak:core
|
|
137
|
+
|
|
138
|
+
# or
|
|
139
|
+
|
|
140
|
+
$ yarn leak:plugins
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
### Linting
|
|
145
|
+
|
|
146
|
+
We use [ESLint](https://eslint.org) to make sure that new code
|
|
147
|
+
conforms to our coding standards.
|
|
148
|
+
|
|
149
|
+
To run the linter, use:
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
$ yarn lint
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
### Benchmarks
|
|
157
|
+
|
|
158
|
+
Our microbenchmarks live in `benchmark/sirun`. Each directory in there
|
|
159
|
+
corresponds to a specific benchmark test and its variants, which are used to
|
|
160
|
+
track regressions and improvements over time.
|
|
161
|
+
|
|
162
|
+
In addition to those, when two or more approaches must be compared, please write
|
|
163
|
+
a benchmark in the `benchmark/index.js` module so that we can keep track of the
|
|
164
|
+
most efficient algorithm. To run your benchmark, use:
|
|
165
|
+
|
|
166
|
+
```sh
|
|
167
|
+
$ yarn bench
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
|
|
73
171
|
[1]: https://docs.datadoghq.com/help
|
package/README.md
CHANGED
|
@@ -62,95 +62,12 @@ For more information about library versioning and compatibility, see the [NodeJS
|
|
|
62
62
|
Changes associated with each individual release are documented on the [GitHub Releases](https://github.com/DataDog/dd-trace-js/releases) screen.
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
## Development
|
|
65
|
+
## Development and Contribution
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
Please read the [CONTRIBUTING.md](https://github.com/DataDog/dd-trace-js/blob/master/CONTRIBUTING.md) document before contributing to this open source project.
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
##
|
|
71
|
-
|
|
72
|
-
Since this project supports multiple Node versions, using a version
|
|
73
|
-
manager such as [nvm](https://github.com/creationix/nvm) is recommended.
|
|
74
|
-
|
|
75
|
-
We use [yarn](https://yarnpkg.com/) for its workspace functionality, so make sure to install that as well.
|
|
76
|
-
|
|
77
|
-
To install dependencies once you have Node and yarn installed, run:
|
|
78
|
-
|
|
79
|
-
```sh
|
|
80
|
-
$ yarn
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
## Testing
|
|
85
|
-
|
|
86
|
-
Before running _plugin_ tests, the data stores need to be running.
|
|
87
|
-
The easiest way to start all of them is to use the provided
|
|
88
|
-
docker-compose configuration:
|
|
89
|
-
|
|
90
|
-
```sh
|
|
91
|
-
$ docker-compose up -d -V --remove-orphans --force-recreate
|
|
92
|
-
$ yarn services
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
> **Note**
|
|
96
|
-
> The `couchbase`, `grpc` and `oracledb` instrumentations rely on native modules
|
|
97
|
-
> that do not compile on ARM64 devices (for example M1/M2 Mac) - their tests
|
|
98
|
-
> cannot be run locally on these devices.
|
|
99
|
-
|
|
100
|
-
### Unit Tests
|
|
101
|
-
|
|
102
|
-
There are several types of unit tests, for various types of components. The
|
|
103
|
-
following commands may be useful:
|
|
104
|
-
|
|
105
|
-
```sh
|
|
106
|
-
# Tracer core tests (i.e. testing `packages/dd-trace`)
|
|
107
|
-
$ yarn test:trace:core
|
|
108
|
-
# "Core" library tests (i.e. testing `packages/datadog-core`
|
|
109
|
-
$ yarn test:core
|
|
110
|
-
# Instrumentations tests (i.e. testing `packages/datadog-instrumentations`
|
|
111
|
-
$ yarn test:instrumentations
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
Several other components have test commands as well. See `package.json` for
|
|
115
|
-
details.
|
|
116
|
-
|
|
117
|
-
To test _plugins_ (i.e. components in `packages/datadog-plugin-XXXX`
|
|
118
|
-
directories, set the `PLUGINS` environment variable to the plugin you're
|
|
119
|
-
interested in, and use `yarn test:plugins`. If you need to test multiple
|
|
120
|
-
plugins you may separate then with a pipe (`|`) delimiter. Here's an
|
|
121
|
-
example testing the `express` and `bluebird` plugins:
|
|
122
|
-
|
|
123
|
-
```sh
|
|
124
|
-
PLUGINS="express|bluebird" yarn test:plugins
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
### Memory Leaks
|
|
129
|
-
|
|
130
|
-
To run the memory leak tests, use:
|
|
131
|
-
|
|
132
|
-
```sh
|
|
133
|
-
$ yarn leak:core
|
|
134
|
-
|
|
135
|
-
# or
|
|
136
|
-
|
|
137
|
-
$ yarn leak:plugins
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
### Linting
|
|
142
|
-
|
|
143
|
-
We use [ESLint](https://eslint.org) to make sure that new code
|
|
144
|
-
conforms to our coding standards.
|
|
145
|
-
|
|
146
|
-
To run the linter, use:
|
|
147
|
-
|
|
148
|
-
```sh
|
|
149
|
-
$ yarn lint
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
### Experimental ESM Support
|
|
70
|
+
## Experimental ESM Support
|
|
154
71
|
|
|
155
72
|
> **Warning**
|
|
156
73
|
>
|
|
@@ -163,26 +80,18 @@ but code loaded using `import` might not always work.
|
|
|
163
80
|
|
|
164
81
|
Use the following command to enable experimental ESM support with your application:
|
|
165
82
|
|
|
83
|
+
Node.js < v20.6
|
|
84
|
+
|
|
166
85
|
```sh
|
|
167
86
|
node --loader dd-trace/loader-hook.mjs entrypoint.js
|
|
168
87
|
```
|
|
169
88
|
|
|
170
|
-
|
|
171
|
-
### Benchmarks
|
|
172
|
-
|
|
173
|
-
Our microbenchmarks live in `benchmark/sirun`. Each directory in there
|
|
174
|
-
corresponds to a specific benchmark test and its variants, which are used to
|
|
175
|
-
track regressions and improvements over time.
|
|
176
|
-
|
|
177
|
-
In addition to those, when two or more approaches must be compared, please write
|
|
178
|
-
a benchmark in the `benchmark/index.js` module so that we can keep track of the
|
|
179
|
-
most efficient algorithm. To run your benchmark, use:
|
|
89
|
+
Node.js >= v20.6
|
|
180
90
|
|
|
181
91
|
```sh
|
|
182
|
-
|
|
92
|
+
node --import dd-trace/register.js entrypoint.js
|
|
183
93
|
```
|
|
184
94
|
|
|
185
|
-
|
|
186
95
|
## Serverless / Lambda
|
|
187
96
|
|
|
188
97
|
Note that there is a separate Lambda project, [datadog-lambda-js](https://github.com/DataDog/datadog-lambda-js), that is responsible for enabling metrics and distributed tracing when your application runs on Lambda.
|
|
@@ -199,4 +108,4 @@ If you would like to trace your bundled application then please read this page o
|
|
|
199
108
|
|
|
200
109
|
## Security Vulnerabilities
|
|
201
110
|
|
|
202
|
-
|
|
111
|
+
Please refer to the [SECURITY.md](https://github.com/DataDog/dd-trace-js/blob/master/SECURITY.md) document if you have found a security issue.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../../packages/datadog-plugin-cypress/src/after-run')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../../packages/datadog-plugin-cypress/src/after-spec')
|