@tramvai/tokens-metrics 7.35.7 → 7.36.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/index.d.ts CHANGED
@@ -1,10 +1,19 @@
1
1
  import type { Counter, CounterConfiguration, Gauge, GaugeConfiguration, Histogram, HistogramConfiguration, Summary, SummaryConfiguration } from 'prom-client';
2
+ import type LRUCache from '@tinkoff/lru-cache-nano';
2
3
  interface Metrics {
3
4
  counter<T extends string = string>(opt: CounterConfiguration<T>): Counter<T>;
4
5
  gauge<T extends string = string>(opt: GaugeConfiguration<T>): Gauge<T>;
5
6
  histogram<T extends string = string>(opt: HistogramConfiguration<T>): Histogram<T>;
6
7
  summary<T extends string = string>(opt: SummaryConfiguration<T>): Summary<T>;
7
8
  }
9
+ export type MetricsInstances = {
10
+ requestsTotal: Counter<'status' | 'method' | 'service'>;
11
+ requestsErrors: Counter<'status' | 'method' | 'service'>;
12
+ requestsDuration: Histogram<'status' | 'method' | 'service'>;
13
+ dnsResolveDuration: Histogram<'service'>;
14
+ tcpConnectDuration: Histogram<'service'>;
15
+ tlsHandshakeDuration: Histogram<'service'>;
16
+ };
8
17
  export type ModuleConfig = {
9
18
  enableConnectionResolveMetrics: boolean;
10
19
  };
@@ -42,4 +51,10 @@ export declare const REGISTER_INSTANT_METRIC_TOKEN: [string, Counter<string>] &
42
51
  export declare const METRICS_MODULE_CONFIG_TOKEN: ModuleConfig & {
43
52
  __type?: "base token" | undefined;
44
53
  };
54
+ export declare const METRICS_IP_HOST_CACHE: LRUCache<string, string> & {
55
+ __type?: "base token" | undefined;
56
+ };
57
+ export declare const REQUEST_METRICS_INSTANCES: MetricsInstances & {
58
+ __type?: "base token" | undefined;
59
+ };
45
60
  //# sourceMappingURL=index.d.ts.map
package/lib/index.es.js CHANGED
@@ -20,5 +20,7 @@ const REGISTER_INSTANT_METRIC_TOKEN = createToken('registerInstantMetric');
20
20
  * Configuration for the metrics
21
21
  */
22
22
  const METRICS_MODULE_CONFIG_TOKEN = createToken('metrics-module-config');
23
+ const METRICS_IP_HOST_CACHE = createToken('metricsLRUIpHostCache');
24
+ const REQUEST_METRICS_INSTANCES = createToken('requestMetricsInstances');
23
25
 
24
- export { METRICS_MODULE_CONFIG_TOKEN, METRICS_MODULE_TOKEN, METRICS_SERVICES_REGISTRY_TOKEN, REGISTER_INSTANT_METRIC_TOKEN };
26
+ export { METRICS_IP_HOST_CACHE, METRICS_MODULE_CONFIG_TOKEN, METRICS_MODULE_TOKEN, METRICS_SERVICES_REGISTRY_TOKEN, REGISTER_INSTANT_METRIC_TOKEN, REQUEST_METRICS_INSTANCES };
package/lib/index.js CHANGED
@@ -24,8 +24,12 @@ const REGISTER_INSTANT_METRIC_TOKEN = dippy.createToken('registerInstantMetric')
24
24
  * Configuration for the metrics
25
25
  */
26
26
  const METRICS_MODULE_CONFIG_TOKEN = dippy.createToken('metrics-module-config');
27
+ const METRICS_IP_HOST_CACHE = dippy.createToken('metricsLRUIpHostCache');
28
+ const REQUEST_METRICS_INSTANCES = dippy.createToken('requestMetricsInstances');
27
29
 
30
+ exports.METRICS_IP_HOST_CACHE = METRICS_IP_HOST_CACHE;
28
31
  exports.METRICS_MODULE_CONFIG_TOKEN = METRICS_MODULE_CONFIG_TOKEN;
29
32
  exports.METRICS_MODULE_TOKEN = METRICS_MODULE_TOKEN;
30
33
  exports.METRICS_SERVICES_REGISTRY_TOKEN = METRICS_SERVICES_REGISTRY_TOKEN;
31
34
  exports.REGISTER_INSTANT_METRIC_TOKEN = REGISTER_INSTANT_METRIC_TOKEN;
35
+ exports.REQUEST_METRICS_INSTANCES = REQUEST_METRICS_INSTANCES;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/tokens-metrics",
3
- "version": "7.35.7",
3
+ "version": "7.36.0",
4
4
  "description": "Tramvai tokens for @tramvai/module-metrics",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.es.js",