-
Notifications
You must be signed in to change notification settings - Fork 278
Add structured metadata support for Loki output plugin #1579
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: ProCodec <43810146+error9098x@users.noreply.github.com>
This one lacks the necessary crd |
StructuredMetadata map[string]string `json:"structuredMetadata,omitempty"` | ||
// Optional list of record keys that will be placed as structured metadata. | ||
// This allows using record accessor patterns (e.g. $kubernetes['pod_name']) to reference record keys. | ||
StructuredMetadataKeys []string `json:"structuredMetadataKeys,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to resolve this issue, please run |
did that, is it ok now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@error9098x , there is a failed test, can you please fix it? |
Signed-off-by: ProCodec <43810146+error9098x@users.noreply.github.com>
it appears that it was failing because of the label order difference in loki_type.go output and the test. I have added sorting mechanism to fix that. |
Signed-off-by: ProCodec 43810146+error9098x@users.noreply.github.com
What this PR does / why we need it:
Adds support for structured metadata in the Loki output plugin. This allows attaching high-cardinality data (like pod names, trace IDs, thread IDs) to log lines without using them as labels, following Loki's recommended best practices for Loki 3.0+.
The implementation adds:
structuredMetadata
field to set key-value pairs as structured metadatastructuredMetadataKeys
field to reference record keys for structured metadataWhich issue(s) this PR fixes:
Fixes #1551
Does this PR introduced a user-facing change?
Additional documentation, usage docs, etc.:
For more info on structured metadata: https://grafana.com/docs/loki/latest/get-started/labels/structured-metadata/