@@ -41,7 +41,7 @@ func (r MetricsReceiverCouchbase) Type() string {
41
41
}
42
42
43
43
// Pipelines will construct the prometheus receiver configuration
44
- func (r MetricsReceiverCouchbase ) Pipelines () []otel.Pipeline {
44
+ func (r MetricsReceiverCouchbase ) Pipelines () []otel.ReceiverPipeline {
45
45
targets := []string {r .Endpoint }
46
46
if r .Endpoint == "" {
47
47
targets = []string {defaultCouchbaseEndpoint }
@@ -73,96 +73,94 @@ func (r MetricsReceiverCouchbase) Pipelines() []otel.Pipeline {
73
73
},
74
74
},
75
75
}
76
- return []otel.Pipeline {
77
- {
78
- Receiver : otel.Component {
79
- Type : "prometheus" ,
80
- Config : config ,
81
- },
82
- Processors : []otel.Component {
83
- otel .NormalizeSums (),
84
- // remove prometheus scraping meta-metrics
85
- otel .MetricsFilter ("exclude" , "strict" ,
86
- "scrape_samples_post_metric_relabeling" ,
87
- "scrape_series_added" ,
88
- "scrape_duration_seconds" ,
89
- "scrape_samples_scraped" ,
90
- "up" ,
76
+ return []otel.ReceiverPipeline {{
77
+ Receiver : otel.Component {
78
+ Type : "prometheus" ,
79
+ Config : config ,
80
+ },
81
+ Processors : map [string ][]otel.Component {"metrics" : {
82
+ otel .NormalizeSums (),
83
+ // remove prometheus scraping meta-metrics
84
+ otel .MetricsFilter ("exclude" , "strict" ,
85
+ "scrape_samples_post_metric_relabeling" ,
86
+ "scrape_series_added" ,
87
+ "scrape_duration_seconds" ,
88
+ "scrape_samples_scraped" ,
89
+ "up" ,
90
+ ),
91
+ otel .MetricsTransform (
92
+ // renaming from prometheus style to otel style, order is important before workload prefix
93
+ otel .RenameMetric (
94
+ "kv_ops" ,
95
+ "couchbase.bucket.operation.count" ,
96
+ otel .ToggleScalarDataType ,
97
+ otel .RenameLabel ("bucket" , "bucket_name" ),
98
+ ),
99
+ otel .RenameMetric (
100
+ "kv_vb_curr_items" ,
101
+ "couchbase.bucket.item.count" ,
102
+ otel .RenameLabel ("bucket" , "bucket_name" ),
103
+ ),
104
+ otel .RenameMetric (
105
+ "kv_num_vbuckets" ,
106
+ "couchbase.bucket.vbucket.count" ,
107
+ otel .RenameLabel ("bucket" , "bucket_name" ),
108
+ ),
109
+ otel .RenameMetric (
110
+ "kv_total_memory_used_bytes" ,
111
+ "couchbase.bucket.memory.usage" ,
112
+ otel .RenameLabel ("bucket" , "bucket_name" ),
113
+ ),
114
+ otel .RenameMetric (
115
+ "kv_ep_num_value_ejects" ,
116
+ "couchbase.bucket.item.ejection.count" ,
117
+ otel .ToggleScalarDataType ,
118
+ otel .RenameLabel ("bucket" , "bucket_name" ),
119
+ ),
120
+ otel .RenameMetric (
121
+ "kv_ep_mem_high_wat" ,
122
+ "couchbase.bucket.memory.high_water_mark.limit" ,
123
+ otel .RenameLabel ("bucket" , "bucket_name" )),
124
+ otel .RenameMetric (
125
+ "kv_ep_mem_low_wat" ,
126
+ "couchbase.bucket.memory.low_water_mark.limit" ,
127
+ otel .RenameLabel ("bucket" , "bucket_name" ),
128
+ ),
129
+ otel .RenameMetric (
130
+ "kv_ep_tmp_oom_errors" ,
131
+ "couchbase.bucket.error.oom.count.recoverable" ,
132
+ otel .ToggleScalarDataType ,
133
+ otel .RenameLabel ("bucket" , "bucket_name" ),
134
+ ),
135
+ otel .RenameMetric (
136
+ "kv_ep_oom_errors" ,
137
+ "couchbase.bucket.error.oom.count.unrecoverable" ,
138
+ otel .ToggleScalarDataType ,
139
+ otel .RenameLabel ("bucket" , "bucket_name" ),
91
140
),
92
- otel .MetricsTransform (
93
- // renaming from prometheus style to otel style, order is important before workload prefix
94
- otel .RenameMetric (
95
- "kv_ops" ,
96
- "couchbase.bucket.operation.count" ,
97
- otel .ToggleScalarDataType ,
98
- otel .RenameLabel ("bucket" , "bucket_name" ),
99
- ),
100
- otel .RenameMetric (
101
- "kv_vb_curr_items" ,
102
- "couchbase.bucket.item.count" ,
103
- otel .RenameLabel ("bucket" , "bucket_name" ),
104
- ),
105
- otel .RenameMetric (
106
- "kv_num_vbuckets" ,
107
- "couchbase.bucket.vbucket.count" ,
108
- otel .RenameLabel ("bucket" , "bucket_name" ),
109
- ),
110
- otel .RenameMetric (
111
- "kv_total_memory_used_bytes" ,
112
- "couchbase.bucket.memory.usage" ,
113
- otel .RenameLabel ("bucket" , "bucket_name" ),
114
- ),
115
- otel .RenameMetric (
116
- "kv_ep_num_value_ejects" ,
117
- "couchbase.bucket.item.ejection.count" ,
118
- otel .ToggleScalarDataType ,
119
- otel .RenameLabel ("bucket" , "bucket_name" ),
120
- ),
121
- otel .RenameMetric (
122
- "kv_ep_mem_high_wat" ,
123
- "couchbase.bucket.memory.high_water_mark.limit" ,
124
- otel .RenameLabel ("bucket" , "bucket_name" )),
125
- otel .RenameMetric (
126
- "kv_ep_mem_low_wat" ,
127
- "couchbase.bucket.memory.low_water_mark.limit" ,
128
- otel .RenameLabel ("bucket" , "bucket_name" ),
129
- ),
130
- otel .RenameMetric (
131
- "kv_ep_tmp_oom_errors" ,
132
- "couchbase.bucket.error.oom.count.recoverable" ,
133
- otel .ToggleScalarDataType ,
134
- otel .RenameLabel ("bucket" , "bucket_name" ),
135
- ),
136
- otel .RenameMetric (
137
- "kv_ep_oom_errors" ,
138
- "couchbase.bucket.error.oom.count.unrecoverable" ,
139
- otel .ToggleScalarDataType ,
140
- otel .RenameLabel ("bucket" , "bucket_name" ),
141
- ),
142
-
143
- // combine OOM metrics
144
- otel .CombineMetrics (
145
- `^couchbase\.bucket\.error\.oom\.count\.(?P<error_type>unrecoverable|recoverable)$$` ,
146
- "couchbase.bucket.error.oom.count" ,
147
- ),
148
141
149
- // group by bucket and op
150
- otel .UpdateMetric (
151
- `couchbase.bucket.operation.count` ,
152
- map [string ]interface {}{
153
- "action" : "aggregate_labels" ,
154
- "label_set" : []string {"bucket_name" , "op" },
155
- "aggregation_type" : "sum" ,
156
- },
157
- ),
142
+ // combine OOM metrics
143
+ otel .CombineMetrics (
144
+ `^couchbase\.bucket\.error\.oom\.count\.(?P<error_type>unrecoverable|recoverable)$$` ,
145
+ "couchbase.bucket.error.oom.count" ,
146
+ ),
158
147
159
- otel .AddPrefix ("workload.googleapis.com" ),
148
+ // group by bucket and op
149
+ otel .UpdateMetric (
150
+ `couchbase.bucket.operation.count` ,
151
+ map [string ]interface {}{
152
+ "action" : "aggregate_labels" ,
153
+ "label_set" : []string {"bucket_name" , "op" },
154
+ "aggregation_type" : "sum" ,
155
+ },
160
156
),
161
- // Using the transform processor for metrics
162
- otel .TransformationMetrics (r .transformMetrics ()... ),
163
- },
164
- },
165
- }
157
+
158
+ otel .AddPrefix ("workload.googleapis.com" ),
159
+ ),
160
+ // Using the transform processor for metrics
161
+ otel .TransformationMetrics (r .transformMetrics ()... ),
162
+ }},
163
+ }}
166
164
}
167
165
168
166
type couchbaseMetric struct {
0 commit comments