feat: update converter to use file_match block#4791
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the promtail converter to eliminate the intermediate local.file_match component in favor of using the built-in file_match block within loki.source.file. This simplifies the generated Alloy configuration by reducing component indirection.
- Removed the
local.file_matchcomponent generation logic - Updated code generator to include
file_matchblock directly inloki.source.file - Removed unused import and struct fields related to file matching
Reviewed Changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/converter/internal/promtailconvert/internal/build/scrape_builder.go | Refactored to use inline file_match block instead of separate local.file_match component; removed getExpandedFileTargetsExpr() method and added convertFileMatchConfig() helper |
| CHANGELOG.md | Added enhancement entry documenting the converter update |
| internal/converter/internal/staticconvert/testdata_linux/promtail_prom.alloy | Updated test data to reflect new pattern with inline file_match block |
| internal/converter/internal/staticconvert/testdata_linux/promtail_metrics.alloy | Updated test data to reflect new pattern with inline file_match block |
| internal/converter/internal/promtailconvert/testdata/*.alloy | Updated all test data files (26 files) to use inline file_match block and direct target references instead of local.file_match component |
01208be to
e26ce4f
Compare
ptodev
left a comment
There was a problem hiding this comment.
I know it's not considered experimental, but do we need to do more dogfooding before rolling it out as a default more widely?
Sure we can target next release with this specific change if you are more comfortable with it? |
|
Targeting next release would be nice. Especially if for some reason users are translating the config on the latest version, but still expect the previous Alloy version to work with the translated config. |
0aa5bad to
5d7342c
Compare
* update converter to use file_match block * Add changelog
PR Description
Now that #4743 is merged we can update converters to use
file_matchblock instead of going throughlocal.file_match.Which issue(s) this PR fixes
fixes: #4744
Notes to the Reviewer
PR Checklist