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

Add loki.enrich component (WIP) #2882

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Conversation

v-zhuravlev
Copy link
Contributor

@v-zhuravlev v-zhuravlev commented Mar 2, 2025

PR Description

This PR adds a new loki.enrich component that enriches logs with labels from discovery.* 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.

Features:

  • Match logs to targets using configurable labels
  • Copy selected labels from matched targets to logs
  • Support for any discovery component (file, DNS, HTTP, etc.)
  • Caching of target labels
  • Thread-safe label updates

Example use cases:

Notes to the Reviewer

The enrich component:

  1. Uses a map to cache target labels for efficient lookups
  2. Updates cache atomically when targets change
  3. Forwards logs unchanged if no match is found

The integration test demonstrates:

  • Log pushed via HTTP API
  • Label enrichment using file-based discovery sample (could be some external source instead)

PR Checklist

  • CHANGELOG.md updated
  • Documentation added
  • Tests updated
  • Config converters updated

Copy link
Contributor

github-actions bot commented Mar 2, 2025

@v-zhuravlev v-zhuravlev changed the title Add loki.enricher component (WIP) Add loki.enrich component (WIP) Mar 3, 2025
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

Successfully merging this pull request may close these issues.

1 participant