Skip to content

Commit

Permalink
Change the config name
Browse files Browse the repository at this point in the history
  • Loading branch information
ravishankar15 committed Dec 12, 2024
1 parent 28acd3a commit fa949e3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Main (unreleased)
- Add perf_schema quantile columns to collector

- Add three new stdlib functions to_base64, from_URLbase64 and to_URLbase64 (@ravishankar15)
- Add `ignore_older` option for local.file_match (@ravishankar15)
- Add `ignore_older_than` option for local.file_match (@ravishankar15)

### Bugfixes

Expand Down
10 changes: 5 additions & 5 deletions docs/sources/reference/components/local/local.file_match.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ local.file_match "LABEL" {

The following arguments are supported:

Name | Type | Description | Default | Required
--------------- | ------------------- | ------------------------------------------------------------------------------------------ |---------| --------
`path_targets` | `list(map(string))` | Targets to expand; looks for glob patterns on the `__path__` and `__path_exclude__` keys. | | yes
`sync_period` | `duration` | How often to sync filesystem and targets. | `"10s"` | no
`ignore_older` | `duration` | Ignores files which are modified before this duration | | no
Name | Type | Description | Default | Required
--------------- | ------------------- | ------------------------------------------------------------------------------------------ |---------| --------
`path_targets` | `list(map(string))` | Targets to expand; looks for glob patterns on the `__path__` and `__path_exclude__` keys. | | yes
`sync_period` | `duration` | How often to sync filesystem and targets. | `"10s"` | no
`ignore_older_than` | `duration` | Ignores files which are modified before this duration | | no

`path_targets` uses [doublestar][] style paths.
* `/tmp/**/*.log` will match all subfolders of `tmp` and include any files that end in `*.log`.
Expand Down
12 changes: 6 additions & 6 deletions internal/component/local/file_match/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ func init() {
// Arguments holds values which are used to configure the local.file_match
// component.
type Arguments struct {
PathTargets []discovery.Target `alloy:"path_targets,attr"`
SyncPeriod time.Duration `alloy:"sync_period,attr,optional"`
IgnoreOlder time.Duration `alloy:"ignore_older,attr,optional"`
PathTargets []discovery.Target `alloy:"path_targets,attr"`
SyncPeriod time.Duration `alloy:"sync_period,attr,optional"`
IgnoreOlderThan time.Duration `alloy:"ignore_older_than,attr,optional"`
}

var _ component.Component = (*Component)(nil)
Expand Down Expand Up @@ -81,9 +81,9 @@ func (c *Component) Update(args component.Arguments) error {
c.watches = c.watches[:0]
for _, v := range c.args.PathTargets {
c.watches = append(c.watches, watch{
target: v,
log: c.opts.Logger,
ignoreOlder: c.args.IgnoreOlder,
target: v,
log: c.opts.Logger,
ignoreOlderThan: c.args.IgnoreOlderThan,
})
}

Expand Down
2 changes: 1 addition & 1 deletion internal/component/local/file_match/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestFileIgnoreOlder(t *testing.T) {
ct, ccl := context.WithTimeout(ct, 5*time.Second)
defer ccl()
c.args.SyncPeriod = 10 * time.Millisecond
c.args.IgnoreOlder = 100 * time.Millisecond
c.args.IgnoreOlderThan = 100 * time.Millisecond
c.Update(c.args)
go c.Run(ct)

Expand Down
8 changes: 4 additions & 4 deletions internal/component/local/file_match/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (

// watch handles a single discovery.target for file watching.
type watch struct {
target discovery.Target
log log.Logger
ignoreOlder time.Duration
target discovery.Target
log log.Logger
ignoreOlderThan time.Duration
}

func (w *watch) getPaths() ([]discovery.Target, error) {
Expand Down Expand Up @@ -51,7 +51,7 @@ func (w *watch) getPaths() ([]discovery.Target, error) {
continue
}

if w.ignoreOlder != 0 && fi.ModTime().Before(time.Now().Add(-w.ignoreOlder)) {
if w.ignoreOlderThan != 0 && fi.ModTime().Before(time.Now().Add(-w.ignoreOlderThan)) {
continue
}

Expand Down

0 comments on commit fa949e3

Please sign in to comment.