Skip to content

Commit 440f73d

Browse files
rochdevjuan-fernandezuurien
authored andcommitted
add migration guide for 3.x to 4.x (#3137)
* add migration guide for 3.x to 4.x * Update MIGRATING.md Co-authored-by: Juan Antonio Fernández de Alba <[email protected]> * Update MIGRATING.md Co-authored-by: Juan Antonio Fernández de Alba <[email protected]> * Update README.md Co-authored-by: Ugaitz Urien <[email protected]> --------- Co-authored-by: Juan Antonio Fernández de Alba <[email protected]> Co-authored-by: Ugaitz Urien <[email protected]>
1 parent 4a427a2 commit 440f73d

File tree

2 files changed

+163
-0
lines changed

2 files changed

+163
-0
lines changed

MIGRATING.md

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,164 @@ This guide describes the steps to upgrade dd-trace from a major version to the
44
next. If you are having any issues related to migrating, please feel free to
55
open an issue or contact our [support](https://www.datadoghq.com/support/) team.
66

7+
## 3.0 to 4.0
8+
9+
### Node 14 is no longer supported
10+
11+
Node.js 14 has reached EOL in April 2023 and is no longer supported. Generally
12+
speaking, we highly recommend always keeping Node.js up to date regardless of
13+
our support policy.
14+
15+
### The `orphanable` option was removed
16+
17+
This option was only useful internally for a single integration that has since
18+
been removed. It was never useful for manual instrumentation since all that is
19+
needed to orphan a span on creation is to use
20+
`tracer.trace('web.request', { childOf: null })`.
21+
22+
### Support for `jest-jasmine2` has been removed
23+
24+
The default test runner for Jest was changed to `jest-circus` around 2 years ago and
25+
is no longer supported by our Jest integration for CI Visibility. We recommend
26+
switching to `jest-circus` to anyone still using `jest-jasmine2`.
27+
28+
### Support for older Next.js versions was removed
29+
30+
We now support only Next.js 10.2 and up.
31+
32+
### W3C headers are now prioritized over Datadog headers
33+
34+
As we move towards open standards, we have decided to prioritize W3C Trace
35+
Context headers over our own vendor-specific headers for context propagation
36+
across services. For most applications this shouldn't change anything and
37+
distributed tracing should continue to work seamlessly.
38+
39+
In some rare cases it's possible that some of the services involved in a trace
40+
are not instrumented by Datadog at all which can cause spans within the trace to
41+
become disconnected. While the data would still be available in the UI, the
42+
relationship between spans would no longer be visible. This can be addressed by
43+
restoring the previous behaviour using
44+
`DD_TRACE_PROPAGATION_STYLE='datadog,tracecontext'`.
45+
46+
## 2.0 to 3.0
47+
48+
### Node 12 is no longer supported
49+
50+
Node.js 12 has been EOL since April 2022 and is no longer supported. Generally
51+
speaking, we highly recommend always keeping Node.js up to date regardless of our
52+
support policy.
53+
54+
### HTTP query string reported by default
55+
56+
HTTP query strings are now reported by default as part of the `http.url` tag.
57+
This change is considered breaking only because there might be sensitive data
58+
in the query string. A default regular expression based obfuscator is provided
59+
for common use cases like API keys, but if your use case is not covered, the
60+
[DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP](https://datadoghq.dev/dd-trace-js/#tracer-settings)
61+
environment variable can be used to control what is obfuscated, and a value of
62+
`.*` would redact the query string entirely.
63+
64+
### HTTP operation name change
65+
66+
The HTTP integration now uses `web.request` for incoming requests and continues
67+
to use `http.request` for outgoing requests. When using a supported web
68+
framework like Express, this change will have no effect because the root span
69+
would already have an operation name override like `express.request`.
70+
Any [monitor](https://docs.datadoghq.com/monitors/create/types/apm/?tab=apmmetrics)
71+
on `http.request` for incoming requests should be updated to `web.request`.
72+
73+
With this change, both operation names also appear under the main service name
74+
and are no longer split between the server service name and a separate client
75+
service name suffixed with `-http-client`.
76+
77+
### gRPC operation name change
78+
79+
The gRPC integration now uses `grpc.server` for incoming requests and
80+
`grpc.client` for outgoing requests. Any
81+
[monitor](https://docs.datadoghq.com/monitors/create/types/apm/?tab=apmmetrics)
82+
on `grpc.request` should be updated to one of these.
83+
84+
With this change, both operation names also appear under the main service name
85+
and are no longer split between the server service name and a separate client
86+
service name suffixed with `-http-client`.
87+
88+
### Removal of `fs` integration
89+
90+
The `fs` integration was removed as it was originally added without an actual
91+
use case, and it's been problematic ever since. It's noisy, the output is
92+
confusing when using streams, errors that are handled higher in the stack end up
93+
being captured, etc.
94+
95+
If you had any use for file system instrumentation, please let us know so we can
96+
provide an alternative.
97+
98+
### Scope binding for promises and event emitters
99+
100+
It's no longer possible to bind promises using `tracer.scope().bind(promise)` or
101+
event emitters using `tracer.scope().bind(emitter)`. These were historically
102+
added mostly for internal use, and changes to context propagation over the years
103+
made them unnecessary, both internally and externaly. If one of these is used
104+
anywhere, the call will simply be ignored and no binding will occur.
105+
106+
To bind the `then` handler of a promise, bind the function directly directly:
107+
108+
```js
109+
promise.then(tracer.scope().bind(handler))
110+
```
111+
112+
To bind all listeners for an event, wrap the call to `emit` directly instead:
113+
114+
```js
115+
tracer.scope().activate(span, () => {
116+
emitter.emit('event')
117+
})
118+
```
119+
120+
To bind individual listeners, bind the listener function directly instead:
121+
122+
```js
123+
emitter.on('event', tracer.scope().bind(listener, span))
124+
```
125+
126+
### Removed APIs
127+
128+
The following APIs have been deprecated for a long time and have now been
129+
completely removed:
130+
131+
- `tracer.currentSpan()`
132+
- `tracer.bindEmitter()`
133+
134+
Since these have not been recommended nor publicly documented for years at this
135+
point, there should be no impact as no application is expected to be using them.
136+
137+
### CI Visibility new entrypoints
138+
139+
#### Cypress
140+
141+
`dd-trace/cypress/plugin` and `dd-trace/cypress/support` are removed, so you won't
142+
be able to use them for your `cypress` instrumentation. Use `dd-trace/ci/cypress/plugin`
143+
and `dd-trace/ci/cypress/support` instead for your plugin and support configuration
144+
respectively.
145+
146+
#### Jest
147+
148+
The use of `'dd-trace/ci/jest/env'` in [`testEnvironment`](https://jestjs.io/docs/configuration#testenvironment-string)
149+
is no longer supported.
150+
To instrument `jest` tests now, add `'-r dd-trace/ci/init'` to the `NODE_OPTIONS` environment
151+
variable passed to the process running the tests, for example, `NODE_OPTIONS='-r dd-trace/ci/init' yarn test`.
152+
153+
#### Mocha
154+
155+
The use of `--require dd-trace/ci/init` as a `mocha` flag is no longer supported.
156+
To instrument `mocha` tests now, add `'-r dd-trace/ci/init'` to the `NODE_OPTIONS` environment
157+
variable passed to the process running the tests, for example, `NODE_OPTIONS='-r dd-trace/ci/init' yarn test`.
158+
159+
#### Cucumber
160+
161+
The use of `--require-module dd-trace/ci/init` as a `cucumber-js` flag is no longer supported.
162+
To instrument `cucumber-js` tests now, add `'-r dd-trace/ci/init'` to the `NODE_OPTIONS` environment
163+
variable passed to the process running the tests, for example, `NODE_OPTIONS='-r dd-trace/ci/init' yarn test`.
164+
7165
## 1.0 to 2.0
8166

9167
### Configuration

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ $ yarn lint
153153

154154
### Experimental ESM Support
155155

156+
> **Warning**
157+
>
158+
> ESM support has been temporarily disabled starting from Node 20 as significant
159+
> changes are in progress.
160+
156161
ESM support is currently in the experimental stages, while CJS has been supported
157162
since inception. This means that code loaded using `require()` should work fine
158163
but code loaded using `import` might not always work.

0 commit comments

Comments
 (0)