-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtypes.go
86 lines (72 loc) · 2.22 KB
/
types.go
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package metrics
type ExporterType string
const (
ETPrometheus ExporterType = "prometheus"
ETGraphite ExporterType = "graphite"
)
type TraceConfig struct {
JaegerTracingEnabled bool `json:"jaegerTracingEnabled"`
ProbabilitySampler float64 `json:"probabilitySampler"`
JaegerEndpoint string `json:"jaegerEndpoint"`
ServerName string `json:"servername"`
}
func DefaultTraceConfig() *TraceConfig {
return &TraceConfig{
JaegerTracingEnabled: false,
JaegerEndpoint: "localhost:6831",
ProbabilitySampler: 1.0,
ServerName: "",
}
}
type MetricsPrometheusExporterConfig struct {
RegistryType string `json:"registryType"`
Namespace string `json:"namespace"`
EndPoint string `json:"endPoint"`
Path string `json:"path"`
ReportingPeriod string `json:"reportingPeriod"`
}
func newMetricsPrometheusExporterConfig() *MetricsPrometheusExporterConfig {
return &MetricsPrometheusExporterConfig{
RegistryType: "define",
Namespace: "",
EndPoint: "/ip4/0.0.0.0/tcp/4568",
Path: "/debug/metrics",
ReportingPeriod: "10s",
}
}
type MetricsGraphiteExporterConfig struct {
Namespace string `json:"namespace"`
Host string `json:"host"`
Port int `json:"port"`
ReportingPeriod string `json:"reportingPeriod"`
}
func newMetricsGraphiteExporterConfig() *MetricsGraphiteExporterConfig {
return &MetricsGraphiteExporterConfig{
Namespace: "",
Host: "127.0.0.1",
Port: 4568,
ReportingPeriod: "10s",
}
}
type MetricsExporterConfig struct {
Type ExporterType `json:"type"`
Prometheus *MetricsPrometheusExporterConfig `json:"prometheus"`
Graphite *MetricsGraphiteExporterConfig `json:"graphite"`
}
func newDefaultMetricsExporterConfig() *MetricsExporterConfig {
return &MetricsExporterConfig{
Type: ETPrometheus,
Prometheus: newMetricsPrometheusExporterConfig(),
Graphite: newMetricsGraphiteExporterConfig(),
}
}
type MetricsConfig struct {
Enabled bool `json:"enabled"`
Exporter *MetricsExporterConfig `json:"exporter"`
}
func DefaultMetricsConfig() *MetricsConfig {
return &MetricsConfig{
Enabled: false,
Exporter: newDefaultMetricsExporterConfig(),
}
}