Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new slices for log_statements #1801

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading