瀏覽代碼

feat(alerting): fixed graphite log issue

Torkel Ödegaard 9 年之前
父節點
當前提交
0d9c9526b9
共有 2 個文件被更改,包括 6 次插入3 次删除
  1. 1 1
      pkg/services/alerting/engine.go
  2. 5 2
      pkg/tsdb/graphite/graphite.go

+ 1 - 1
pkg/services/alerting/engine.go

@@ -92,7 +92,7 @@ func (e *Engine) executeJob(job *AlertJob) {
 
 	case result := <-resultChan:
 		result.Duration = float64(time.Since(now).Nanoseconds()) / float64(1000000)
-		e.log.Debug("Job Execution done", "time_taken", result.Duration, "ruleId", job.Rule.Id)
+		e.log.Debug("Job Execution done", "timeTakenMs", result.Duration, "ruleId", job.Rule.Id)
 		e.resultQueue <- result
 	}
 }

+ 5 - 2
pkg/tsdb/graphite/graphite.go

@@ -7,8 +7,8 @@ import (
 	"net/url"
 	"time"
 
-	"github.com/Unknwon/log"
 	"github.com/grafana/grafana/pkg/components/simplejson"
+	"github.com/grafana/grafana/pkg/log"
 	"github.com/grafana/grafana/pkg/tsdb"
 )
 
@@ -20,7 +20,10 @@ func NewGraphiteExecutor(dsInfo *tsdb.DataSourceInfo) tsdb.Executor {
 	return &GraphiteExecutor{dsInfo}
 }
 
+var glog log.Logger
+
 func init() {
+	glog = log.New("tsdb.graphite")
 	tsdb.RegisterExecutor("graphite", NewGraphiteExecutor)
 }
 
@@ -57,7 +60,7 @@ func (e *GraphiteExecutor) Execute(queries tsdb.QuerySlice, context *tsdb.QueryC
 	var data []TargetResponseDTO
 	err = json.Unmarshal(body, &data)
 	if err != nil {
-		log.Info("Error: %v", string(body))
+		glog.Info("Failed to unmarshal graphite response", "error", err)
 		result.Error = err
 		return result
 	}