Allow openTSDB point errors logging to be disabled
parent
7d506c1e64
commit
7ea9b3e49e
|
@ -1,6 +1,7 @@
|
|||
## v0.9.6 [unreleased]
|
||||
|
||||
### Features
|
||||
- [#4790](https://github.com/influxdb/influxdb/pull/4790): Allow openTSDB point-level error logging to be disabled
|
||||
|
||||
### Bugfixes
|
||||
- [#4766](https://github.com/influxdb/influxdb/pull/4766): Update CLI usage output. Thanks @aneshas
|
||||
|
|
|
@ -277,6 +277,7 @@ reporting-disabled = false
|
|||
# consistency-level = "one"
|
||||
# tls-enabled = false
|
||||
# certificate= ""
|
||||
# log-point-errors = true # Log an error for every malformed point.
|
||||
|
||||
# These next lines control how batching works. You should have this enabled
|
||||
# otherwise you could get dropped metrics or poor performance. Only points
|
||||
|
|
|
@ -40,6 +40,7 @@ type Config struct {
|
|||
BatchSize int `toml:"batch-size"`
|
||||
BatchPending int `toml:"batch-pending"`
|
||||
BatchTimeout toml.Duration `toml:"batch-timeout"`
|
||||
LogPointErrors bool `toml:"log-point-errors"`
|
||||
}
|
||||
|
||||
func NewConfig() Config {
|
||||
|
@ -53,5 +54,6 @@ func NewConfig() Config {
|
|||
BatchSize: DefaultBatchSize,
|
||||
BatchPending: DefaultBatchPending,
|
||||
BatchTimeout: toml.Duration(DefaultBatchTimeout),
|
||||
LogPointErrors: true,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ database = "xxx"
|
|||
consistency-level ="all"
|
||||
tls-enabled = true
|
||||
certificate = "/etc/ssl/cert.pem"
|
||||
log-point-errors = true
|
||||
`, &c); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -34,5 +35,7 @@ certificate = "/etc/ssl/cert.pem"
|
|||
t.Fatalf("unexpected tls-enabled: %v", c.TLSEnabled)
|
||||
} else if c.Certificate != "/etc/ssl/cert.pem" {
|
||||
t.Fatalf("unexpected certificate: %s", c.Certificate)
|
||||
} else if !c.LogPointErrors {
|
||||
t.Fatalf("unexpected log-point-errors: %v", c.LogPointErrors)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,8 +75,9 @@ type Service struct {
|
|||
batchTimeout time.Duration
|
||||
batcher *tsdb.PointBatcher
|
||||
|
||||
Logger *log.Logger
|
||||
statMap *expvar.Map
|
||||
LogPointErrors bool
|
||||
Logger *log.Logger
|
||||
statMap *expvar.Map
|
||||
}
|
||||
|
||||
// NewService returns a new instance of Service.
|
||||
|
@ -99,6 +100,7 @@ func NewService(c Config) (*Service, error) {
|
|||
batchPending: c.BatchPending,
|
||||
batchTimeout: time.Duration(c.BatchTimeout),
|
||||
Logger: log.New(os.Stderr, "[opentsdb] ", log.LstdFlags),
|
||||
LogPointErrors: c.LogPointErrors,
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
@ -284,7 +286,9 @@ func (s *Service) handleTelnetConn(conn net.Conn) {
|
|||
|
||||
if len(inputStrs) < 4 || inputStrs[0] != "put" {
|
||||
s.statMap.Add(statTelnetBadLine, 1)
|
||||
s.Logger.Printf("malformed line '%s' from %s", line, remoteAddr)
|
||||
if s.LogPointErrors {
|
||||
s.Logger.Printf("malformed line '%s' from %s", line, remoteAddr)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -297,7 +301,9 @@ func (s *Service) handleTelnetConn(conn net.Conn) {
|
|||
ts, err := strconv.ParseInt(tsStr, 10, 64)
|
||||
if err != nil {
|
||||
s.statMap.Add(statTelnetBadTime, 1)
|
||||
s.Logger.Printf("malformed time '%s' from %s", tsStr, remoteAddr)
|
||||
if s.LogPointErrors {
|
||||
s.Logger.Printf("malformed time '%s' from %s", tsStr, remoteAddr)
|
||||
}
|
||||
}
|
||||
|
||||
switch len(tsStr) {
|
||||
|
@ -309,7 +315,9 @@ func (s *Service) handleTelnetConn(conn net.Conn) {
|
|||
break
|
||||
default:
|
||||
s.statMap.Add(statTelnetBadTime, 1)
|
||||
s.Logger.Printf("bad time '%s' must be 10 or 13 chars, from %s ", tsStr, remoteAddr)
|
||||
if s.LogPointErrors {
|
||||
s.Logger.Printf("bad time '%s' must be 10 or 13 chars, from %s ", tsStr, remoteAddr)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -318,7 +326,9 @@ func (s *Service) handleTelnetConn(conn net.Conn) {
|
|||
parts := strings.SplitN(tagStrs[t], "=", 2)
|
||||
if len(parts) != 2 || parts[0] == "" || parts[1] == "" {
|
||||
s.statMap.Add(statTelnetBadTag, 1)
|
||||
s.Logger.Printf("malformed tag data '%v' from %s", tagStrs[t], remoteAddr)
|
||||
if s.LogPointErrors {
|
||||
s.Logger.Printf("malformed tag data '%v' from %s", tagStrs[t], remoteAddr)
|
||||
}
|
||||
continue
|
||||
}
|
||||
k := parts[0]
|
||||
|
@ -330,7 +340,9 @@ func (s *Service) handleTelnetConn(conn net.Conn) {
|
|||
fv, err := strconv.ParseFloat(valueStr, 64)
|
||||
if err != nil {
|
||||
s.statMap.Add(statTelnetBadFloat, 1)
|
||||
s.Logger.Printf("bad float '%s' from %s", valueStr, remoteAddr)
|
||||
if s.LogPointErrors {
|
||||
s.Logger.Printf("bad float '%s' from %s", valueStr, remoteAddr)
|
||||
}
|
||||
continue
|
||||
}
|
||||
fields["value"] = fv
|
||||
|
@ -338,7 +350,9 @@ func (s *Service) handleTelnetConn(conn net.Conn) {
|
|||
pt, err := models.NewPoint(measurement, tags, fields, t)
|
||||
if err != nil {
|
||||
s.statMap.Add(statTelnetBadFloat, 1)
|
||||
s.Logger.Printf("bad float '%s' from %s", valueStr, remoteAddr)
|
||||
if s.LogPointErrors {
|
||||
s.Logger.Printf("bad float '%s' from %s", valueStr, remoteAddr)
|
||||
}
|
||||
continue
|
||||
}
|
||||
s.batcher.In() <- pt
|
||||
|
|
Loading…
Reference in New Issue