@opentelemetry/instrumentation-express 0.27.1 → 0.30.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/CHANGELOG.md +27 -0
- package/LICENSE +1 -1
- package/README.md +7 -7
- package/build/src/instrumentation.d.ts +5 -2
- package/build/src/instrumentation.js +35 -5
- package/build/src/instrumentation.js.map +1 -1
- package/build/src/types.d.ts +15 -0
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +1 -1
- package/package.json +17 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.30.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-express-v0.29.0...instrumentation-express-v0.30.0) (2022-06-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* update core dependencies stable ^1.3.1 experimental ^0.29.2 ([141b155](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/141b155e344980b51264e26b26c117b2113bcef6))
|
|
9
|
+
|
|
10
|
+
## [0.29.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-express-v0.28.0...instrumentation-express-v0.29.0) (2022-05-14)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add supported node versions for all packages ([#973](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/973)) ([baaacbd](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/baaacbdd35ca4baab0afae64647aa8c0380ee4b7))
|
|
16
|
+
* use Otel SDK 1.2/0.28 ([#984](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/984)) ([098c2ed](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/098c2ed6f9c5ab7bd865685018c0777245aab3b7))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* correctly disable Express instrumentation ([#972](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/972)) ([b55b79b](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/b55b79b72451c65080e01c2ec11655cabd5f65d9))
|
|
22
|
+
|
|
23
|
+
## [0.28.0](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-express-v0.27.1...instrumentation-express-v0.28.0) (2022-02-06)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* **express:** allow rewriting span names ([#463](https://www.github.com/open-telemetry/opentelemetry-js-contrib/issues/463)) ([7510757](https://www.github.com/open-telemetry/opentelemetry-js-contrib/commit/7510757aeeee47a7f0c4bb31de45be3a71bb673e))
|
|
29
|
+
|
|
3
30
|
### [0.27.1](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-express-v0.27.0...instrumentation-express-v0.27.1) (2022-01-24)
|
|
4
31
|
|
|
5
32
|
|
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright [
|
|
189
|
+
Copyright [2022] OpenTelemetry Authors
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
# OpenTelemetry Express Instrumentation for Node.js
|
|
2
2
|
|
|
3
3
|
[![NPM Published Version][npm-img]][npm-url]
|
|
4
|
-
[![dependencies][dependencies-image]][dependencies-url]
|
|
5
|
-
[![devDependencies][devDependencies-image]][devDependencies-url]
|
|
6
4
|
[![Apache License][license-image]][license-image]
|
|
7
5
|
|
|
8
6
|
This module provides automatic instrumentation for [`express`](https://github.com/expressjs/express).
|
|
9
7
|
|
|
10
8
|
For automatic instrumentation see the
|
|
11
|
-
[@opentelemetry/sdk-trace-node](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-node) package.
|
|
9
|
+
[@opentelemetry/sdk-trace-node](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package.
|
|
12
10
|
|
|
13
11
|
Compatible with OpenTelemetry JS API and SDK `1.0+`.
|
|
14
12
|
|
|
@@ -62,6 +60,7 @@ Express instrumentation has few options available to choose from. You can set th
|
|
|
62
60
|
| ------- | ---- | ------- | ----------- |
|
|
63
61
|
| `ignoreLayers` | `IgnoreMatcher[]` | `[/^\/_internal\//]` | Ignore layers that by match. |
|
|
64
62
|
| `ignoreLayersType`| `ExpressLayerType[]` | `['request_handler']` | Ignore layers of specified type. |
|
|
63
|
+
| `spanNameHook` | `SpanNameHook` | `() => 'my-span-name'` | Can be used to customize span names by returning a new name from the hook. |
|
|
65
64
|
|
|
66
65
|
`ignoreLayers` accepts an array of elements of types:
|
|
67
66
|
|
|
@@ -75,6 +74,11 @@ Express instrumentation has few options available to choose from. You can set th
|
|
|
75
74
|
- `middleware`,
|
|
76
75
|
- `request_handler` is the name for anything that's not a router or a middleware.
|
|
77
76
|
|
|
77
|
+
`spanNameHook` is invoked with 2 arguments:
|
|
78
|
+
|
|
79
|
+
- `info: ExpressRequestInfo` containing the incoming Express.js request, the current route handler creating a span and `ExpressLayerType` - the type of the handling layer or undefined when renaming the root HTTP instrumentation span.
|
|
80
|
+
- `defaultName: string` - original name proposed by the instrumentation.
|
|
81
|
+
|
|
78
82
|
## Useful links
|
|
79
83
|
|
|
80
84
|
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
|
|
@@ -88,9 +92,5 @@ Apache 2.0 - See [LICENSE][license-url] for more information.
|
|
|
88
92
|
[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
|
|
89
93
|
[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE
|
|
90
94
|
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
|
|
91
|
-
[dependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js-contrib.svg?path=plugins%2Fnode%2Fopentelemetry-instrumentation-express
|
|
92
|
-
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js-contrib?path=plugins%2Fnode%2Fopentelemetry-instrumentation-express
|
|
93
|
-
[devDependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js-contrib.svg?path=plugins%2Fnode%2Fopentelemetry-instrumentation-express&type=dev
|
|
94
|
-
[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js-contrib?path=plugins%2Fnode%2Fopentelemetry-instrumentation-express&type=dev
|
|
95
95
|
[npm-url]: https://www.npmjs.com/package/@opentelemetry/instrumentation-dns
|
|
96
96
|
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Finstrumentation-dns.svg
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as express from 'express';
|
|
2
|
-
import { ExpressInstrumentationConfig } from './types';
|
|
1
|
+
import type * as express from 'express';
|
|
2
|
+
import { ExpressInstrumentationConfig, ExpressRequestInfo } from './types';
|
|
3
3
|
import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
|
|
4
4
|
/**
|
|
5
5
|
* This symbol is used to mark express layer as being already instrumented
|
|
@@ -9,6 +9,8 @@ export declare const kLayerPatched: unique symbol;
|
|
|
9
9
|
/** Express instrumentation for OpenTelemetry */
|
|
10
10
|
export declare class ExpressInstrumentation extends InstrumentationBase<typeof express> {
|
|
11
11
|
constructor(config?: ExpressInstrumentationConfig);
|
|
12
|
+
setConfig(config?: ExpressInstrumentationConfig): void;
|
|
13
|
+
getConfig(): ExpressInstrumentationConfig;
|
|
12
14
|
init(): InstrumentationNodeModuleDefinition<typeof express>[];
|
|
13
15
|
/**
|
|
14
16
|
* Get the patch for Router.route function
|
|
@@ -24,5 +26,6 @@ export declare class ExpressInstrumentation extends InstrumentationBase<typeof e
|
|
|
24
26
|
private _getAppUsePatch;
|
|
25
27
|
/** Patch each express layer to create span and propagate context */
|
|
26
28
|
private _applyPatch;
|
|
29
|
+
_getSpanName(info: ExpressRequestInfo, defaultName: string): string;
|
|
27
30
|
}
|
|
28
31
|
//# sourceMappingURL=instrumentation.d.ts.map
|
|
@@ -35,6 +35,12 @@ class ExpressInstrumentation extends instrumentation_1.InstrumentationBase {
|
|
|
35
35
|
constructor(config = {}) {
|
|
36
36
|
super('@opentelemetry/instrumentation-express', version_1.VERSION, Object.assign({}, config));
|
|
37
37
|
}
|
|
38
|
+
setConfig(config = {}) {
|
|
39
|
+
this._config = Object.assign({}, config);
|
|
40
|
+
}
|
|
41
|
+
getConfig() {
|
|
42
|
+
return this._config;
|
|
43
|
+
}
|
|
38
44
|
init() {
|
|
39
45
|
return [
|
|
40
46
|
new instrumentation_1.InstrumentationNodeModuleDefinition('express', ['^4.0.0'], (moduleExports, moduleVersion) => {
|
|
@@ -63,9 +69,10 @@ class ExpressInstrumentation extends instrumentation_1.InstrumentationBase {
|
|
|
63
69
|
if (moduleExports === undefined)
|
|
64
70
|
return;
|
|
65
71
|
api_1.diag.debug(`Removing patch for express@${moduleVersion}`);
|
|
66
|
-
|
|
67
|
-
this._unwrap(
|
|
68
|
-
this._unwrap(
|
|
72
|
+
const routerProto = moduleExports.Router;
|
|
73
|
+
this._unwrap(routerProto, 'route');
|
|
74
|
+
this._unwrap(routerProto, 'use');
|
|
75
|
+
this._unwrap(moduleExports.application, 'use');
|
|
69
76
|
}),
|
|
70
77
|
];
|
|
71
78
|
}
|
|
@@ -137,7 +144,11 @@ class ExpressInstrumentation extends instrumentation_1.InstrumentationBase {
|
|
|
137
144
|
if (metadata.attributes[AttributeNames_1.AttributeNames.EXPRESS_TYPE] ===
|
|
138
145
|
ExpressLayerType_1.ExpressLayerType.REQUEST_HANDLER &&
|
|
139
146
|
(rpcMetadata === null || rpcMetadata === void 0 ? void 0 : rpcMetadata.type) === core_1.RPCType.HTTP) {
|
|
140
|
-
|
|
147
|
+
const name = instrumentation._getSpanName({
|
|
148
|
+
request: req,
|
|
149
|
+
route,
|
|
150
|
+
}, `${req.method} ${route.length > 0 ? route : '/'}`);
|
|
151
|
+
rpcMetadata.span.updateName(name);
|
|
141
152
|
}
|
|
142
153
|
// verify against the config if the layer should be ignored
|
|
143
154
|
if (utils_1.isLayerIgnored(metadata.name, type, instrumentation._config)) {
|
|
@@ -149,7 +160,12 @@ class ExpressInstrumentation extends instrumentation_1.InstrumentationBase {
|
|
|
149
160
|
if (api_1.trace.getSpan(api_1.context.active()) === undefined) {
|
|
150
161
|
return original.apply(this, arguments);
|
|
151
162
|
}
|
|
152
|
-
const
|
|
163
|
+
const spanName = instrumentation._getSpanName({
|
|
164
|
+
request: req,
|
|
165
|
+
layerType: type,
|
|
166
|
+
route,
|
|
167
|
+
}, metadata.name);
|
|
168
|
+
const span = instrumentation.tracer.startSpan(spanName, {
|
|
153
169
|
attributes: Object.assign(attributes, metadata.attributes),
|
|
154
170
|
});
|
|
155
171
|
const startTime = core_1.hrTime();
|
|
@@ -203,6 +219,20 @@ class ExpressInstrumentation extends instrumentation_1.InstrumentationBase {
|
|
|
203
219
|
};
|
|
204
220
|
});
|
|
205
221
|
}
|
|
222
|
+
_getSpanName(info, defaultName) {
|
|
223
|
+
var _a;
|
|
224
|
+
const hook = this.getConfig().spanNameHook;
|
|
225
|
+
if (!(hook instanceof Function)) {
|
|
226
|
+
return defaultName;
|
|
227
|
+
}
|
|
228
|
+
try {
|
|
229
|
+
return (_a = hook(info, defaultName)) !== null && _a !== void 0 ? _a : defaultName;
|
|
230
|
+
}
|
|
231
|
+
catch (err) {
|
|
232
|
+
api_1.diag.error('express instrumentation: error calling span name rewrite hook', err);
|
|
233
|
+
return defaultName;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
206
236
|
}
|
|
207
237
|
exports.ExpressInstrumentation = ExpressInstrumentation;
|
|
208
238
|
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,8CAK6B;AAC7B,4CAA0E;AAE1E,
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,8CAK6B;AAC7B,4CAA0E;AAE1E,mCAOiB;AACjB,+DAA4D;AAC5D,2DAAwD;AACxD,mCAA2E;AAC3E,uCAAoC;AACpC,oEAIwC;AACxC,8EAAyE;AAEzE;;;GAGG;AACU,QAAA,aAAa,GAAkB,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAE5E,gDAAgD;AAChD,MAAa,sBAAuB,SAAQ,qCAE3C;IACC,YAAY,SAAuC,EAAE;QACnD,KAAK,CACH,wCAAwC,EACxC,iBAAO,EACP,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAC1B,CAAC;IACJ,CAAC;IAEQ,SAAS,CAAC,SAAuC,EAAE;QAC1D,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;IAEQ,SAAS;QAChB,OAAO,IAAI,CAAC,OAAuC,CAAC;IACtD,CAAC;IAED,IAAI;QACF,OAAO;YACL,IAAI,qDAAmC,CACrC,SAAS,EACT,CAAC,QAAQ,CAAC,EACV,CAAC,aAAa,EAAE,aAAa,EAAE,EAAE;gBAC/B,UAAI,CAAC,KAAK,CAAC,8BAA8B,aAAa,EAAE,CAAC,CAAC;gBAC1D,MAAM,WAAW,GAAG,aAAa,CAAC,MAAmC,CAAC;gBACtE,6BAA6B;gBAC7B,IAAI,2BAAS,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE;oBAChC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;iBACpC;gBACD,IAAI,C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;SACpB;IACH,CAAC;CACF;AA9QD,wDA8QC"}
|
package/build/src/types.d.ts
CHANGED
|
@@ -49,6 +49,20 @@ export declare type LayerMetadata = {
|
|
|
49
49
|
name: string;
|
|
50
50
|
};
|
|
51
51
|
export declare type IgnoreMatcher = string | RegExp | ((name: string) => boolean);
|
|
52
|
+
export declare type ExpressRequestInfo = {
|
|
53
|
+
request: Request;
|
|
54
|
+
route: string;
|
|
55
|
+
/**
|
|
56
|
+
* If layerType is undefined, SpanNameHook is being invoked to rename the original root HTTP span.
|
|
57
|
+
*/
|
|
58
|
+
layerType?: ExpressLayerType;
|
|
59
|
+
};
|
|
60
|
+
export declare type SpanNameHook = (info: ExpressRequestInfo,
|
|
61
|
+
/**
|
|
62
|
+
* If no decision is taken based on RequestInfo, the default name
|
|
63
|
+
* supplied by the instrumentation can be used instead.
|
|
64
|
+
*/
|
|
65
|
+
defaultName: string) => string;
|
|
52
66
|
/**
|
|
53
67
|
* Options available for the Express Instrumentation (see [documentation](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-Instrumentation-express#express-Instrumentation-options))
|
|
54
68
|
*/
|
|
@@ -57,5 +71,6 @@ export interface ExpressInstrumentationConfig extends InstrumentationConfig {
|
|
|
57
71
|
ignoreLayers?: IgnoreMatcher[];
|
|
58
72
|
/** Ignore specific layers based on their type */
|
|
59
73
|
ignoreLayersType?: ExpressLayerType[];
|
|
74
|
+
spanNameHook?: SpanNameHook;
|
|
60
75
|
}
|
|
61
76
|
//# sourceMappingURL=types.d.ts.map
|
package/build/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.30.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/src/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentelemetry/instrumentation-express",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"description": "OpenTelemetry express automatic instrumentation package.",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"types": "build/src/index.d.ts",
|
|
7
7
|
"repository": "open-telemetry/opentelemetry-js-contrib",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"test": "
|
|
10
|
-
"
|
|
9
|
+
"test-all-versions": "tav",
|
|
10
|
+
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
|
|
11
11
|
"tdd": "yarn test -- --watch-extensions ts --watch",
|
|
12
12
|
"clean": "rimraf build/*",
|
|
13
13
|
"lint": "eslint . --ext .ts",
|
|
14
14
|
"lint:fix": "eslint . --ext .ts --fix",
|
|
15
|
-
"precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-express --include-dependencies",
|
|
15
|
+
"precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-express --include-dependencies",
|
|
16
16
|
"prewatch": "npm run precompile",
|
|
17
17
|
"version:update": "node ../../../scripts/version-update.js",
|
|
18
|
-
"compile": "
|
|
18
|
+
"compile": "tsc -p .",
|
|
19
|
+
"compile:examples": "cd examples && npm run compile",
|
|
19
20
|
"prepare": "npm run compile",
|
|
20
21
|
"watch": "tsc -w"
|
|
21
22
|
},
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"author": "OpenTelemetry Authors",
|
|
31
32
|
"license": "Apache-2.0",
|
|
32
33
|
"engines": {
|
|
33
|
-
"node": ">=8.
|
|
34
|
+
"node": ">=8.12.0"
|
|
34
35
|
},
|
|
35
36
|
"files": [
|
|
36
37
|
"build/src/**/*.js",
|
|
@@ -44,29 +45,30 @@
|
|
|
44
45
|
"access": "public"
|
|
45
46
|
},
|
|
46
47
|
"peerDependencies": {
|
|
47
|
-
"@opentelemetry/api": "^1.0.
|
|
48
|
+
"@opentelemetry/api": "^1.0.0"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
|
-
"@opentelemetry/api": "1.0.
|
|
51
|
-
"@opentelemetry/context-async-hooks": "1.
|
|
52
|
-
"@opentelemetry/sdk-trace-base": "1.
|
|
53
|
-
"@opentelemetry/sdk-trace-node": "1.
|
|
51
|
+
"@opentelemetry/api": "^1.0.0",
|
|
52
|
+
"@opentelemetry/context-async-hooks": "^1.3.1",
|
|
53
|
+
"@opentelemetry/sdk-trace-base": "^1.3.1",
|
|
54
|
+
"@opentelemetry/sdk-trace-node": "^1.3.1",
|
|
54
55
|
"@types/mocha": "7.0.2",
|
|
55
|
-
"@types/node": "
|
|
56
|
-
"codecov": "3.8.3",
|
|
56
|
+
"@types/node": "16.11.21",
|
|
57
57
|
"express": "4.17.1",
|
|
58
58
|
"gts": "3.1.0",
|
|
59
59
|
"mocha": "7.2.0",
|
|
60
60
|
"nyc": "15.1.0",
|
|
61
61
|
"rimraf": "3.0.2",
|
|
62
|
+
"test-all-versions": "5.0.1",
|
|
62
63
|
"ts-mocha": "8.0.0",
|
|
63
64
|
"typescript": "4.3.5"
|
|
64
65
|
},
|
|
65
66
|
"dependencies": {
|
|
66
67
|
"@opentelemetry/core": "^1.0.0",
|
|
67
|
-
"@opentelemetry/instrumentation": "^0.
|
|
68
|
+
"@opentelemetry/instrumentation": "^0.29.2",
|
|
68
69
|
"@opentelemetry/semantic-conventions": "^1.0.0",
|
|
69
70
|
"@types/express": "4.17.13"
|
|
70
71
|
},
|
|
71
|
-
"
|
|
72
|
+
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-express#readme",
|
|
73
|
+
"gitHead": "9633cf49c4099e97dd2a285d0399455e17a593e3"
|
|
72
74
|
}
|