diff --git a/CHANGELOG.md b/CHANGELOG.md index bb5a0a2d20..89212f135c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/services/udp/config.go b/services/udp/config.go index 30b949c219..dc35ed8ae7 100644 --- a/services/udp/config.go +++ b/services/udp/config.go @@ -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 @@ -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"` } @@ -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 } diff --git a/services/udp/service.go b/services/udp/service.go index b58050e197..087bd3115f 100644 --- a/services/udp/service.go +++ b/services/udp/service.go @@ -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)