Conversation
|
💻 Deploy preview deleted. |
|
Similar functionality, but not applicable to syslog as of now: https://grafana.com/docs/alloy/latest/reference/stdlib/array/#arraycombine_maps |
ptodev
left a comment
There was a problem hiding this comment.
@v-zhuravlev thank you, this looks interesting! Could you please edit the description that this solves #810?
Btw we also have a similar component for traces - otelcol.processor.discovery.
| // Initialize the cache with provided targets | ||
| c.refreshCacheFromTargets(args.Targets) |
There was a problem hiding this comment.
I think if the discovery component will just return an empty map if it hasn't discovered anything yet? Then loki.enrich would still not work for the first few seconds until the discovery starts working?
There was a problem hiding this comment.
hm, possibly. Is there any way to force discovery before component is initialized?
There was a problem hiding this comment.
is it acceptable?
There was a problem hiding this comment.
otelcol.processor.k8sattributes has had a similar problem and they added an optional wait_for_metadata_timeout argument to work around it. You could add something similar, but it's not necessary. As long as this limitation is documented that's ok.
There was a problem hiding this comment.
thanks for providing this example! I think I add a note for now.
|
|
||
| func init() { | ||
| component.Register(component.Registration{ | ||
| Name: "loki.enrich", |
There was a problem hiding this comment.
loki.enrich sounds like a good name. Initially I thought there should be a reference to discovery or targets in the name, but I gave up on that thought because in theory the targets don't have to come from a discovery component.
|
💻 Deploy preview deleted. |
clayton-cornell
left a comment
There was a problem hiding this comment.
Some initial input to the docs
Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>
Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>
|
Docs are OK for this iteration. I'll wait until code review is complete for the Approve from docs. |
Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>
ptodev
left a comment
There was a problem hiding this comment.
LGTM, just one minor docs coment.
Co-authored-by: Paulin Todev <paulin.todev@gmail.com>
* Add loki.enricher * Add missing comma * Fix config.alloy * Fix integration test * Fix tests * Register in all.go * Update docs * rename to loki.enrich * Update docs * rename to network * Update docs * Remove redundant label * Update test * rename int test * Rename * Add hidden label * Fix tests * Update changelog * Make target_label optional * Rename to logs_match_label, target_match_label. Make logs_match_label optional. * Update test * rename to labels_to_copy * Update docs/sources/reference/components/loki/loki.enrich.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Update docs * Add limitation notice * Update docs/sources/reference/components/loki/loki.enrich.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Update docs/sources/reference/components/loki/loki.enrich.md Co-authored-by: Paulin Todev <paulin.todev@gmail.com> * Add caution in docs --------- Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> Co-authored-by: Paulin Todev <paulin.todev@gmail.com>
* Add loki.enricher * Add missing comma * Fix config.alloy * Fix integration test * Fix tests * Register in all.go * Update docs * rename to loki.enrich * Update docs * rename to network * Update docs * Remove redundant label * Update test * rename int test * Rename * Add hidden label * Fix tests * Update changelog * Make target_label optional * Rename to logs_match_label, target_match_label. Make logs_match_label optional. * Update test * rename to labels_to_copy * Update docs/sources/reference/components/loki/loki.enrich.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Update docs * Add limitation notice * Update docs/sources/reference/components/loki/loki.enrich.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Update docs/sources/reference/components/loki/loki.enrich.md Co-authored-by: Paulin Todev <paulin.todev@gmail.com> * Add caution in docs --------- Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> Co-authored-by: Paulin Todev <paulin.todev@gmail.com>
PR Description
This PR adds a new
loki.enrichcomponent that enriches Loki logs with labels fromdiscovery.*components.The component matches a label from incoming logs against a label from discovered targets, and copies specified labels from the matched target to the log entry.
Should solve #810 and likely https://community.grafana.com/t/enrich-logs-with-alloy/128738.
Features:
Example use cases to ensure best logs-metrics correlation:
Notes to the Reviewer
PR Checklist