Skip to content

fix(agent): Fix buffer directory config and document #15661

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

Merged
merged 3 commits into from
Jul 30, 2024

Conversation

mstrandboge
Copy link
Member

Summary

Fixes buffer directory agent level config and documents the option.

Checklist

  • No AI generated code was used in this PR

Related issues

resolves #15656

@telegraf-tiger telegraf-tiger bot added the chore label Jul 24, 2024
@mstrandboge mstrandboge added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Jul 24, 2024
@josephbrosef
Copy link

hey, i tested the new build and it doesn't seem to resolve the issue. setting buffer_strategy = "disk" and buffer_directory = "/buffer_storage" at the [agent] level does not actually change the buffer strategy. It still uses memory buffer. pretty sure config.BufferStrategy and config.BufferDirectory are always an empty string, so it will always return with a 'memory' buffer.

b, err := NewBuffer(config.Name, config.Alias, bufferLimit, config.BufferStrategy, config.BufferDirectory)

func NewBuffer(name string, alias string, capacity int, strategy string, path string) (Buffer, error) {
registerGob()
bs := NewBufferStats(name, alias, capacity)
switch strategy {
case "", "memory":
return NewMemoryBuffer(capacity, bs)
case "disk":
return NewDiskBuffer(name, path, bs)
}
return nil, fmt.Errorf("invalid buffer strategy %q", strategy)
}

Those 2 values appear to come from the OutputConfig struct (which is why i thought maybe it could be set at the Output level in the referenced bug), but i can not see how those 2 struct values are supposed to get populated with the buffer_strategy and buffer_directory from the [agent] config?

type OutputConfig struct {
Name string
Alias string
ID string
StartupErrorBehavior string
Filter Filter
FlushInterval time.Duration
FlushJitter time.Duration
MetricBufferLimit int
MetricBatchSize int
NameOverride string
NamePrefix string
NameSuffix string
BufferStrategy string
BufferDirectory string
}

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Good job @DStrand1! Only one minor comment from my side.

@telegraf-tiger
Copy link
Contributor

Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

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

Thank you for the update!

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks @DStrand1!

@srebhan srebhan changed the title chore(agent): Fix buffer directory config and document Jul 30, 2024
@telegraf-tiger telegraf-tiger bot added the fix pr to fix corresponding bug label Jul 30, 2024
@srebhan srebhan added fix pr to fix corresponding bug and removed fix pr to fix corresponding bug chore labels Jul 30, 2024
@srebhan srebhan merged commit 790c21e into influxdata:master Jul 30, 2024
29 checks passed
@github-actions github-actions bot added this to the v1.31.3 milestone Jul 30, 2024
@mstrandboge mstrandboge deleted the buffer-directory-fix branch October 11, 2024 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/agent fix pr to fix corresponding bug ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
4 participants