@tramvai/module-metrics 1.94.0 → 1.94.5
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/lib/server.es.js +15 -4
- package/lib/server.js +14 -3
- package/package.json +10 -10
package/lib/server.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
2
|
import { Module, commandLineListTokens, Scope, createToken, provide } from '@tramvai/core';
|
|
3
3
|
import { SERVER_MODULE_PAPI_PUBLIC_ROUTE, SERVER_TOKEN, SPECIAL_SERVER_PATHS } from '@tramvai/tokens-server';
|
|
4
|
-
import { SERVER_FACTORY_TOKEN, WEB_FASTIFY_APP_TOKEN, WEB_FASTIFY_APP_FACTORY_TOKEN, WEB_FASTIFY_APP_BEFORE_INIT_TOKEN } from '@tramvai/tokens-server-private';
|
|
4
|
+
import { SERVER_FACTORY_TOKEN, WEB_FASTIFY_APP_TOKEN, WEB_FASTIFY_APP_FACTORY_TOKEN, WEB_FASTIFY_APP_BEFORE_INIT_TOKEN, WEB_FASTIFY_APP_INIT_TOKEN } from '@tramvai/tokens-server-private';
|
|
5
5
|
import { METRICS_MODULE_TOKEN, METRICS_SERVICES_REGISTRY_TOKEN, METRICS_MODULE_CONFIG_TOKEN, REGISTER_INSTANT_METRIC_TOKEN } from '@tramvai/tokens-metrics';
|
|
6
6
|
export * from '@tramvai/tokens-metrics';
|
|
7
7
|
import { fastifyMeasureRequests } from '@tinkoff/measure-fastify-requests';
|
|
@@ -561,12 +561,24 @@ MetricsModule = __decorate([
|
|
|
561
561
|
}),
|
|
562
562
|
provide({
|
|
563
563
|
provide: WEB_FASTIFY_APP_BEFORE_INIT_TOKEN,
|
|
564
|
-
useFactory: ({ app,
|
|
564
|
+
useFactory: ({ app, registry }) => {
|
|
565
565
|
return async () => {
|
|
566
566
|
app.all('/metrics', async (_, res) => {
|
|
567
567
|
res.type(registry.contentType);
|
|
568
568
|
return registry.metrics();
|
|
569
569
|
});
|
|
570
|
+
};
|
|
571
|
+
},
|
|
572
|
+
deps: {
|
|
573
|
+
app: METRICS_WEB_APP_TOKEN,
|
|
574
|
+
registry: 'metricsDefaultRegistry',
|
|
575
|
+
},
|
|
576
|
+
multi: true,
|
|
577
|
+
}),
|
|
578
|
+
provide({
|
|
579
|
+
provide: WEB_FASTIFY_APP_INIT_TOKEN,
|
|
580
|
+
useFactory: ({ app, metrics, additionalLabelNamesList, getAdditionalLabelValuesList, httpRequestsDurationBuckets, metricsExcludePaths, }) => {
|
|
581
|
+
return async () => {
|
|
570
582
|
await app.register(fastifyMeasureRequests, {
|
|
571
583
|
metrics,
|
|
572
584
|
metricsExcludePaths,
|
|
@@ -586,7 +598,7 @@ MetricsModule = __decorate([
|
|
|
586
598
|
},
|
|
587
599
|
deps: {
|
|
588
600
|
metrics: METRICS_MODULE_TOKEN,
|
|
589
|
-
app:
|
|
601
|
+
app: WEB_FASTIFY_APP_TOKEN,
|
|
590
602
|
additionalLabelNamesList: {
|
|
591
603
|
token: 'additionalLabelNames',
|
|
592
604
|
multi: true,
|
|
@@ -602,7 +614,6 @@ MetricsModule = __decorate([
|
|
|
602
614
|
optional: true,
|
|
603
615
|
},
|
|
604
616
|
metricsExcludePaths: SPECIAL_SERVER_PATHS,
|
|
605
|
-
registry: 'metricsDefaultRegistry',
|
|
606
617
|
},
|
|
607
618
|
multi: true,
|
|
608
619
|
}),
|
package/lib/server.js
CHANGED
|
@@ -574,12 +574,24 @@ exports.MetricsModule = tslib.__decorate([
|
|
|
574
574
|
}),
|
|
575
575
|
core.provide({
|
|
576
576
|
provide: tokensServerPrivate.WEB_FASTIFY_APP_BEFORE_INIT_TOKEN,
|
|
577
|
-
useFactory: ({ app,
|
|
577
|
+
useFactory: ({ app, registry }) => {
|
|
578
578
|
return async () => {
|
|
579
579
|
app.all('/metrics', async (_, res) => {
|
|
580
580
|
res.type(registry.contentType);
|
|
581
581
|
return registry.metrics();
|
|
582
582
|
});
|
|
583
|
+
};
|
|
584
|
+
},
|
|
585
|
+
deps: {
|
|
586
|
+
app: METRICS_WEB_APP_TOKEN,
|
|
587
|
+
registry: 'metricsDefaultRegistry',
|
|
588
|
+
},
|
|
589
|
+
multi: true,
|
|
590
|
+
}),
|
|
591
|
+
core.provide({
|
|
592
|
+
provide: tokensServerPrivate.WEB_FASTIFY_APP_INIT_TOKEN,
|
|
593
|
+
useFactory: ({ app, metrics, additionalLabelNamesList, getAdditionalLabelValuesList, httpRequestsDurationBuckets, metricsExcludePaths, }) => {
|
|
594
|
+
return async () => {
|
|
583
595
|
await app.register(measureFastifyRequests.fastifyMeasureRequests, {
|
|
584
596
|
metrics,
|
|
585
597
|
metricsExcludePaths,
|
|
@@ -599,7 +611,7 @@ exports.MetricsModule = tslib.__decorate([
|
|
|
599
611
|
},
|
|
600
612
|
deps: {
|
|
601
613
|
metrics: tokensMetrics.METRICS_MODULE_TOKEN,
|
|
602
|
-
app:
|
|
614
|
+
app: tokensServerPrivate.WEB_FASTIFY_APP_TOKEN,
|
|
603
615
|
additionalLabelNamesList: {
|
|
604
616
|
token: 'additionalLabelNames',
|
|
605
617
|
multi: true,
|
|
@@ -615,7 +627,6 @@ exports.MetricsModule = tslib.__decorate([
|
|
|
615
627
|
optional: true,
|
|
616
628
|
},
|
|
617
629
|
metricsExcludePaths: tokensServer.SPECIAL_SERVER_PATHS,
|
|
618
|
-
registry: 'metricsDefaultRegistry',
|
|
619
630
|
},
|
|
620
631
|
multi: true,
|
|
621
632
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-metrics",
|
|
3
|
-
"version": "1.94.
|
|
3
|
+
"version": "1.94.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"browser": "lib/browser.js",
|
|
6
6
|
"main": "lib/server.js",
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
"build-for-publish": "true"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@tramvai/core": "1.94.
|
|
23
|
-
"@tramvai/tokens-common": "1.94.
|
|
24
|
-
"@tramvai/tokens-server": "1.94.
|
|
25
|
-
"@tramvai/tokens-server-private": "1.94.
|
|
26
|
-
"@tramvai/tokens-metrics": "1.94.
|
|
27
|
-
"@tramvai/module-common": "1.94.
|
|
28
|
-
"@tramvai/tokens-http-client": "1.94.
|
|
29
|
-
"@tramvai/state": "1.94.
|
|
30
|
-
"@tramvai/papi": "1.94.
|
|
22
|
+
"@tramvai/core": "1.94.5",
|
|
23
|
+
"@tramvai/tokens-common": "1.94.5",
|
|
24
|
+
"@tramvai/tokens-server": "1.94.5",
|
|
25
|
+
"@tramvai/tokens-server-private": "1.94.5",
|
|
26
|
+
"@tramvai/tokens-metrics": "1.94.5",
|
|
27
|
+
"@tramvai/module-common": "1.94.5",
|
|
28
|
+
"@tramvai/tokens-http-client": "1.94.5",
|
|
29
|
+
"@tramvai/state": "1.94.5",
|
|
30
|
+
"@tramvai/papi": "1.94.5",
|
|
31
31
|
"@tinkoff/measure-fastify-requests": "0.0.1",
|
|
32
32
|
"@tinkoff/monkeypatch": "1.3.3",
|
|
33
33
|
"@tinkoff/url": "0.7.37",
|