Skip to content

Commit 6399c5a

Browse files
authored
Add trace support for OTLP (#1017)
* Add a traces section to the config * Make -update work when the golden directory is completely missing * Generate receiver components once even if included in more than one pipeline * Make OTel config generation generic as to data type * Add a bunch of valid and invalid test cases
1 parent d8482ce commit 6399c5a

File tree

229 files changed

+13225
-11693
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+13225
-11693
lines changed

apps/active_directory_ds.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@ func (r MetricsReceiverActiveDirectoryDS) Type() string {
2929
return "active_directory_ds"
3030
}
3131

32-
func (r MetricsReceiverActiveDirectoryDS) Pipelines() []otel.Pipeline {
33-
return []otel.Pipeline{{
32+
func (r MetricsReceiverActiveDirectoryDS) Pipelines() []otel.ReceiverPipeline {
33+
return []otel.ReceiverPipeline{{
3434
Receiver: otel.Component{
3535
Type: "active_directory_ds",
3636
Config: map[string]interface{}{
3737
"collection_interval": r.CollectionIntervalString(),
3838
},
3939
},
40-
Processors: []otel.Component{
40+
Processors: map[string][]otel.Component{"metrics": {
4141
otel.NormalizeSums(),
4242
otel.MetricsTransform(
4343
otel.AddPrefix("workload.googleapis.com"),
4444
),
45-
},
45+
}},
4646
}}
4747
}
4848

apps/activemq.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (r MetricsReceiverActivemq) Type() string {
3636
return "activemq"
3737
}
3838

39-
func (r MetricsReceiverActivemq) Pipelines() []otel.Pipeline {
39+
func (r MetricsReceiverActivemq) Pipelines() []otel.ReceiverPipeline {
4040

4141
targetSystem := "activemq"
4242

apps/aerospike.go

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var (
4949
)
5050

5151
// Pipelines is the OTEL pipelines created from MetricsReceiverAerospike
52-
func (r MetricsReceiverAerospike) Pipelines() []otel.Pipeline {
52+
func (r MetricsReceiverAerospike) Pipelines() []otel.ReceiverPipeline {
5353
if r.Endpoint == "" {
5454
r.Endpoint = defaultAerospikeEndpoint
5555
}
@@ -74,31 +74,29 @@ func (r MetricsReceiverAerospike) Pipelines() []otel.Pipeline {
7474
endpoint = r.Endpoint
7575
}
7676

77-
return []otel.Pipeline{
78-
{
79-
Receiver: otel.Component{
80-
Type: "aerospike",
81-
Config: map[string]interface{}{
82-
"collection_interval": collectionInterval,
83-
"endpoint": endpoint,
84-
"collect_cluster_metrics": collectClusterMetrics,
85-
"username": r.Username,
86-
"password": r.Password,
87-
"timeout": timeout,
88-
},
89-
},
90-
Processors: []otel.Component{
91-
otel.NormalizeSums(),
92-
otel.MetricsTransform(
93-
otel.AddPrefix("workload.googleapis.com"),
94-
),
95-
otel.TransformationMetrics(
96-
otel.FlattenResourceAttribute("aerospike.node.name", "node_name"),
97-
otel.FlattenResourceAttribute("aerospike.namespace", "namespace_name"),
98-
),
77+
return []otel.ReceiverPipeline{{
78+
Receiver: otel.Component{
79+
Type: "aerospike",
80+
Config: map[string]interface{}{
81+
"collection_interval": collectionInterval,
82+
"endpoint": endpoint,
83+
"collect_cluster_metrics": collectClusterMetrics,
84+
"username": r.Username,
85+
"password": r.Password,
86+
"timeout": timeout,
9987
},
10088
},
101-
}
89+
Processors: map[string][]otel.Component{"metrics": {
90+
otel.NormalizeSums(),
91+
otel.MetricsTransform(
92+
otel.AddPrefix("workload.googleapis.com"),
93+
),
94+
otel.TransformationMetrics(
95+
otel.FlattenResourceAttribute("aerospike.node.name", "node_name"),
96+
otel.FlattenResourceAttribute("aerospike.namespace", "namespace_name"),
97+
),
98+
}},
99+
}}
102100
}
103101

104102
func init() {

apps/apache.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ func (r MetricsReceiverApache) Type() string {
3434
return "apache"
3535
}
3636

37-
func (r MetricsReceiverApache) Pipelines() []otel.Pipeline {
37+
func (r MetricsReceiverApache) Pipelines() []otel.ReceiverPipeline {
3838
if r.ServerStatusURL == "" {
3939
r.ServerStatusURL = defaultServerStatusURL
4040
}
41-
return []otel.Pipeline{{
41+
return []otel.ReceiverPipeline{{
4242
Receiver: otel.Component{
4343
Type: "apache",
4444
Config: map[string]interface{}{
4545
"collection_interval": r.CollectionIntervalString(),
4646
"endpoint": r.ServerStatusURL,
4747
},
4848
},
49-
Processors: []otel.Component{
49+
Processors: map[string][]otel.Component{"metrics": {
5050
otel.MetricsFilter(
5151
"exclude",
5252
"strict",
@@ -56,7 +56,7 @@ func (r MetricsReceiverApache) Pipelines() []otel.Pipeline {
5656
otel.MetricsTransform(
5757
otel.AddPrefix("workload.googleapis.com"),
5858
),
59-
},
59+
}},
6060
}}
6161
}
6262

apps/cassandra.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func (r MetricsReceiverCassandra) Type() string {
3434
return "cassandra"
3535
}
3636

37-
func (r MetricsReceiverCassandra) Pipelines() []otel.Pipeline {
37+
func (r MetricsReceiverCassandra) Pipelines() []otel.ReceiverPipeline {
3838
targetSystem := "cassandra"
3939

4040
return r.MetricsReceiverSharedJVM.

apps/couchbase.go

Lines changed: 85 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (r MetricsReceiverCouchbase) Type() string {
4141
}
4242

4343
// Pipelines will construct the prometheus receiver configuration
44-
func (r MetricsReceiverCouchbase) Pipelines() []otel.Pipeline {
44+
func (r MetricsReceiverCouchbase) Pipelines() []otel.ReceiverPipeline {
4545
targets := []string{r.Endpoint}
4646
if r.Endpoint == "" {
4747
targets = []string{defaultCouchbaseEndpoint}
@@ -73,96 +73,94 @@ func (r MetricsReceiverCouchbase) Pipelines() []otel.Pipeline {
7373
},
7474
},
7575
}
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"),
91140
),
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-
),
148141

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+
),
158147

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+
},
160156
),
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+
}}
166164
}
167165

168166
type couchbaseMetric struct {

apps/couchdb.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ func (MetricsReceiverCouchdb) Type() string {
3838
return "couchdb"
3939
}
4040

41-
func (r MetricsReceiverCouchdb) Pipelines() []otel.Pipeline {
41+
func (r MetricsReceiverCouchdb) Pipelines() []otel.ReceiverPipeline {
4242
if r.Endpoint == "" {
4343
r.Endpoint = defaultCouchdbEndpoint
4444
}
45-
return []otel.Pipeline{{
45+
return []otel.ReceiverPipeline{{
4646
Receiver: otel.Component{
4747
Type: "couchdb",
4848
Config: map[string]interface{}{
@@ -52,12 +52,12 @@ func (r MetricsReceiverCouchdb) Pipelines() []otel.Pipeline {
5252
"password": r.Password,
5353
},
5454
},
55-
Processors: []otel.Component{
55+
Processors: map[string][]otel.Component{"metrics": {
5656
otel.NormalizeSums(),
5757
otel.MetricsTransform(
5858
otel.AddPrefix("workload.googleapis.com"),
5959
),
60-
},
60+
}},
6161
}}
6262
}
6363

apps/elasticsearch.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (r MetricsReceiverElasticsearch) Type() string {
4343
return "elasticsearch"
4444
}
4545

46-
func (r MetricsReceiverElasticsearch) Pipelines() []otel.Pipeline {
46+
func (r MetricsReceiverElasticsearch) Pipelines() []otel.ReceiverPipeline {
4747
if r.Endpoint == "" {
4848
r.Endpoint = defaultElasticsearchEndpoint
4949
}
@@ -63,17 +63,17 @@ func (r MetricsReceiverElasticsearch) Pipelines() []otel.Pipeline {
6363
cfg["metrics"] = r.skipJVMMetricsConfig()
6464
}
6565

66-
return []otel.Pipeline{{
66+
return []otel.ReceiverPipeline{{
6767
Receiver: otel.Component{
6868
Type: "elasticsearch",
6969
Config: cfg,
7070
},
71-
Processors: []otel.Component{
71+
Processors: map[string][]otel.Component{"metrics": {
7272
otel.NormalizeSums(),
7373
otel.MetricsTransform(
7474
otel.AddPrefix("workload.googleapis.com"),
7575
),
76-
},
76+
}},
7777
}}
7878
}
7979

0 commit comments

Comments
 (0)