Skip to content

Commit

Permalink
Use new slices for log_statements
Browse files Browse the repository at this point in the history
Map-style config was removed in open-telemetry/opentelemetry-collector-contrib#16773. Slice-style config has been supported for some time so this should work without a collector upgrade.
  • Loading branch information
jefferbrecht committed Sep 24, 2024
1 parent abf9899 commit c0f26cb
Show file tree
Hide file tree
Showing 137 changed files with 202 additions and 198 deletions.
20 changes: 12 additions & 8 deletions confgenerator/otel/processors.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func CumulativeToDelta(metrics ...string) Component {
Type: "cumulativetodelta",
Config: map[string]interface{}{
"include": map[string]interface{}{
"metrics": metrics,
"metrics": metrics,
"match_type": "strict",
},
},
Expand Down Expand Up @@ -157,9 +157,11 @@ func Transform(statementType, context string, statements ottl.Statements) Compon
Type: "transform",
Config: map[string]any{
"error_mode": "ignore",
fmt.Sprintf("%s_statements", statementType): map[string]any{
"context": context,
"statements": statements,
fmt.Sprintf("%s_statements", statementType): []map[string]any{
{
"context": context,
"statements": statements,
},
},
},
}
Expand Down Expand Up @@ -190,10 +192,12 @@ func TransformationMetrics(queries ...TransformQuery) Component {
}
return Component{
Type: "transform",
Config: map[string]map[string]interface{}{
"metric_statements": {
"context": "datapoint",
"statements": queryStrings,
Config: map[string]any{
"metric_statements": []map[string]any{
{
"context": "datapoint",
"statements": queryStrings,
},
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ processors:
transform/otlp_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ processors:
transform/otlp_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ processors:
transform/otlp_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ processors:
transform/otlp_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ processors:
transform/logs_p1_sample__logs_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], body["source"]) where (body != nil and body["source"] != nil)
Expand Down Expand Up @@ -550,7 +550,7 @@ processors:
transform/sample__logs_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand All @@ -567,7 +567,7 @@ processors:
transform/syslog_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ processors:
transform/logs_p1_sample__logs_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], body["source"]) where (body != nil and body["source"] != nil)
Expand Down Expand Up @@ -521,7 +521,7 @@ processors:
transform/sample__logs_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand All @@ -538,7 +538,7 @@ processors:
transform/syslog_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ processors:
transform/logs_p1_sample__logs_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], body["source"]) where (body != nil and body["source"] != nil)
Expand Down Expand Up @@ -593,7 +593,7 @@ processors:
transform/sample__logs_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand All @@ -610,7 +610,7 @@ processors:
transform/windows__event__log_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], body["channel"]) where (body != nil and body["channel"] != nil)
Expand Down Expand Up @@ -686,7 +686,7 @@ processors:
transform/windows__event__log_1:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand All @@ -703,7 +703,7 @@ processors:
transform/windows__event__log_1_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], body["channel"]) where (body != nil and body["channel"] != nil)
Expand Down Expand Up @@ -779,7 +779,7 @@ processors:
transform/windows__event__log_1_1:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand All @@ -796,7 +796,7 @@ processors:
transform/windows__event__log_2_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], body["channel"]) where (body != nil and body["channel"] != nil)
Expand Down Expand Up @@ -872,7 +872,7 @@ processors:
transform/windows__event__log_2_1:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ processors:
transform/logs_p1_sample__logs_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], body["source"]) where (body != nil and body["source"] != nil)
Expand Down Expand Up @@ -593,7 +593,7 @@ processors:
transform/sample__logs_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand All @@ -610,7 +610,7 @@ processors:
transform/windows__event__log_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], body["channel"]) where (body != nil and body["channel"] != nil)
Expand Down Expand Up @@ -686,7 +686,7 @@ processors:
transform/windows__event__log_1:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand All @@ -703,7 +703,7 @@ processors:
transform/windows__event__log_1_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], body["channel"]) where (body != nil and body["channel"] != nil)
Expand Down Expand Up @@ -779,7 +779,7 @@ processors:
transform/windows__event__log_1_1:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand All @@ -796,7 +796,7 @@ processors:
transform/windows__event__log_2_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], body["channel"]) where (body != nil and body["channel"] != nil)
Expand Down Expand Up @@ -872,7 +872,7 @@ processors:
transform/windows__event__log_2_1:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ processors:
transform/log__source__id1_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand All @@ -478,7 +478,7 @@ processors:
transform/logs_pipeline1_log__source__id1_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- set(cache["__parsed_json"], ParseJSON(body["key_1"])) where (body != nil and body["key_1"] != nil)
- delete_key(body, "key_1") where ((body != nil and body["key_1"] != nil) and (cache != nil and cache["__parsed_json"] != nil))
Expand Down Expand Up @@ -533,7 +533,7 @@ processors:
transform/syslog_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ processors:
transform/log__source__id1_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand All @@ -449,7 +449,7 @@ processors:
transform/logs_pipeline1_log__source__id1_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- set(cache["__parsed_json"], ParseJSON(body["key_1"])) where (body != nil and body["key_1"] != nil)
- delete_key(body, "key_1") where ((body != nil and body["key_1"] != nil) and (cache != nil and cache["__parsed_json"] != nil))
Expand Down Expand Up @@ -504,7 +504,7 @@ processors:
transform/syslog_0:
error_mode: ignore
log_statements:
context: log
- context: log
statements:
- delete_key(cache, "__field_0") where (cache != nil and cache["__field_0"] != nil)
- set(cache["__field_0"], attributes["compute.googleapis.com/resource_name"]) where (attributes != nil and attributes["compute.googleapis.com/resource_name"] != nil)
Expand Down
Loading

0 comments on commit c0f26cb

Please sign in to comment.