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

Metrics for graphite web #623

Merged
merged 2 commits into from
May 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions api/middleware/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ func RequestStats() macaron.Handler {
ctx.Next()
status := rw.Status()
path := pathSlug(ctx.Req.URL.Path)
// graphite cluster requests use local=1
// this way we can differentiate "full" render requests from client to MT (encompassing data processing, proxing to graphite, etc)
// from "subrequests" where metrictank is called by graphite and graphite does the processing and returns to the client
if ctx.Req.Request.Form.Get("local") == "1" {
path += "-local"
}
stats.PathStatusCount(path, status)
stats.PathLatency(path, time.Since(start))
// only record the request size if the request succeeded.
Expand Down
5 changes: 0 additions & 5 deletions api/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ func (s *Server) RegisterRoutes() {
r.Get("/cluster", s.getClusterStatus)

r.Combo("/getdata", bind(models.GetData{})).Get(s.getData).Post(s.getData)
// equivalent to /render but used by graphite-metrictank so we can keep the stats separate
// note, you should not request anything from this endpoint that may trigger a loop
// (where MT proxies the req to graphite, graphite hits /get again, and so on).
// just don't request any function processing, or maybe just some of the stable functions
r.Combo("/get", withOrg, bind(models.GraphiteRender{})).Get(s.renderMetrics).Post(s.renderMetrics)

r.Combo("/index/find", bind(models.IndexFind{})).Get(s.indexFind).Post(s.indexFind)
r.Combo("/index/list", bind(models.IndexList{})).Get(s.indexList).Post(s.indexList)
Expand Down