forked from observatorium/loki-benchmarks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
147 lines (119 loc) · 3.36 KB
/
config.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
package config
import (
"fmt"
"time"
"github.com/prometheus/common/model"
)
type Logger struct {
Name string `yaml:"name"`
Namespace string `yaml:"namespace"`
Image string `yaml:"image"`
TenantID string `yaml:"tenantId"`
}
type Querier struct {
Name string `yaml:"name"`
Namespace string `yaml:"namespace"`
Image string `yaml:"image"`
TenantID string `yaml:"tenantId"`
}
type Metrics struct {
URL string `yaml:"url"`
Jobs map[string]MetricsJob `yaml:"jobs"`
CadvisorJobs map[string]MetricsJob `yaml:"cadvisorJobs"`
EnableCadvisorMetrics bool `yaml:"enableCadvisorMetrics"`
}
type MetricsJob struct {
Job string `yaml:"job"`
QueryLabel string `yaml:"queryLabel"`
}
func (m *Metrics) DistributorJob() MetricsJob {
job, ok := m.Jobs["distributor"]
if !ok {
return MetricsJob{Job: "", QueryLabel: "job"}
}
return job
}
func (m *Metrics) CadvisorIngesterJob() MetricsJob {
job, ok := m.CadvisorJobs["ingester"]
if !ok {
return MetricsJob{Job: "cadvisor_ingesters", QueryLabel: "job"}
}
return job
}
func (m *Metrics) CadvisorQuerierJob() MetricsJob {
job, ok := m.CadvisorJobs["querier"]
if !ok {
return MetricsJob{Job: "cadvisor_querier", QueryLabel: "job"}
}
return job
}
func (m *Metrics) IngesterJob() MetricsJob {
job, ok := m.Jobs["ingester"]
if !ok {
return MetricsJob{Job: "", QueryLabel: "job"}
}
return job
}
func (m *Metrics) QuerierJob() MetricsJob {
job, ok := m.Jobs["querier"]
if !ok {
return MetricsJob{Job: "", QueryLabel: "job"}
}
return job
}
func (m *Metrics) QueryFrontendJob() MetricsJob {
job, ok := m.Jobs["queryFrontend"]
if !ok {
return MetricsJob{Job: "", QueryLabel: "job"}
}
return job
}
type Loki struct {
Distributor string `yaml:"distributor"`
QueryFrontend string `yaml:"queryFrontend"`
}
func (lc *Loki) PushURL() string {
return fmt.Sprintf("%s/loki/api/v1/push", lc.Distributor)
}
type Writers struct {
Replicas int32 `yaml:"replicas"`
Args map[string]string `yaml:"args"`
Command string `yaml:"command"`
}
type Readers struct {
Replicas int32 `yaml:"replicas"`
Args map[string]string `yaml:"args"`
Command string `yaml:"command"`
StartThreshold float64 `yaml:"startThreshold"`
Queries map[string]string `yaml:"queries"`
}
type Samples struct {
Interval time.Duration `yaml:"interval"`
Range model.Duration `yaml:"range"`
Total int `yaml:"total"`
}
type HighVolumeWrites struct {
Enabled bool `yaml:"enabled"`
Configurations []Configuration `yaml:"configurations"`
}
type HighVolumeReads struct {
Enabled bool `yaml:"enabled"`
Configurations []Configuration `yaml:"configurations"`
}
type Configuration struct {
Description string `yaml:"description"`
Samples Samples `yaml:"samples"`
Readers *Readers `yaml:"readers,omitempty"`
Writers *Writers `yaml:"writers,omitempty"`
}
type Scenarios struct {
HighVolumeWrites HighVolumeWrites `yaml:"highVolumeWrites"`
HighVolumeReads HighVolumeReads `yaml:"highVolumeReads"`
}
type Benchmark struct {
Logger *Logger `yaml:"logger"`
Querier *Querier `yaml:"querier"`
Metrics *Metrics `yaml:"metrics"`
Loki *Loki `yaml:"loki"`
Scenarios *Scenarios `yaml:"scenarios"`
}