forked from VeXell/pm2-prom-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
45 lines (35 loc) · 1018 Bytes
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { Aggregator } from 'prom-client';
type IValue = { labels: Record<string, string | number>; value: number; metricName?: string };
export const enum MetricType {
Counter = 'counter',
Gauge = 'gauge',
Histogram = 'histogram',
Summary = 'summary',
}
export type IBaseMetric = {
aggregator: Aggregator;
values: IValue[];
name: string;
help: string;
};
export type ICounterMetric = IBaseMetric & {
type: MetricType.Counter;
};
export type IGaugeMetric = IBaseMetric & {
type: MetricType.Gauge;
};
export type IHistogramMetric = IBaseMetric & {
type: MetricType.Histogram;
};
export type ISummaryMetric = IBaseMetric & {
type: MetricType.Summary;
};
export type IMetric = ICounterMetric | IGaugeMetric | IHistogramMetric | ISummaryMetric;
export type AppResponse = { metrics: IMetric[] };
export type PM2BusResponse = {
process?: { namespace: string; name: string; pm_id: number };
raw?: {
topic: string;
data?: AppResponse;
};
};