Merge pull request #10063 from influxdata/jmw-extra-log-context

Make store include context in logs
pull/10104/head
Jeff Wendling 2018-07-18 11:53:22 -06:00 committed by GitHub
commit 63fbf53699
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 5 deletions

View File

@ -106,15 +106,16 @@ func (s *Store) Statistics(tags map[string]string) []models.Statistic {
databases := s.Databases()
statistics := make([]models.Statistic, 0, len(databases))
for _, database := range databases {
log := s.Logger.With(logger.Database(database))
sc, err := s.SeriesCardinality(database)
if err != nil {
s.Logger.Info("Cannot retrieve series cardinality", zap.Error(err))
log.Info("Cannot retrieve series cardinality", zap.Error(err))
continue
}
mc, err := s.MeasurementsCardinality(database)
if err != nil {
s.Logger.Info("Cannot retrieve measurement cardinality", zap.Error(err))
log.Info("Cannot retrieve measurement cardinality", zap.Error(err))
continue
}
@ -1343,7 +1344,7 @@ func (s *Store) TagKeys(auth query.Authorizer, shardIDs []uint64, cond influxql.
switch e.Op {
case influxql.EQ, influxql.NEQ, influxql.EQREGEX, influxql.NEQREGEX:
tag, ok := e.LHS.(*influxql.VarRef)
if !ok || strings.HasPrefix(tag.Val, "_") {
if !ok || influxql.IsSystemName(tag.Val) {
return nil
}
}
@ -1754,7 +1755,9 @@ func (s *Store) monitorShards() {
for _, sh := range s.shards {
if sh.IsIdle() {
if err := sh.Free(); err != nil {
s.Logger.Warn("Error while freeing cold shard resources", zap.Error(err))
s.Logger.Warn("Error while freeing cold shard resources",
zap.Error(err),
logger.Shard(sh.ID()))
}
} else {
sh.SetCompactionsEnabled(true)
@ -1812,7 +1815,10 @@ func (s *Store) monitorShards() {
indexSet := IndexSet{Indexes: []Index{firstShardIndex}, SeriesFile: sfile}
names, err := indexSet.MeasurementNamesByExpr(nil, nil)
if err != nil {
s.Logger.Warn("Cannot retrieve measurement names", zap.Error(err))
s.Logger.Warn("Cannot retrieve measurement names",
zap.Error(err),
logger.Shard(sh.ID()),
logger.Database(db))
return nil
}