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

Possibly redundant loki label drop of structured metadata values #767

Open
marshallford opened this issue Oct 4, 2024 · 0 comments
Open

Comments

@marshallford
Copy link

Hello 👋🏼 ,

I often look over the helm templates and examples provided by this project when developing/troubleshooting Alloy configs. In any case, while working on adding structured metadata to Loki logs I noticed labels used for structured metadata values were missing from the log entries (without the use of a stage.label_drop block). This initially confused me because I recalled that this chart specifically dropped all labels passed to this block afterwards -- presumably to avoid data duplication.

Long story short, it seems as though the stage.structured_metadata block in the loki.process component removes/converts labels when setting structured metadata values. I opened a docs PR with more info here: grafana/alloy#1810. I suspect that the helm template snippet which drops labels used for structured metadata values can be safely removed.

The aforementioned helm template:

// Drop the filename label, since it's not really useful in the context of Kubernetes, where we already have cluster,
// namespace, pod, and container labels. Drop any structured metadata. Also drop the temporary
// container runtime label as it is no longer needed.
stage.label_drop {
values = [
"filename",
"tmp_container_runtime",
{{- if .Values.logs.pod_logs.structuredMetadata }}
{{- range $label, $lokiLabel := .Values.logs.pod_logs.structuredMetadata }}
{{ $lokiLabel | default $label | quote }},
{{- end }}
{{- end }}
]
}

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant