-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4042 from influxdb/buffered_batcher
Add pending control to batcher
- Loading branch information
Showing
14 changed files
with
105 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,44 @@ | ||
package udp | ||
|
||
import "github.com/influxdb/influxdb/toml" | ||
import ( | ||
"time" | ||
|
||
"github.com/influxdb/influxdb/toml" | ||
) | ||
|
||
const ( | ||
// DefaultBatchSize is the default UDP batch size. | ||
DefaultBatchSize = 1000 | ||
|
||
// DefaultBatchPending is the default number of pending UDP batches. | ||
DefaultBatchPending = 5 | ||
|
||
// DefaultBatchTimeout is the default UDP batch timeout. | ||
DefaultBatchTimeout = time.Second | ||
) | ||
|
||
type Config struct { | ||
Enabled bool `toml:"enabled"` | ||
BindAddress string `toml:"bind-address"` | ||
|
||
Database string `toml:"database"` | ||
BatchSize int `toml:"batch-size"` | ||
BatchPending int `toml:"batch-pending"` | ||
BatchTimeout toml.Duration `toml:"batch-timeout"` | ||
} | ||
|
||
// WithDefaults takes the given config and returns a new config with any required | ||
// default values set. | ||
func (c *Config) WithDefaults() *Config { | ||
d := *c | ||
if d.BatchSize == 0 { | ||
d.BatchSize = DefaultBatchSize | ||
} | ||
if d.BatchPending == 0 { | ||
d.BatchPending = DefaultBatchPending | ||
} | ||
if d.BatchTimeout == 0 { | ||
d.BatchTimeout = toml.Duration(DefaultBatchTimeout) | ||
} | ||
return &d | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters