@promster/fastify 8.0.0 → 9.0.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/dist/declarations/src/index.d.ts +3 -2
- package/dist/declarations/src/plugin/index.d.ts +2 -2
- package/dist/declarations/src/plugin/plugin.d.ts +7 -2
- package/dist/promster-fastify.cjs.d.ts +1 -0
- package/dist/promster-fastify.cjs.d.ts.map +1 -0
- package/dist/promster-fastify.cjs.dev.js +15 -4
- package/dist/promster-fastify.cjs.prod.js +15 -4
- package/package.json +5 -4
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { plugin, getRequestRecorder, signalIsUp, signalIsNotUp } from
|
|
1
|
+
import { type TPromsterOptions, plugin, getRequestRecorder, signalIsUp, signalIsNotUp } from "./plugin/index.js";
|
|
2
2
|
import { getSummary, getContentType, Prometheus, defaultRegister, defaultNormalizers, timing } from '@promster/metrics';
|
|
3
|
-
export { plugin, getRequestRecorder, signalIsUp, signalIsNotUp, getSummary, getContentType, Prometheus, defaultRegister, defaultNormalizers, timing, };
|
|
3
|
+
export { type TPromsterOptions, plugin, getRequestRecorder, signalIsUp, signalIsNotUp, getSummary, getContentType, Prometheus, defaultRegister, defaultNormalizers, timing, };
|
|
4
|
+
export * from '@promster/types';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { plugin, getRequestRecorder, signalIsUp, signalIsNotUp } from
|
|
2
|
-
export { plugin, signalIsUp, signalIsNotUp, getRequestRecorder };
|
|
1
|
+
import { type TPromsterOptions, plugin, getRequestRecorder, signalIsUp, signalIsNotUp } from "./plugin.js";
|
|
2
|
+
export { type TPromsterOptions, plugin, signalIsUp, signalIsNotUp, getRequestRecorder, };
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import
|
|
1
|
+
import { type TOptionalPromsterOptions, type TLabelValues } from '@promster/types';
|
|
2
|
+
import { type TRequestRecorder } from '@promster/metrics';
|
|
3
|
+
import { type FastifyInstance, type FastifyRequest, type FastifyReply } from 'fastify';
|
|
3
4
|
declare const extractPath: (req: FastifyRequest) => string;
|
|
4
5
|
declare const getRequestRecorder: () => TRequestRecorder;
|
|
5
6
|
declare const signalIsUp: () => void;
|
|
6
7
|
declare const signalIsNotUp: () => void;
|
|
8
|
+
type TSkipFunction = <TRequest = FastifyRequest, TResponse = FastifyReply>(_req: TRequest, _res: TResponse, _labels: TLabelValues) => boolean;
|
|
9
|
+
export type TPromsterOptions = TOptionalPromsterOptions & {
|
|
10
|
+
skip?: TSkipFunction;
|
|
11
|
+
};
|
|
7
12
|
declare const plugin: (fastify: FastifyInstance, options: TPromsterOptions) => Promise<void>;
|
|
8
13
|
export { plugin, getRequestRecorder, signalIsUp, signalIsNotUp, extractPath };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promster-fastify.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var fastifyPlugin = require('fastify-plugin');
|
|
6
6
|
var merge = require('merge-options');
|
|
7
7
|
var metrics = require('@promster/metrics');
|
|
8
|
+
var types = require('@promster/types');
|
|
8
9
|
|
|
9
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
10
11
|
|
|
@@ -13,7 +14,7 @@ var merge__default = /*#__PURE__*/_interopDefault(merge);
|
|
|
13
14
|
|
|
14
15
|
var pkg = {
|
|
15
16
|
name: "@promster/fastify",
|
|
16
|
-
version: "
|
|
17
|
+
version: "9.0.1",
|
|
17
18
|
description: "Fastify server integrations of promster",
|
|
18
19
|
main: "dist/promster-fastify.cjs.js",
|
|
19
20
|
typings: "dist/promster-fastify.cjs.d.ts",
|
|
@@ -49,14 +50,15 @@ var pkg = {
|
|
|
49
50
|
"prometheus"
|
|
50
51
|
],
|
|
51
52
|
dependencies: {
|
|
52
|
-
"@promster/metrics": "^
|
|
53
|
+
"@promster/metrics": "^11.0.0",
|
|
54
|
+
"@promster/types": "^5.0.0",
|
|
53
55
|
"fastify-plugin": "^4.4.0",
|
|
54
56
|
"merge-options": "3.0.4",
|
|
55
57
|
"parse-prometheus-text-format": "1.1.1",
|
|
56
58
|
"@promster/server": "workspace:*"
|
|
57
59
|
},
|
|
58
60
|
devDependencies: {
|
|
59
|
-
fastify: "4.
|
|
61
|
+
fastify: "4.22.1"
|
|
60
62
|
}
|
|
61
63
|
};
|
|
62
64
|
|
|
@@ -83,7 +85,9 @@ const signalIsNotUp = () => {
|
|
|
83
85
|
});
|
|
84
86
|
};
|
|
85
87
|
const createPlugin = async (fastify, options) => {
|
|
86
|
-
const allDefaultedOptions = merge__default["default"](metrics.createHttpMetrics.defaultOptions, metrics.createGcMetrics.defaultOptions, metrics.createRequestRecorder.defaultOptions,
|
|
88
|
+
const allDefaultedOptions = merge__default["default"](metrics.createHttpMetrics.defaultOptions, metrics.createGcMetrics.defaultOptions, metrics.createRequestRecorder.defaultOptions,
|
|
89
|
+
// @ts-expect-error
|
|
90
|
+
metrics.createGcObserver.defaultOptions, metrics.defaultNormalizers, options);
|
|
87
91
|
const shouldSkipMetricsByEnvironment = metrics.skipMetricsInEnvironment(allDefaultedOptions);
|
|
88
92
|
const httpMetrics = metrics.createHttpMetrics(allDefaultedOptions);
|
|
89
93
|
const gcMetrics = metrics.createGcMetrics(allDefaultedOptions);
|
|
@@ -108,6 +112,7 @@ const createPlugin = async (fastify, options) => {
|
|
|
108
112
|
req: request,
|
|
109
113
|
res: reply
|
|
110
114
|
}),
|
|
115
|
+
// eslint-disable-next-line camelcase
|
|
111
116
|
status_code: allDefaultedOptions.normalizeStatusCode(reply.statusCode, {
|
|
112
117
|
req: request,
|
|
113
118
|
res: reply
|
|
@@ -163,3 +168,9 @@ exports.getRequestRecorder = getRequestRecorder;
|
|
|
163
168
|
exports.plugin = plugin;
|
|
164
169
|
exports.signalIsNotUp = signalIsNotUp;
|
|
165
170
|
exports.signalIsUp = signalIsUp;
|
|
171
|
+
Object.keys(types).forEach(function (k) {
|
|
172
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
173
|
+
enumerable: true,
|
|
174
|
+
get: function () { return types[k]; }
|
|
175
|
+
});
|
|
176
|
+
});
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var fastifyPlugin = require('fastify-plugin');
|
|
6
6
|
var merge = require('merge-options');
|
|
7
7
|
var metrics = require('@promster/metrics');
|
|
8
|
+
var types = require('@promster/types');
|
|
8
9
|
|
|
9
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
10
11
|
|
|
@@ -13,7 +14,7 @@ var merge__default = /*#__PURE__*/_interopDefault(merge);
|
|
|
13
14
|
|
|
14
15
|
var pkg = {
|
|
15
16
|
name: "@promster/fastify",
|
|
16
|
-
version: "
|
|
17
|
+
version: "9.0.1",
|
|
17
18
|
description: "Fastify server integrations of promster",
|
|
18
19
|
main: "dist/promster-fastify.cjs.js",
|
|
19
20
|
typings: "dist/promster-fastify.cjs.d.ts",
|
|
@@ -49,14 +50,15 @@ var pkg = {
|
|
|
49
50
|
"prometheus"
|
|
50
51
|
],
|
|
51
52
|
dependencies: {
|
|
52
|
-
"@promster/metrics": "^
|
|
53
|
+
"@promster/metrics": "^11.0.0",
|
|
54
|
+
"@promster/types": "^5.0.0",
|
|
53
55
|
"fastify-plugin": "^4.4.0",
|
|
54
56
|
"merge-options": "3.0.4",
|
|
55
57
|
"parse-prometheus-text-format": "1.1.1",
|
|
56
58
|
"@promster/server": "workspace:*"
|
|
57
59
|
},
|
|
58
60
|
devDependencies: {
|
|
59
|
-
fastify: "4.
|
|
61
|
+
fastify: "4.22.1"
|
|
60
62
|
}
|
|
61
63
|
};
|
|
62
64
|
|
|
@@ -83,7 +85,9 @@ const signalIsNotUp = () => {
|
|
|
83
85
|
});
|
|
84
86
|
};
|
|
85
87
|
const createPlugin = async (fastify, options) => {
|
|
86
|
-
const allDefaultedOptions = merge__default["default"](metrics.createHttpMetrics.defaultOptions, metrics.createGcMetrics.defaultOptions, metrics.createRequestRecorder.defaultOptions,
|
|
88
|
+
const allDefaultedOptions = merge__default["default"](metrics.createHttpMetrics.defaultOptions, metrics.createGcMetrics.defaultOptions, metrics.createRequestRecorder.defaultOptions,
|
|
89
|
+
// @ts-expect-error
|
|
90
|
+
metrics.createGcObserver.defaultOptions, metrics.defaultNormalizers, options);
|
|
87
91
|
const shouldSkipMetricsByEnvironment = metrics.skipMetricsInEnvironment(allDefaultedOptions);
|
|
88
92
|
const httpMetrics = metrics.createHttpMetrics(allDefaultedOptions);
|
|
89
93
|
const gcMetrics = metrics.createGcMetrics(allDefaultedOptions);
|
|
@@ -108,6 +112,7 @@ const createPlugin = async (fastify, options) => {
|
|
|
108
112
|
req: request,
|
|
109
113
|
res: reply
|
|
110
114
|
}),
|
|
115
|
+
// eslint-disable-next-line camelcase
|
|
111
116
|
status_code: allDefaultedOptions.normalizeStatusCode(reply.statusCode, {
|
|
112
117
|
req: request,
|
|
113
118
|
res: reply
|
|
@@ -163,3 +168,9 @@ exports.getRequestRecorder = getRequestRecorder;
|
|
|
163
168
|
exports.plugin = plugin;
|
|
164
169
|
exports.signalIsNotUp = signalIsNotUp;
|
|
165
170
|
exports.signalIsUp = signalIsUp;
|
|
171
|
+
Object.keys(types).forEach(function (k) {
|
|
172
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
173
|
+
enumerable: true,
|
|
174
|
+
get: function () { return types[k]; }
|
|
175
|
+
});
|
|
176
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promster/fastify",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "Fastify server integrations of promster",
|
|
5
5
|
"main": "dist/promster-fastify.cjs.js",
|
|
6
6
|
"typings": "dist/promster-fastify.cjs.d.ts",
|
|
@@ -36,13 +36,14 @@
|
|
|
36
36
|
"prometheus"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@promster/metrics": "^
|
|
39
|
+
"@promster/metrics": "^11.0.0",
|
|
40
|
+
"@promster/types": "^5.0.0",
|
|
40
41
|
"fastify-plugin": "^4.4.0",
|
|
41
42
|
"merge-options": "3.0.4",
|
|
42
43
|
"parse-prometheus-text-format": "1.1.1",
|
|
43
|
-
"@promster/server": "
|
|
44
|
+
"@promster/server": "9.0.0"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"fastify": "4.
|
|
47
|
+
"fastify": "4.22.1"
|
|
47
48
|
}
|
|
48
49
|
}
|