@opentelemetry/instrumentation-fastify 0.30.0 → 0.31.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/README.md +22 -0
- package/build/src/index.d.ts +1 -0
- package/build/src/index.js +1 -0
- package/build/src/index.js.map +1 -1
- package/build/src/instrumentation.d.ts +7 -7
- package/build/src/instrumentation.js +13 -0
- package/build/src/instrumentation.js.map +1 -1
- package/build/src/internal-types.d.ts +8 -0
- package/build/src/internal-types.js +19 -0
- package/build/src/internal-types.js.map +1 -0
- package/build/src/types.d.ts +19 -6
- package/build/src/types.js +0 -1
- package/build/src/types.js.map +1 -1
- package/build/src/utils.d.ts +1 -1
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +1 -1
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -45,6 +45,28 @@ registerInstrumentations({
|
|
|
45
45
|
|
|
46
46
|
See [examples/fastify](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/examples/fastify) for a short example.
|
|
47
47
|
|
|
48
|
+
## Fastify Instrumentation Options
|
|
49
|
+
|
|
50
|
+
| Options | Type | Example | Description |
|
|
51
|
+
| `requestHook` | `FastifyCustomAttributeFunction` | `(span, requestInfo) => {}` | Function for adding custom attributes to Fastify requests. Receives params: `Span, FastifyRequestInfo`. |
|
|
52
|
+
|
|
53
|
+
### Using `requestHook`
|
|
54
|
+
|
|
55
|
+
Instrumentation configuration accepts a custom "hook" function which will be called for every instrumented Fastify request. Custom attributes can be set on the span or run any custom logic per request.
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
import { FastifyInstrumentation } from "@opentelemetry/instrumentation-fastify"
|
|
59
|
+
|
|
60
|
+
const fastifyInstrumentation = new FastifyInstrumentation({
|
|
61
|
+
requestHook: function (span: Span, info: FastifyRequestInfo) {
|
|
62
|
+
span.setAttribute(
|
|
63
|
+
'http.method',
|
|
64
|
+
info.request.method,
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
48
70
|
## Useful links
|
|
49
71
|
|
|
50
72
|
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
|
package/build/src/index.d.ts
CHANGED
package/build/src/index.js
CHANGED
|
@@ -26,5 +26,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
26
26
|
};
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
__exportStar(require("./enums/AttributeNames"), exports);
|
|
29
|
+
__exportStar(require("./types"), exports);
|
|
29
30
|
__exportStar(require("./instrumentation"), exports);
|
|
30
31
|
//# sourceMappingURL=index.js.map
|
package/build/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;AAEH,yDAAuC;AACvC,oDAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;AAEH,yDAAuC;AACvC,0CAAwB;AACxB,oDAAkC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { InstrumentationBase,
|
|
2
|
-
import type {
|
|
3
|
-
import type { FastifyReply } from 'fastify/types/reply';
|
|
4
|
-
import type { FastifyRequest } from 'fastify/types/request';
|
|
1
|
+
import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
|
|
2
|
+
import type { FastifyInstrumentationConfig } from './types';
|
|
5
3
|
export declare const ANONYMOUS_NAME = "anonymous";
|
|
6
4
|
/** Fastify instrumentation for OpenTelemetry */
|
|
7
5
|
export declare class FastifyInstrumentation extends InstrumentationBase {
|
|
8
|
-
constructor(config?:
|
|
6
|
+
constructor(config?: FastifyInstrumentationConfig);
|
|
7
|
+
setConfig(config?: FastifyInstrumentationConfig): void;
|
|
8
|
+
getConfig(): FastifyInstrumentationConfig;
|
|
9
9
|
init(): InstrumentationNodeModuleDefinition<any>[];
|
|
10
10
|
private _hookOnRequest;
|
|
11
11
|
private _wrapHandler;
|
|
12
12
|
private _wrapAddHook;
|
|
13
13
|
private _patchConstructor;
|
|
14
|
-
_patchSend
|
|
15
|
-
_hookPreHandler
|
|
14
|
+
private _patchSend;
|
|
15
|
+
private _hookPreHandler;
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=instrumentation.d.ts.map
|
|
@@ -30,6 +30,12 @@ class FastifyInstrumentation extends instrumentation_1.InstrumentationBase {
|
|
|
30
30
|
constructor(config = {}) {
|
|
31
31
|
super('@opentelemetry/instrumentation-fastify', version_1.VERSION, Object.assign({}, config));
|
|
32
32
|
}
|
|
33
|
+
setConfig(config = {}) {
|
|
34
|
+
this._config = Object.assign({}, config);
|
|
35
|
+
}
|
|
36
|
+
getConfig() {
|
|
37
|
+
return this._config;
|
|
38
|
+
}
|
|
33
39
|
init() {
|
|
34
40
|
return [
|
|
35
41
|
new instrumentation_1.InstrumentationNodeModuleDefinition('fastify', ['^3.0.0', '^4.0.0'], (moduleExports, moduleVersion) => {
|
|
@@ -169,6 +175,13 @@ class FastifyInstrumentation extends instrumentation_1.InstrumentationBase {
|
|
|
169
175
|
spanAttributes[AttributeNames_1.AttributeNames.FASTIFY_NAME] = handlerName;
|
|
170
176
|
}
|
|
171
177
|
const span = utils_1.startSpan(reply, instrumentation.tracer, spanName, spanAttributes);
|
|
178
|
+
if (instrumentation.getConfig().requestHook) {
|
|
179
|
+
instrumentation_1.safeExecuteInTheMiddle(() => instrumentation.getConfig().requestHook(span, { request }), e => {
|
|
180
|
+
if (e) {
|
|
181
|
+
instrumentation._diag.error('request hook failed', e);
|
|
182
|
+
}
|
|
183
|
+
}, true);
|
|
184
|
+
}
|
|
172
185
|
return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), () => {
|
|
173
186
|
done();
|
|
174
187
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAK4B;AAC5B,8CAA8D;AAC9D,
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAK4B;AAC5B,8CAA8D;AAC9D,oEAIwC;AACxC,8EAAyE;AAOzE,2CAAmD;AACnD,2DAIgC;AAGhC,mCAIiB;AACjB,uCAAoC;AAEvB,QAAA,cAAc,GAAG,WAAW,CAAC;AAE1C,gDAAgD;AAChD,MAAa,sBAAuB,SAAQ,qCAAmB;IAC7D,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,EAAE,QAAQ,CAAC,EACpB,CAAC,aAAa,EAAE,aAAa,EAAE,EAAE;gBAC/B,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,8BAA8B,aAAa,EAAE,CAAC,CAAC;gBAChE,OAAO,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;YAC/C,CAAC,CACF;SACF,CAAC;IACJ,CAAC;IAEO,cAAc;QACpB,MAAM,eAAe,GAAG,IAAI,CAAC;QAC7B,OAAO,SAAS,SAAS,CACvB,OAAuB,EACvB,KAA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AwPC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Span } from '@opentelemetry/api';
|
|
2
|
+
import type { FastifyReply } from 'fastify';
|
|
3
|
+
import { spanRequestSymbol } from './constants';
|
|
4
|
+
export declare type HandlerOriginal = (() => Promise<unknown>) & (() => void);
|
|
5
|
+
export declare type PluginFastifyReply = FastifyReply & {
|
|
6
|
+
[spanRequestSymbol]?: Span[];
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=internal-types.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright The OpenTelemetry Authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const constants_1 = require("./constants");
|
|
19
|
+
//# sourceMappingURL=internal-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-types.js","sourceRoot":"","sources":["../../src/internal-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAIH,2CAAgD"}
|
package/build/src/types.d.ts
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { Span } from '@opentelemetry/api';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
3
|
+
export interface FastifyRequestInfo {
|
|
4
|
+
request: any;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Function that can be used to add custom attributes to the current span
|
|
8
|
+
* @param span - The Fastify handler span.
|
|
9
|
+
* @param info - The Fastify request info object.
|
|
10
|
+
*/
|
|
11
|
+
export interface FastifyCustomAttributeFunction {
|
|
12
|
+
(span: Span, info: FastifyRequestInfo): void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Options available for the Fastify Instrumentation
|
|
16
|
+
*/
|
|
17
|
+
export interface FastifyInstrumentationConfig extends InstrumentationConfig {
|
|
18
|
+
/** Function for adding custom attributes to each handler span */
|
|
19
|
+
requestHook?: FastifyCustomAttributeFunction;
|
|
20
|
+
}
|
|
8
21
|
//# sourceMappingURL=types.d.ts.map
|
package/build/src/types.js
CHANGED
package/build/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
|
package/build/src/utils.d.ts
CHANGED
package/build/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.31.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/src/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentelemetry/instrumentation-fastify",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "OpenTelemetry fastify automatic instrumentation package.",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"types": "build/src/index.d.ts",
|
|
@@ -42,18 +42,19 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@opentelemetry/api": "^1.
|
|
45
|
+
"@opentelemetry/api": "^1.3.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@fastify/express": "^2.0.2",
|
|
49
|
-
"@opentelemetry/api": "^1.
|
|
50
|
-
"@opentelemetry/context-async-hooks": "^1.
|
|
51
|
-
"@opentelemetry/instrumentation-http": "0.
|
|
52
|
-
"@opentelemetry/sdk-trace-base": "^1.
|
|
53
|
-
"@opentelemetry/sdk-trace-node": "^1.
|
|
49
|
+
"@opentelemetry/api": "^1.3.0",
|
|
50
|
+
"@opentelemetry/context-async-hooks": "^1.8.0",
|
|
51
|
+
"@opentelemetry/instrumentation-http": "0.34.0",
|
|
52
|
+
"@opentelemetry/sdk-trace-base": "^1.8.0",
|
|
53
|
+
"@opentelemetry/sdk-trace-node": "^1.8.0",
|
|
54
54
|
"@types/express": "4.17.13",
|
|
55
55
|
"@types/mocha": "7.0.2",
|
|
56
|
-
"@types/node": "
|
|
56
|
+
"@types/node": "18.11.7",
|
|
57
|
+
"fastify": "^4.5.3",
|
|
57
58
|
"gts": "3.1.0",
|
|
58
59
|
"mocha": "7.2.0",
|
|
59
60
|
"nyc": "15.1.0",
|
|
@@ -62,11 +63,10 @@
|
|
|
62
63
|
"typescript": "4.3.5"
|
|
63
64
|
},
|
|
64
65
|
"dependencies": {
|
|
65
|
-
"@opentelemetry/core": "^1.
|
|
66
|
-
"@opentelemetry/instrumentation": "^0.
|
|
67
|
-
"@opentelemetry/semantic-conventions": "^1.0.0"
|
|
68
|
-
"fastify": "^4.5.3"
|
|
66
|
+
"@opentelemetry/core": "^1.8.0",
|
|
67
|
+
"@opentelemetry/instrumentation": "^0.34.0",
|
|
68
|
+
"@opentelemetry/semantic-conventions": "^1.0.0"
|
|
69
69
|
},
|
|
70
70
|
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-fastify#readme",
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "59fa57cfd0dff4ae0e6f3833dff73c55dfd79ee5"
|
|
72
72
|
}
|