Skip to content
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

Configurable precision on UDP services #5565

Merged
merged 3 commits into from
Feb 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [#5459](https://github.com/influxdata/influxdb/pull/5459): Create `/status` endpoint for health checks.
- [#5460](https://github.com/influxdata/influxdb/pull/5460): Prevent exponential growth in CLI history. Thanks @sczk!
- [#5522](https://github.com/influxdata/influxdb/pull/5522): Optimize tsm1 cache to reduce memory consumption and GC scan time.
- [#5565](https://github.com/influxdata/influxdb/pull/5565): Add configuration for time precision with UDP services. - @tpitale

### Bugfixes
- [#5129](https://github.com/influxdata/influxdb/pull/5129): Ensure precision flag is respected by CLI. Thanks @e-dard
Expand Down
7 changes: 7 additions & 0 deletions services/udp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const (
// DefaultBatchTimeout is the default UDP batch timeout.
DefaultBatchTimeout = time.Second

// DefaultPrecision is the default time precision used for UDP services.
DefaultPrecision = "n"

// DefaultReadBuffer is the default buffer size for the UDP listener.
// Sets the size of the operating system's receive buffer associated with
// the UDP traffic. Keep in mind that the OS must be able
Expand Down Expand Up @@ -62,6 +65,7 @@ type Config struct {
BatchPending int `toml:"batch-pending"`
ReadBuffer int `toml:"read-buffer"`
BatchTimeout toml.Duration `toml:"batch-timeout"`
Precision string `toml:"precision"`
UDPPayloadSize int `toml:"udp-payload-size"`
}

Expand All @@ -81,6 +85,9 @@ func (c *Config) WithDefaults() *Config {
if d.BatchTimeout == 0 {
d.BatchTimeout = toml.Duration(DefaultBatchTimeout)
}
if d.Precision == "" {
d.Precision = DefaultPrecision
}
if d.ReadBuffer == 0 {
d.ReadBuffer = DefaultReadBuffer
}
Expand Down
2 changes: 1 addition & 1 deletion services/udp/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (s *Service) parser() {
case <-s.done:
return
case buf := <-s.parserChan:
points, err := models.ParsePoints(buf)
points, err := models.ParsePointsWithPrecision(buf, time.Now().UTC(), s.config.Precision)
if err != nil {
s.statMap.Add(statPointsParseFail, 1)
s.Logger.Printf("Failed to parse points: %s", err)
Expand Down