-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
generated_config.go
260 lines (246 loc) · 8.52 KB
/
generated_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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
// Code generated by mdatagen. DO NOT EDIT.
package metadata
import (
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/collector/filter"
)
// MetricConfig provides common config for a particular metric.
type MetricConfig struct {
Enabled bool `mapstructure:"enabled"`
enabledSetByUser bool
}
func (ms *MetricConfig) Unmarshal(parser *confmap.Conf) error {
if parser == nil {
return nil
}
err := parser.Unmarshal(ms)
if err != nil {
return err
}
ms.enabledSetByUser = parser.IsSet("enabled")
return nil
}
// MetricsConfig provides config for mysql metrics.
type MetricsConfig struct {
MysqlBufferPoolDataPages MetricConfig `mapstructure:"mysql.buffer_pool.data_pages"`
MysqlBufferPoolLimit MetricConfig `mapstructure:"mysql.buffer_pool.limit"`
MysqlBufferPoolOperations MetricConfig `mapstructure:"mysql.buffer_pool.operations"`
MysqlBufferPoolPageFlushes MetricConfig `mapstructure:"mysql.buffer_pool.page_flushes"`
MysqlBufferPoolPages MetricConfig `mapstructure:"mysql.buffer_pool.pages"`
MysqlBufferPoolUsage MetricConfig `mapstructure:"mysql.buffer_pool.usage"`
MysqlClientNetworkIo MetricConfig `mapstructure:"mysql.client.network.io"`
MysqlCommands MetricConfig `mapstructure:"mysql.commands"`
MysqlConnectionCount MetricConfig `mapstructure:"mysql.connection.count"`
MysqlConnectionErrors MetricConfig `mapstructure:"mysql.connection.errors"`
MysqlDoubleWrites MetricConfig `mapstructure:"mysql.double_writes"`
MysqlHandlers MetricConfig `mapstructure:"mysql.handlers"`
MysqlIndexIoWaitCount MetricConfig `mapstructure:"mysql.index.io.wait.count"`
MysqlIndexIoWaitTime MetricConfig `mapstructure:"mysql.index.io.wait.time"`
MysqlJoins MetricConfig `mapstructure:"mysql.joins"`
MysqlLocks MetricConfig `mapstructure:"mysql.locks"`
MysqlLogOperations MetricConfig `mapstructure:"mysql.log_operations"`
MysqlMysqlxConnections MetricConfig `mapstructure:"mysql.mysqlx_connections"`
MysqlMysqlxWorkerThreads MetricConfig `mapstructure:"mysql.mysqlx_worker_threads"`
MysqlOpenedResources MetricConfig `mapstructure:"mysql.opened_resources"`
MysqlOperations MetricConfig `mapstructure:"mysql.operations"`
MysqlPageOperations MetricConfig `mapstructure:"mysql.page_operations"`
MysqlPreparedStatements MetricConfig `mapstructure:"mysql.prepared_statements"`
MysqlQueryClientCount MetricConfig `mapstructure:"mysql.query.client.count"`
MysqlQueryCount MetricConfig `mapstructure:"mysql.query.count"`
MysqlQuerySlowCount MetricConfig `mapstructure:"mysql.query.slow.count"`
MysqlReplicaSQLDelay MetricConfig `mapstructure:"mysql.replica.sql_delay"`
MysqlReplicaTimeBehindSource MetricConfig `mapstructure:"mysql.replica.time_behind_source"`
MysqlRowLocks MetricConfig `mapstructure:"mysql.row_locks"`
MysqlRowOperations MetricConfig `mapstructure:"mysql.row_operations"`
MysqlSorts MetricConfig `mapstructure:"mysql.sorts"`
MysqlStatementEventCount MetricConfig `mapstructure:"mysql.statement_event.count"`
MysqlStatementEventWaitTime MetricConfig `mapstructure:"mysql.statement_event.wait.time"`
MysqlTableIoWaitCount MetricConfig `mapstructure:"mysql.table.io.wait.count"`
MysqlTableIoWaitTime MetricConfig `mapstructure:"mysql.table.io.wait.time"`
MysqlTableLockWaitReadCount MetricConfig `mapstructure:"mysql.table.lock_wait.read.count"`
MysqlTableLockWaitReadTime MetricConfig `mapstructure:"mysql.table.lock_wait.read.time"`
MysqlTableLockWaitWriteCount MetricConfig `mapstructure:"mysql.table.lock_wait.write.count"`
MysqlTableLockWaitWriteTime MetricConfig `mapstructure:"mysql.table.lock_wait.write.time"`
MysqlTableOpenCache MetricConfig `mapstructure:"mysql.table_open_cache"`
MysqlThreads MetricConfig `mapstructure:"mysql.threads"`
MysqlTmpResources MetricConfig `mapstructure:"mysql.tmp_resources"`
MysqlUptime MetricConfig `mapstructure:"mysql.uptime"`
}
func DefaultMetricsConfig() MetricsConfig {
return MetricsConfig{
MysqlBufferPoolDataPages: MetricConfig{
Enabled: true,
},
MysqlBufferPoolLimit: MetricConfig{
Enabled: true,
},
MysqlBufferPoolOperations: MetricConfig{
Enabled: true,
},
MysqlBufferPoolPageFlushes: MetricConfig{
Enabled: true,
},
MysqlBufferPoolPages: MetricConfig{
Enabled: true,
},
MysqlBufferPoolUsage: MetricConfig{
Enabled: true,
},
MysqlClientNetworkIo: MetricConfig{
Enabled: false,
},
MysqlCommands: MetricConfig{
Enabled: false,
},
MysqlConnectionCount: MetricConfig{
Enabled: false,
},
MysqlConnectionErrors: MetricConfig{
Enabled: false,
},
MysqlDoubleWrites: MetricConfig{
Enabled: true,
},
MysqlHandlers: MetricConfig{
Enabled: true,
},
MysqlIndexIoWaitCount: MetricConfig{
Enabled: true,
},
MysqlIndexIoWaitTime: MetricConfig{
Enabled: true,
},
MysqlJoins: MetricConfig{
Enabled: false,
},
MysqlLocks: MetricConfig{
Enabled: true,
},
MysqlLogOperations: MetricConfig{
Enabled: true,
},
MysqlMysqlxConnections: MetricConfig{
Enabled: true,
},
MysqlMysqlxWorkerThreads: MetricConfig{
Enabled: false,
},
MysqlOpenedResources: MetricConfig{
Enabled: true,
},
MysqlOperations: MetricConfig{
Enabled: true,
},
MysqlPageOperations: MetricConfig{
Enabled: true,
},
MysqlPreparedStatements: MetricConfig{
Enabled: true,
},
MysqlQueryClientCount: MetricConfig{
Enabled: false,
},
MysqlQueryCount: MetricConfig{
Enabled: false,
},
MysqlQuerySlowCount: MetricConfig{
Enabled: false,
},
MysqlReplicaSQLDelay: MetricConfig{
Enabled: false,
},
MysqlReplicaTimeBehindSource: MetricConfig{
Enabled: false,
},
MysqlRowLocks: MetricConfig{
Enabled: true,
},
MysqlRowOperations: MetricConfig{
Enabled: true,
},
MysqlSorts: MetricConfig{
Enabled: true,
},
MysqlStatementEventCount: MetricConfig{
Enabled: false,
},
MysqlStatementEventWaitTime: MetricConfig{
Enabled: false,
},
MysqlTableIoWaitCount: MetricConfig{
Enabled: true,
},
MysqlTableIoWaitTime: MetricConfig{
Enabled: true,
},
MysqlTableLockWaitReadCount: MetricConfig{
Enabled: false,
},
MysqlTableLockWaitReadTime: MetricConfig{
Enabled: false,
},
MysqlTableLockWaitWriteCount: MetricConfig{
Enabled: false,
},
MysqlTableLockWaitWriteTime: MetricConfig{
Enabled: false,
},
MysqlTableOpenCache: MetricConfig{
Enabled: false,
},
MysqlThreads: MetricConfig{
Enabled: true,
},
MysqlTmpResources: MetricConfig{
Enabled: true,
},
MysqlUptime: MetricConfig{
Enabled: true,
},
}
}
// ResourceAttributeConfig provides common config for a particular resource attribute.
type ResourceAttributeConfig struct {
Enabled bool `mapstructure:"enabled"`
// Experimental: MetricsInclude defines a list of filters for attribute values.
// If the list is not empty, only metrics with matching resource attribute values will be emitted.
MetricsInclude []filter.Config `mapstructure:"metrics_include"`
// Experimental: MetricsExclude defines a list of filters for attribute values.
// If the list is not empty, metrics with matching resource attribute values will not be emitted.
// MetricsInclude has higher priority than MetricsExclude.
MetricsExclude []filter.Config `mapstructure:"metrics_exclude"`
enabledSetByUser bool
}
func (rac *ResourceAttributeConfig) Unmarshal(parser *confmap.Conf) error {
if parser == nil {
return nil
}
err := parser.Unmarshal(rac)
if err != nil {
return err
}
rac.enabledSetByUser = parser.IsSet("enabled")
return nil
}
// ResourceAttributesConfig provides config for mysql resource attributes.
type ResourceAttributesConfig struct {
MysqlInstanceEndpoint ResourceAttributeConfig `mapstructure:"mysql.instance.endpoint"`
}
func DefaultResourceAttributesConfig() ResourceAttributesConfig {
return ResourceAttributesConfig{
MysqlInstanceEndpoint: ResourceAttributeConfig{
Enabled: true,
},
}
}
// MetricsBuilderConfig is a configuration for mysql metrics builder.
type MetricsBuilderConfig struct {
Metrics MetricsConfig `mapstructure:"metrics"`
ResourceAttributes ResourceAttributesConfig `mapstructure:"resource_attributes"`
}
func DefaultMetricsBuilderConfig() MetricsBuilderConfig {
return MetricsBuilderConfig{
Metrics: DefaultMetricsConfig(),
ResourceAttributes: DefaultResourceAttributesConfig(),
}
}