@gasket/plugin-elastic-apm 7.3.0 → 7.3.1
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/README.md +27 -9
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -37,7 +37,6 @@ Add a `setup.js` script to the root of your app
|
|
|
37
37
|
|
|
38
38
|
```
|
|
39
39
|
// setup.js
|
|
40
|
-
import dotenv from 'dotenv/config';
|
|
41
40
|
import apm from 'elastic-apm-node';
|
|
42
41
|
|
|
43
42
|
// Elastic APM setup
|
|
@@ -53,7 +52,7 @@ apm.start({
|
|
|
53
52
|
## Configuration
|
|
54
53
|
|
|
55
54
|
The [start recommendations] for the APM agent are to require it as early as
|
|
56
|
-
possible in your app. For Gasket apps, using
|
|
55
|
+
possible in your app. For Gasket apps, using `NODE_OPTIONS=--import=./setup.js`
|
|
57
56
|
will accomplish this. To configure the APM agent, set the environment variables
|
|
58
57
|
described in the [configuration options documentation].
|
|
59
58
|
|
|
@@ -61,6 +60,24 @@ In particular, the APM server URL (`ELASTIC_APM_SERVER_URL`) and secret token
|
|
|
61
60
|
(`ELASTIC_APM_SECRET_TOKEN`) are both required configuration. If either of these
|
|
62
61
|
are not present, the APM agent will be disabled.
|
|
63
62
|
|
|
63
|
+
### Dotenv
|
|
64
|
+
|
|
65
|
+
If you wish to use `dotenv`, be sure it is installed and imported in `setup.js`:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
npm i dotenv
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```diff
|
|
72
|
+
// setup.js
|
|
73
|
+
+ import 'dotenv/config';
|
|
74
|
+
import apm from 'elastic-apm-node';
|
|
75
|
+
|
|
76
|
+
// Elastic APM setup
|
|
77
|
+
apm.start({
|
|
78
|
+
...
|
|
79
|
+
```
|
|
80
|
+
|
|
64
81
|
### Plugin Configurations
|
|
65
82
|
|
|
66
83
|
The Gasket plugin provides some additional setup helpers. These can be
|
|
@@ -90,14 +107,14 @@ information in their cookies, you may wish to filter them out before they are
|
|
|
90
107
|
stored in Elasticsearch. Specify a list of cookie names to redact in
|
|
91
108
|
`setup.js` using the [sanitizeFieldNames] configuration option:
|
|
92
109
|
|
|
93
|
-
```
|
|
110
|
+
```diff
|
|
94
111
|
// setup.js
|
|
95
|
-
|
|
112
|
+
import apm from 'elastic-apm-node';
|
|
96
113
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
114
|
+
// Elastic APM setup
|
|
115
|
+
apm.start({
|
|
116
|
+
+ sanitizeFieldNames: ['foo', 'bar', '*token*']
|
|
117
|
+
...
|
|
101
118
|
```
|
|
102
119
|
|
|
103
120
|
The `sanitizeFieldNames` config option can be used for:
|
|
@@ -111,7 +128,8 @@ To filter out other data, use the [APM Add Filter API].
|
|
|
111
128
|
### Custom Filters
|
|
112
129
|
|
|
113
130
|
According to the [Elastic APM docs], the _Elastic APM agent for Node.js is a
|
|
114
|
-
singleton_.
|
|
131
|
+
singleton_.
|
|
132
|
+
This means that you can import and configure the singleton in various
|
|
115
133
|
hooks of your Gasket app, such as with the [init] or [middleware] lifecycles.
|
|
116
134
|
|
|
117
135
|
## Actions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gasket/plugin-elastic-apm",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.1",
|
|
4
4
|
"description": "Adds Elastic APM instrumentation to your application",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -27,11 +27,14 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/godaddy/gasket/tree/main/packages/gasket-plugin-elastic-apm",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@gasket/request": "^7.3.
|
|
30
|
+
"@gasket/request": "^7.3.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
+
"@gasket/core": "^7.3.1",
|
|
34
|
+
"@gasket/plugin-metadata": "^7.3.2",
|
|
33
35
|
"@types/jest": "^29.5.14",
|
|
34
36
|
"@types/node": "^20.17.19",
|
|
37
|
+
"create-gasket-app": "^7.3.2",
|
|
35
38
|
"cross-env": "^7.0.3",
|
|
36
39
|
"dotenv": "^16.4.7",
|
|
37
40
|
"elastic-apm-node": "^4.11.0",
|
|
@@ -42,10 +45,7 @@
|
|
|
42
45
|
"eslint-plugin-unicorn": "^55.0.0",
|
|
43
46
|
"jest": "^29.7.0",
|
|
44
47
|
"nyc": "^15.1.0",
|
|
45
|
-
"typescript": "^5.7.3"
|
|
46
|
-
"@gasket/core": "^7.3.0",
|
|
47
|
-
"@gasket/plugin-metadata": "^7.3.0",
|
|
48
|
-
"create-gasket-app": "^7.3.0"
|
|
48
|
+
"typescript": "^5.7.3"
|
|
49
49
|
},
|
|
50
50
|
"eslintConfig": {
|
|
51
51
|
"extends": [
|