forked from open-telemetry/opentelemetry-collector-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generated_config.go
164 lines (152 loc) · 5.43 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
// Code generated by mdatagen. DO NOT EDIT.
package metadata
import "go.opentelemetry.io/collector/confmap"
// 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, confmap.WithErrorUnused())
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"`
PostgresqlBlocksRead MetricConfig `mapstructure:"postgresql.blocks_read"`
PostgresqlCommits MetricConfig `mapstructure:"postgresql.commits"`
PostgresqlConnectionMax MetricConfig `mapstructure:"postgresql.connection.max"`
PostgresqlDatabaseCount MetricConfig `mapstructure:"postgresql.database.count"`
PostgresqlDbSize MetricConfig `mapstructure:"postgresql.db_size"`
PostgresqlDeadlocks MetricConfig `mapstructure:"postgresql.deadlocks"`
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"`
PostgresqlTableCount MetricConfig `mapstructure:"postgresql.table.count"`
PostgresqlTableSize MetricConfig `mapstructure:"postgresql.table.size"`
PostgresqlTableVacuumCount MetricConfig `mapstructure:"postgresql.table.vacuum.count"`
PostgresqlWalAge MetricConfig `mapstructure:"postgresql.wal.age"`
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,
},
PostgresqlBlocksRead: MetricConfig{
Enabled: true,
},
PostgresqlCommits: MetricConfig{
Enabled: true,
},
PostgresqlConnectionMax: MetricConfig{
Enabled: true,
},
PostgresqlDatabaseCount: MetricConfig{
Enabled: true,
},
PostgresqlDbSize: MetricConfig{
Enabled: true,
},
PostgresqlDeadlocks: 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,
},
PostgresqlTableCount: MetricConfig{
Enabled: true,
},
PostgresqlTableSize: MetricConfig{
Enabled: true,
},
PostgresqlTableVacuumCount: MetricConfig{
Enabled: true,
},
PostgresqlWalAge: MetricConfig{
Enabled: true,
},
PostgresqlWalLag: MetricConfig{
Enabled: true,
},
}
}
// ResourceAttributeConfig provides common config for a particular resource attribute.
type ResourceAttributeConfig struct {
Enabled bool `mapstructure:"enabled"`
}
// ResourceAttributesConfig provides config for postgresql resource attributes.
type ResourceAttributesConfig struct {
PostgresqlDatabaseName ResourceAttributeConfig `mapstructure:"postgresql.database.name"`
PostgresqlIndexName ResourceAttributeConfig `mapstructure:"postgresql.index.name"`
PostgresqlTableName ResourceAttributeConfig `mapstructure:"postgresql.table.name"`
}
func DefaultResourceAttributesConfig() ResourceAttributesConfig {
return ResourceAttributesConfig{
PostgresqlDatabaseName: ResourceAttributeConfig{
Enabled: true,
},
PostgresqlIndexName: ResourceAttributeConfig{
Enabled: true,
},
PostgresqlTableName: 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(),
}
}