Skip to content

Conversation

@kalleep
Copy link
Contributor

@kalleep kalleep commented Oct 21, 2025

PR Description

Extracted from #4611

Before this component would only export new targets whenever it started or if the timer was triggered. When using this component with discovery mechanism it is useful to "expand" paths and exports as soon as we have new discovery data.

Which issue(s) this PR fixes

Notes to the Reviewer

PR Checklist

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

@kalleep kalleep requested a review from a team as a code owner October 21, 2025 12:55
CHANGELOG.md Outdated

- `prometheus.exporter.postgres` dependency has been updated to v0.18.1. This includes new `stat_progress_vacuum` and `buffercache_summary` collectors, as well as other bugfixes and enhancements. (@cristiangreco)

- `local.file_match` will now trigger it's sync job when the component is updated with new targets. (@kalleep)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a bit of an implementation detail. I think you want to write a bugfix message on what this fixes.

@thampiotr thampiotr requested a review from Copilot October 21, 2025 13:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modifies the local.file_match component to trigger its sync job immediately whenever the component is updated with new targets, rather than only syncing on startup or timer expiration. This improves responsiveness when used with discovery mechanisms by exporting new targets as soon as discovery data changes.

Key changes:

  • Introduced a buffered channel to signal target changes and trigger immediate syncs
  • Changed from RWMutex to Mutex for simpler locking semantics
  • Refactored the Run loop to handle both timer-based and change-triggered syncs

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
internal/component/local/file_match/file.go Added targetsChanged channel to trigger immediate syncs on component updates; refactored Run loop to handle both timer-based and event-driven syncs
CHANGELOG.md Documented the new behavior of triggering sync jobs on component updates

@kalleep kalleep force-pushed the kalleep/local-file-match-new-targets branch from a46cdd8 to 84c98d2 Compare October 21, 2025 14:21
@kalleep kalleep force-pushed the kalleep/local-file-match-new-targets branch from 84c98d2 to 25824ad Compare October 22, 2025 07:14
@kalleep kalleep requested a review from thampiotr October 22, 2025 07:42
@kalleep kalleep changed the title fix: trigger the sync job whenever the component is updated with new fix: trigger the sync job when targets are updated Oct 22, 2025
@kalleep kalleep merged commit cebb8fc into main Oct 22, 2025
41 checks passed
@kalleep kalleep deleted the kalleep/local-file-match-new-targets branch October 22, 2025 11:39
kalleep added a commit that referenced this pull request Oct 23, 2025
* fix: trigger the sync job whenever the component is updated with new
targets
kalleep added a commit that referenced this pull request Oct 27, 2025
* fix: trigger the sync job when targets are updated (#4635)

* Fix splunkhec arguments missing new block (#4612)

* Fix CRD translations to propagate scrape protocols (#4638)

* fix: loki source file scheduleloop (#4634)

* fix: panic when no tcp block is used for otelcol.receiver.syslog (#4628)

* Expose ARP collector config options. (#4669)

---------

Co-authored-by: Sam DeHaan <sam.dehaan@grafana.com>
Co-authored-by: Paulin Todev <paulin.todev@gmail.com>
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.

2 participants