@gasket/plugin-elastic-apm 7.4.0 → 7.4.2

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 (2) hide show
  1. package/README.md +22 -0
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -150,6 +150,7 @@ export default {
150
150
  const transaction = await gasket.actions.getApmTransaction(req);
151
151
  const locale = await gasket.actions.getIntlLocale(req);
152
152
  transaction.setLabel('locale', locale);
153
+ next();
153
154
  });
154
155
  }
155
156
  }
@@ -161,6 +162,27 @@ to decorate the transaction.
161
162
  Calling `getApmTransaction` will also allow other plugins to decorate the
162
163
  transaction by hooking the `apmTransaction` lifecycle discussed next.
163
164
 
165
+ At a minimum, the `getApmTransaction` action must be invoked to execute
166
+ the `apmTransaction` lifecycle described below.
167
+ This can be adjusted to only run for specific requests.
168
+
169
+ ```js
170
+ export default {
171
+ name: 'example-plugin',
172
+ hooks: {
173
+ express(gasket, app) {
174
+ app.use(async (req, res, next) => {
175
+ // Only decorate APM transaction for non-API requests
176
+ if(!req.path.startsWith('/api')) {
177
+ await gasket.actions.getApmTransaction(req);
178
+ }
179
+ next();
180
+ });
181
+ }
182
+ }
183
+ }
184
+ ```
185
+
164
186
  ## Lifecycles
165
187
 
166
188
  ### apmTransaction
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gasket/plugin-elastic-apm",
3
- "version": "7.4.0",
3
+ "version": "7.4.2",
4
4
  "description": "Adds Elastic APM instrumentation to your application",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -22,7 +22,7 @@
22
22
  "bugs": "https://github.com/godaddy/gasket/issues",
23
23
  "homepage": "https://github.com/godaddy/gasket/tree/main/packages/gasket-plugin-elastic-apm",
24
24
  "dependencies": {
25
- "@gasket/request": "7.4.0"
25
+ "@gasket/request": "7.4.2"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/jest": "^29.5.14",
@@ -38,9 +38,9 @@
38
38
  "jest": "^29.7.0",
39
39
  "nyc": "^15.1.0",
40
40
  "typescript": "^5.8.2",
41
- "@gasket/core": "7.5.0",
42
- "@gasket/plugin-metadata": "7.4.0",
43
- "create-gasket-app": "7.4.0"
41
+ "@gasket/core": "7.5.1",
42
+ "@gasket/plugin-metadata": "7.4.3",
43
+ "create-gasket-app": "7.4.5"
44
44
  },
45
45
  "eslintConfig": {
46
46
  "extends": [