diff --git a/.chloggen/not-sure-understand.yaml b/.chloggen/not-sure-understand.yaml new file mode 100644 index 0000000000000..cf6417b957c43 --- /dev/null +++ b/.chloggen/not-sure-understand.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: pkg/stanza + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Remove deprecated `flush.WithPeriod`. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [37784] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [api] diff --git a/pkg/stanza/fileconsumer/internal/reader/factory.go b/pkg/stanza/fileconsumer/internal/reader/factory.go index 170df57377c62..a20a92911ae04 100644 --- a/pkg/stanza/fileconsumer/internal/reader/factory.go +++ b/pkg/stanza/fileconsumer/internal/reader/factory.go @@ -59,20 +59,15 @@ func (f *Factory) NewReader(file *os.File, fp *fingerprint.Fingerprint) (*Reader m := &Metadata{ Fingerprint: fp, FileAttributes: attributes, - TokenLenState: &tokenlen.State{}, - } - if f.FlushTimeout > 0 { - m.FlushState = &flush.State{LastDataChange: time.Now()} + TokenLenState: tokenlen.State{}, + FlushState: flush.State{ + LastDataChange: time.Now(), + }, } return f.NewReaderFromMetadata(file, m) } func (f *Factory) NewReaderFromMetadata(file *os.File, m *Metadata) (r *Reader, err error) { - // Ensure TokenLenState is initialized - if m.TokenLenState == nil { - m.TokenLenState = &tokenlen.State{} - } - r = &Reader{ Metadata: m, set: f.TelemetrySettings, diff --git a/pkg/stanza/fileconsumer/internal/reader/reader.go b/pkg/stanza/fileconsumer/internal/reader/reader.go index 4cd3e910c2a95..f3783aeb7274d 100644 --- a/pkg/stanza/fileconsumer/internal/reader/reader.go +++ b/pkg/stanza/fileconsumer/internal/reader/reader.go @@ -31,8 +31,8 @@ type Metadata struct { RecordNum int64 FileAttributes map[string]any HeaderFinalized bool - FlushState *flush.State - TokenLenState *tokenlen.State + FlushState flush.State + TokenLenState tokenlen.State } // Reader manages a single file diff --git a/pkg/stanza/flush/flush.go b/pkg/stanza/flush/flush.go index 1dfa93f13a21c..62c827bafb8a2 100644 --- a/pkg/stanza/flush/flush.go +++ b/pkg/stanza/flush/flush.go @@ -61,9 +61,3 @@ func (s *State) Func(splitFunc bufio.SplitFunc, period time.Duration) bufio.Spli return 0, nil, nil } } - -// Deprecated: [v0.88.0] Use WithFunc instead. -func WithPeriod(splitFunc bufio.SplitFunc, period time.Duration) bufio.SplitFunc { - s := &State{LastDataChange: internaltime.Now()} - return s.Func(splitFunc, period) -} diff --git a/pkg/stanza/flush/flush_test.go b/pkg/stanza/flush/flush_test.go index e8bb369ac77c2..5bd9832598587 100644 --- a/pkg/stanza/flush/flush_test.go +++ b/pkg/stanza/flush/flush_test.go @@ -41,8 +41,6 @@ func TestNewlineSplitFunc(t *testing.T) { } for _, tc := range testCases { - t.Run(tc.name+"/WithPeriod", splittest.New(WithPeriod(tc.baseFunc, tc.flushPeriod), tc.input, tc.steps...)) - previousState := &State{LastDataChange: time.Now()} t.Run(tc.name+"/Func", splittest.New(previousState.Func(tc.baseFunc, tc.flushPeriod), tc.input, tc.steps...)) }