forked from open-telemetry/opentelemetry-collector-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerated_config.go
More file actions
305 lines (283 loc) · 10.2 KB
/
generated_config.go
File metadata and controls
305 lines (283 loc) · 10.2 KB
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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
// 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 postgresql metrics.
type MetricsConfig struct {
PostgresqlBackends MetricConfig `mapstructure:"postgresql.backends"`
PostgresqlBgwriterBuffersAllocated MetricConfig `mapstructure:"postgresql.bgwriter.buffers.allocated"`
PostgresqlBgwriterBuffersWrites MetricConfig `mapstructure:"postgresql.bgwriter.buffers.writes"`
PostgresqlBgwriterCheckpointCount MetricConfig `mapstructure:"postgresql.bgwriter.checkpoint.count"`
PostgresqlBgwriterDuration MetricConfig `mapstructure:"postgresql.bgwriter.duration"`
PostgresqlBgwriterMaxwritten MetricConfig `mapstructure:"postgresql.bgwriter.maxwritten"`
PostgresqlBlksHit MetricConfig `mapstructure:"postgresql.blks_hit"`
PostgresqlBlksRead MetricConfig `mapstructure:"postgresql.blks_read"`
PostgresqlBlocksRead MetricConfig `mapstructure:"postgresql.blocks_read"`
PostgresqlCommits MetricConfig `mapstructure:"postgresql.commits"`
PostgresqlConnectionMax MetricConfig `mapstructure:"postgresql.connection.max"`
PostgresqlDatabaseCount MetricConfig `mapstructure:"postgresql.database.count"`
PostgresqlDatabaseLocks MetricConfig `mapstructure:"postgresql.database.locks"`
PostgresqlDbSize MetricConfig `mapstructure:"postgresql.db_size"`
PostgresqlDeadlocks MetricConfig `mapstructure:"postgresql.deadlocks"`
PostgresqlFunctionCalls MetricConfig `mapstructure:"postgresql.function.calls"`
PostgresqlIndexScans MetricConfig `mapstructure:"postgresql.index.scans"`
PostgresqlIndexSize MetricConfig `mapstructure:"postgresql.index.size"`
PostgresqlOperations MetricConfig `mapstructure:"postgresql.operations"`
PostgresqlReplicationDataDelay MetricConfig `mapstructure:"postgresql.replication.data_delay"`
PostgresqlRollbacks MetricConfig `mapstructure:"postgresql.rollbacks"`
PostgresqlRows MetricConfig `mapstructure:"postgresql.rows"`
PostgresqlSequentialScans MetricConfig `mapstructure:"postgresql.sequential_scans"`
PostgresqlTableCount MetricConfig `mapstructure:"postgresql.table.count"`
PostgresqlTableSize MetricConfig `mapstructure:"postgresql.table.size"`
PostgresqlTableVacuumCount MetricConfig `mapstructure:"postgresql.table.vacuum.count"`
PostgresqlTempIo MetricConfig `mapstructure:"postgresql.temp.io"`
PostgresqlTempFiles MetricConfig `mapstructure:"postgresql.temp_files"`
PostgresqlTupDeleted MetricConfig `mapstructure:"postgresql.tup_deleted"`
PostgresqlTupFetched MetricConfig `mapstructure:"postgresql.tup_fetched"`
PostgresqlTupInserted MetricConfig `mapstructure:"postgresql.tup_inserted"`
PostgresqlTupReturned MetricConfig `mapstructure:"postgresql.tup_returned"`
PostgresqlTupUpdated MetricConfig `mapstructure:"postgresql.tup_updated"`
PostgresqlWalAge MetricConfig `mapstructure:"postgresql.wal.age"`
PostgresqlWalDelay MetricConfig `mapstructure:"postgresql.wal.delay"`
PostgresqlWalLag MetricConfig `mapstructure:"postgresql.wal.lag"`
}
func DefaultMetricsConfig() MetricsConfig {
return MetricsConfig{
PostgresqlBackends: MetricConfig{
Enabled: true,
},
PostgresqlBgwriterBuffersAllocated: MetricConfig{
Enabled: true,
},
PostgresqlBgwriterBuffersWrites: MetricConfig{
Enabled: true,
},
PostgresqlBgwriterCheckpointCount: MetricConfig{
Enabled: true,
},
PostgresqlBgwriterDuration: MetricConfig{
Enabled: true,
},
PostgresqlBgwriterMaxwritten: MetricConfig{
Enabled: true,
},
PostgresqlBlksHit: MetricConfig{
Enabled: false,
},
PostgresqlBlksRead: MetricConfig{
Enabled: false,
},
PostgresqlBlocksRead: MetricConfig{
Enabled: true,
},
PostgresqlCommits: MetricConfig{
Enabled: true,
},
PostgresqlConnectionMax: MetricConfig{
Enabled: true,
},
PostgresqlDatabaseCount: MetricConfig{
Enabled: true,
},
PostgresqlDatabaseLocks: MetricConfig{
Enabled: false,
},
PostgresqlDbSize: MetricConfig{
Enabled: true,
},
PostgresqlDeadlocks: MetricConfig{
Enabled: false,
},
PostgresqlFunctionCalls: MetricConfig{
Enabled: false,
},
PostgresqlIndexScans: MetricConfig{
Enabled: true,
},
PostgresqlIndexSize: MetricConfig{
Enabled: true,
},
PostgresqlOperations: MetricConfig{
Enabled: true,
},
PostgresqlReplicationDataDelay: MetricConfig{
Enabled: true,
},
PostgresqlRollbacks: MetricConfig{
Enabled: true,
},
PostgresqlRows: MetricConfig{
Enabled: true,
},
PostgresqlSequentialScans: MetricConfig{
Enabled: false,
},
PostgresqlTableCount: MetricConfig{
Enabled: true,
},
PostgresqlTableSize: MetricConfig{
Enabled: true,
},
PostgresqlTableVacuumCount: MetricConfig{
Enabled: true,
},
PostgresqlTempIo: MetricConfig{
Enabled: false,
},
PostgresqlTempFiles: MetricConfig{
Enabled: false,
},
PostgresqlTupDeleted: MetricConfig{
Enabled: false,
},
PostgresqlTupFetched: MetricConfig{
Enabled: false,
},
PostgresqlTupInserted: MetricConfig{
Enabled: false,
},
PostgresqlTupReturned: MetricConfig{
Enabled: false,
},
PostgresqlTupUpdated: MetricConfig{
Enabled: false,
},
PostgresqlWalAge: MetricConfig{
Enabled: true,
},
PostgresqlWalDelay: MetricConfig{
Enabled: false,
},
PostgresqlWalLag: MetricConfig{
Enabled: true,
},
}
}
// EventConfig provides common config for a particular event.
type EventConfig struct {
Enabled bool `mapstructure:"enabled"`
enabledSetByUser bool
}
func (ec *EventConfig) Unmarshal(parser *confmap.Conf) error {
if parser == nil {
return nil
}
err := parser.Unmarshal(ec)
if err != nil {
return err
}
ec.enabledSetByUser = parser.IsSet("enabled")
return nil
}
// EventsConfig provides config for postgresql events.
type EventsConfig struct {
DbServerQuerySample EventConfig `mapstructure:"db.server.query_sample"`
DbServerTopQuery EventConfig `mapstructure:"db.server.top_query"`
}
func DefaultEventsConfig() EventsConfig {
return EventsConfig{
DbServerQuerySample: EventConfig{
Enabled: false,
},
DbServerTopQuery: EventConfig{
Enabled: false,
},
}
}
// 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"`
// Experimental: EventsInclude defines a list of filters for attribute values.
// If the list is not empty, only events with matching resource attribute values will be emitted.
EventsInclude []filter.Config `mapstructure:"events_include"`
// Experimental: EventsExclude defines a list of filters for attribute values.
// If the list is not empty, events with matching resource attribute values will not be emitted.
// EventsInclude has higher priority than EventsExclude.
EventsExclude []filter.Config `mapstructure:"events_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 postgresql resource attributes.
type ResourceAttributesConfig struct {
PostgresqlDatabaseName ResourceAttributeConfig `mapstructure:"postgresql.database.name"`
PostgresqlIndexName ResourceAttributeConfig `mapstructure:"postgresql.index.name"`
PostgresqlSchemaName ResourceAttributeConfig `mapstructure:"postgresql.schema.name"`
PostgresqlTableName ResourceAttributeConfig `mapstructure:"postgresql.table.name"`
ServiceInstanceID ResourceAttributeConfig `mapstructure:"service.instance.id"`
}
func DefaultResourceAttributesConfig() ResourceAttributesConfig {
return ResourceAttributesConfig{
PostgresqlDatabaseName: ResourceAttributeConfig{
Enabled: true,
},
PostgresqlIndexName: ResourceAttributeConfig{
Enabled: true,
},
PostgresqlSchemaName: ResourceAttributeConfig{
Enabled: true,
},
PostgresqlTableName: ResourceAttributeConfig{
Enabled: true,
},
ServiceInstanceID: ResourceAttributeConfig{
Enabled: true,
},
}
}
// MetricsBuilderConfig is a configuration for postgresql metrics builder.
type MetricsBuilderConfig struct {
Metrics MetricsConfig `mapstructure:"metrics"`
ResourceAttributes ResourceAttributesConfig `mapstructure:"resource_attributes"`
}
func DefaultMetricsBuilderConfig() MetricsBuilderConfig {
return MetricsBuilderConfig{
Metrics: DefaultMetricsConfig(),
ResourceAttributes: DefaultResourceAttributesConfig(),
}
}
// LogsBuilderConfig is a configuration for postgresql logs builder.
type LogsBuilderConfig struct {
Events EventsConfig `mapstructure:"events"`
ResourceAttributes ResourceAttributesConfig `mapstructure:"resource_attributes"`
}
func DefaultLogsBuilderConfig() LogsBuilderConfig {
return LogsBuilderConfig{
Events: DefaultEventsConfig(),
ResourceAttributes: DefaultResourceAttributesConfig(),
}
}