@tramvai/module-metrics 1.109.0 → 2.0.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/lib/browser.js CHANGED
@@ -5,6 +5,7 @@ import { METRICS_MODULE_TOKEN } from '@tramvai/tokens-metrics';
5
5
  export * from '@tramvai/tokens-metrics';
6
6
  import { browserTimings } from '@tinkoff/browser-timings';
7
7
  import { Histogram, Summary, Gauge, Counter } from '@tinkoff/metrics-noop';
8
+ import { PAGE_SERVICE_TOKEN } from '@tramvai/tokens-router';
8
9
  import { PAPI_SERVICE } from '@tramvai/tokens-http-client';
9
10
  import { RemoteReporter } from '@tinkoff/logger';
10
11
  import { createEvent, createReducer } from '@tramvai/state';
@@ -187,9 +188,10 @@ MetricsModule = __decorate([
187
188
  },
188
189
  {
189
190
  provide: commandLineListTokens.init,
190
- useFactory: ({ logger }) => () => {
191
+ useFactory: ({ logger, pageService }) => () => {
191
192
  window.addEventListener('load', () => {
192
193
  setTimeout(() => {
194
+ var _a, _b;
193
195
  const timings = browserTimings();
194
196
  const log = logger({
195
197
  name: 'metrics:perf',
@@ -204,6 +206,8 @@ MetricsModule = __decorate([
204
206
  log.info({
205
207
  ...timings,
206
208
  event: 'perf-timings',
209
+ deviceType: ((_a = navigator.userAgent) === null || _a === void 0 ? void 0 : _a.indexOf('Mobi')) !== -1 ? 'mobile' : 'desktop',
210
+ urlMask: (_b = pageService.getCurrentRoute()) === null || _b === void 0 ? void 0 : _b.path,
207
211
  });
208
212
  }, 0);
209
213
  });
@@ -211,6 +215,7 @@ MetricsModule = __decorate([
211
215
  multi: true,
212
216
  deps: {
213
217
  logger: LOGGER_TOKEN,
218
+ pageService: PAGE_SERVICE_TOKEN,
214
219
  },
215
220
  },
216
221
  ],
package/lib/server.es.js CHANGED
@@ -467,6 +467,7 @@ MetricsModule = __decorate([
467
467
  }),
468
468
  provide({
469
469
  provide: 'metricsDefaultRegistry',
470
+ scope: Scope.SINGLETON,
470
471
  useClass: Registry,
471
472
  }),
472
473
  provide({
package/lib/server.js CHANGED
@@ -480,6 +480,7 @@ exports.MetricsModule = tslib.__decorate([
480
480
  }),
481
481
  core.provide({
482
482
  provide: 'metricsDefaultRegistry',
483
+ scope: core.Scope.SINGLETON,
483
484
  useClass: promClient.Registry,
484
485
  }),
485
486
  core.provide({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-metrics",
3
- "version": "1.109.0",
3
+ "version": "2.0.0",
4
4
  "description": "",
5
5
  "browser": "lib/browser.js",
6
6
  "main": "lib/server.js",
@@ -19,14 +19,15 @@
19
19
  "build-for-publish": "true"
20
20
  },
21
21
  "dependencies": {
22
- "@tramvai/core": "1.109.0",
23
- "@tramvai/tokens-server": "1.109.0",
24
- "@tramvai/tokens-server-private": "1.109.0",
25
- "@tramvai/tokens-metrics": "1.109.0",
26
- "@tramvai/module-common": "1.109.0",
27
- "@tramvai/tokens-http-client": "1.109.0",
28
- "@tramvai/state": "1.109.0",
29
- "@tramvai/papi": "1.109.0",
22
+ "@tramvai/core": "2.0.0",
23
+ "@tramvai/tokens-server": "2.0.0",
24
+ "@tramvai/tokens-server-private": "2.0.0",
25
+ "@tramvai/tokens-metrics": "2.0.0",
26
+ "@tramvai/tokens-router": "2.0.0",
27
+ "@tramvai/module-common": "2.0.0",
28
+ "@tramvai/tokens-http-client": "2.0.0",
29
+ "@tramvai/state": "2.0.0",
30
+ "@tramvai/papi": "2.0.0",
30
31
  "@tinkoff/measure-fastify-requests": "0.0.3",
31
32
  "@tinkoff/monkeypatch": "1.3.4",
32
33
  "@tinkoff/url": "0.7.38",
@@ -34,7 +35,7 @@
34
35
  "prom-client": "^12.0.0",
35
36
  "@tinkoff/logger": "0.10.17",
36
37
  "@tinkoff/metrics-noop": "1.0.3",
37
- "@tinkoff/browser-timings": "0.9.5"
38
+ "@tinkoff/browser-timings": "0.9.6"
38
39
  },
39
40
  "peerDependencies": {
40
41
  "tslib": "^2.0.3"