blob: 7f18b2ed55fb732342c063fe3864f65c01d2657c (
plain) (
blame)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
import axios, { AxiosResponse } from 'axios'
export interface Environment {
service: string
host: string
instance: string
tags: { [key: string]: string }
}
export interface Config {
version: string
environment: Environment
config: any
}
export enum ModuleKind {
Combined = "combined",
Metric = "metric",
Span = "span",
Plain = "plain",
Unknown = "unknown"
}
export interface Module {
name: string
description: string
kind: ModuleKind
enabled: boolean
started: boolean
}
export interface MetricInfo {
name: string
type: string
tags: { [key: string ]: string }
}
export interface ModuleRegistryStatus {
modules: Array<Module>
}
export interface MetricRegistryStatus {
metrics: Array<MetricInfo>
}
export class StatusApi {
public static configStatus(): Promise<Config> {
return axios.get("/status/config").then(response => {
const config = JSON.parse(response.data.config)
return {
version: response.data.version,
environment: response.data.environment,
config
}
})
}
public static moduleRegistryStatus(): Promise<ModuleRegistryStatus> {
return axios.get("/status/modules").then(response => {
return response.data as ModuleRegistryStatus
})
}
public static metricRegistryStatus(): Promise<MetricRegistryStatus> {
return axios.get("/status/metrics").then(response => {
return response.data as MetricRegistryStatus
})
}
}
|