Skip to content

Commit

Permalink
Merge pull request #5565 from tpitale/configure-udp-precision
Browse files Browse the repository at this point in the history
Configurable precision on UDP services
  • Loading branch information
jwilder committed Feb 8, 2016
2 parents 7d03cd8 + f76569c commit a9552fd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ This release also changes how clusters are setup. The config file has changed so
- [#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
- [#4299](https://github.com/influxdata/influxdb/pull/4299): Reject uint64 Client.Point.Field values
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

0 comments on commit a9552fd

Please sign in to comment.