Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
measure duration of plan.Run()
Browse files Browse the repository at this point in the history
  • Loading branch information
Dieterbe committed Jul 14, 2017
1 parent 30ed395 commit 6677796
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion api/graphite.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ var (

// metric api.request.render.series is the number of targets a /render request is handling.
reqRenderTargetCount = stats.NewMeter32("api.request.render.targets", false)

// metric plan.run is the time spent running the plan for a request (function processing of all targets and runtime consolidation)
planRunDuration = stats.NewLatencyHistogram15s32("plan.run")
)

type Series struct {
Expand Down Expand Up @@ -583,5 +586,8 @@ func (s *Server) executePlan(orgId int, plan expr.Plan) ([]models.Series, error)
data[q] = append(data[q], serie)
}

return plan.Run(data)
preRun := time.Now()
out, err = plan.Run(data)
planRunDuration.Value(time.Since(preRun))
return out, err
}
5 changes: 5 additions & 0 deletions dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,11 @@
"refId": "F",
"target": "alias(metrictank.stats.$environment.$instance.mem.to_iter.latency.mean.gauge32, 'mem to iter')",
"textEditor": false
},
{
"refId": "G",
"target": "alias(metrictank.stats.$environment.$instance.plan.run.latency.mean.gauge32, 'plan run')",
"textEditor": false
}
],
"thresholds": [],
Expand Down
2 changes: 2 additions & 0 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ a counter of the number of GC cycles since process start
a count of times a metric did not validate
* `metrics_decode_err`:
a count of times an input message (MetricData, MetricDataArray or carbon line) failed to parse
* `plan.run`:
the time spent running the plan for a request (function processing of all targets and runtime consolidation)
* `store.cassandra.chunk_operations.save_fail`:
counter of failed saves
* `store.cassandra.chunk_operations.save_ok`:
Expand Down

0 comments on commit 6677796

Please sign in to comment.