|
| 1 | +[[upgrade-to-v2]] |
| 2 | + |
| 3 | +ifdef::env-github[] |
| 4 | +NOTE: For the best reading experience, |
| 5 | +please view this documentation at https://www.elastic.co/guide/en/apm/agent/nodejs/current/upgrade-to-v2.html[elastic.co] |
| 6 | +endif::[] |
| 7 | + |
| 8 | +=== Upgrade to v2.x |
| 9 | + |
| 10 | +The following is a guide on upgrading your Node.js agent from version 1.x to version 2.x. |
| 11 | + |
| 12 | +[[v2-overview]] |
| 13 | +==== Overview |
| 14 | + |
| 15 | +Version 2.0.0 of the Node.js agent requires version 6.5 of the APM Server or higher and makes use of the new HTTP intake API. |
| 16 | + |
| 17 | +The new agent supports Node.js 6, 8, and 10+. |
| 18 | + |
| 19 | +The format of the error ID's have changed from a UUID4 to a hex formatted random 128 bit number. |
| 20 | +Likewise, |
| 21 | +the format of the transaction ID's have changed from a UUID4 to a hex formatted random 64 bit number. |
| 22 | + |
| 23 | +[[v2-config-options]] |
| 24 | +==== Config options |
| 25 | + |
| 26 | +[[v2-configuration-order]] |
| 27 | +===== Configuration order |
| 28 | + |
| 29 | +The Node.js agent can be configured using a combination of inline config options, |
| 30 | +environment variables, |
| 31 | +and a config file. |
| 32 | +Many config options also have default values. |
| 33 | +The order in which all these are applied have changed in 2.0.0. |
| 34 | + |
| 35 | +In 1.x the order in which config options overruled each other was (higher overwrite lower): |
| 36 | + |
| 37 | +- Inline options given to <<apm-start,`.start()`>> |
| 38 | +- <<agent-configuration-file,Agent config file>> |
| 39 | +- Environment variables |
| 40 | +- Default values |
| 41 | + |
| 42 | +The new order in 2.0.0 is as follows (higher overwrite lower): |
| 43 | + |
| 44 | +- Environment variables |
| 45 | +- Inline options given to <<apm-start,`.start()`>> |
| 46 | +- <<agent-configuration-file,Agent config file>> |
| 47 | +- Default values |
| 48 | + |
| 49 | +[[v2-changed-units]] |
| 50 | +===== Changed units |
| 51 | + |
| 52 | +In 1.x, |
| 53 | +the config option <<aborted-error-threshold,`abortedErrorThreshold`>> expected a millisecond value. |
| 54 | +In 2.0.0 the default time unit is seconds. |
| 55 | +If you'd like to keep using milliseconds, |
| 56 | +you need to specify the unit, |
| 57 | +e.g: `1500ms`. |
| 58 | + |
| 59 | +In 1.x, |
| 60 | +all boolean config options could be configured using the strings `on`, |
| 61 | +`yes`, |
| 62 | +`1` etc to mean `true` with similar values representing `false`. |
| 63 | +In 2.0.0 this has been restricted, |
| 64 | +and only the strings `true` and `false` will be interpreted as the boolean equivalent. |
| 65 | + |
| 66 | +[[v2-removed-config-options]] |
| 67 | +===== Removed config options |
| 68 | + |
| 69 | +The following config options have been removed in version 2.0.0: |
| 70 | + |
| 71 | +|======================================================================= |
| 72 | +|Name |Note |
| 73 | +|`flushInterval` |Use <<api-request-time,`apiRequestTime`>> instead. Note that this option has a slightly different meaning as the intake API has changed. |
| 74 | +|`maxQueueSize` |Use <<api-request-size,`apiRequestSize`>> instead. Note that this option has a slightly different meaning as the intake API has changed. |
| 75 | +|======================================================================= |
| 76 | + |
| 77 | +[[v2-agent-api]] |
| 78 | +==== Agent API |
| 79 | + |
| 80 | +The <<apm-add-filter,`agent.addFilter()`>> callback is called with a different payload in 2.0.0 (see docs for details). |
| 81 | + |
| 82 | +[NOTE] |
| 83 | +==== |
| 84 | +While the `addFilter()` function is still called for all types of data sent to the APM Server, |
| 85 | +three new filter functions have been added in 2.0.0 as well: |
| 86 | +<<apm-add-error-filter,`agent.addErrorFilter()`>>, |
| 87 | +<<apm-add-transaction-filter,`agent.addTransactionFilter()`>>, |
| 88 | +and <<apm-add-span-filter,`agent.addSpanFilter()`>>, |
| 89 | +called only for errors, |
| 90 | +transactions, |
| 91 | +and spans respectively. |
| 92 | +==== |
| 93 | + |
| 94 | +The previously undocumented method `span.offsetTime()` has been removed in 2.0.0. |
0 commit comments