feat(opentelemetry): add structured metadata support and update log transformation logic

Signed-off-by: zhenyus <zhenyus@mathmast.com>
This commit is contained in:
zhenyus 2025-04-21 16:16:03 +08:00
parent 6bbc81a940
commit 222f5ee0fb
2 changed files with 12 additions and 3 deletions

View File

@ -347,6 +347,17 @@ loki:
split_queries_by_interval: 15m
query_timeout: 300s
volume_enabled: true
allow_structured_metadata: true
otlp_config:
resource_attributes:
attributes_config:
- action: index_label
attributes:
- app
- env
- k8s.pod.name
- k8s.namespace.name
- k8s.node.name
# -- Provides a reloadable runtime configuration file for some specific configuration
runtimeConfig: {}
# -- Check https://grafana.com/docs/loki/latest/configuration/#common_config for more info on how to provide a common configuration

View File

@ -78,9 +78,7 @@ spec:
log_statements:
- context: log
statements:
- merge_maps(log.cache, ParseJSON(log.body), "upsert")
- set(log.cache["kubernetes"], resource.attributes["kubernetes"])
- set(log.body, log.cache)
- set(log.body["kubernetes"], log.attributes["kubernetes"])
batch:
send_batch_size: 5
timeout: 10s