Commit 35a7a3a5 by Torkel Ödegaard

feat(instrumentation): added some more timers

parent e0c60488
......@@ -31,8 +31,6 @@ func isDashboardStarredByUser(c *middleware.Context, dashId int64) (bool, error)
}
func GetDashboard(c *middleware.Context) {
metrics.M_Api_Dashboard_Get.Inc(1)
slug := strings.ToLower(c.Params(":slug"))
query := m.GetDashboardQuery{Slug: slug, OrgId: c.OrgId}
......@@ -76,6 +74,7 @@ func GetDashboard(c *middleware.Context) {
},
}
c.TimeRequest(metrics.M_Api_Dashboard_Get)
c.JSON(200, dto)
}
......@@ -150,8 +149,7 @@ func PostDashboard(c *middleware.Context, cmd m.SaveDashboardCommand) {
return
}
metrics.M_Api_Dashboard_Post.Inc(1)
c.TimeRequest(metrics.M_Api_Dashboard_Save)
c.JSON(200, util.DynMap{"status": "success", "slug": cmd.Result.Slug, "version": cmd.Result.Version})
}
......
......@@ -4,6 +4,7 @@ import (
"strconv"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/metrics"
"github.com/grafana/grafana/pkg/middleware"
"github.com/grafana/grafana/pkg/services/search"
)
......@@ -42,5 +43,6 @@ func Search(c *middleware.Context) {
return
}
c.TimeRequest(metrics.M_Api_Dashboard_Search)
c.JSON(200, searchQuery.Result)
}
......@@ -13,8 +13,9 @@ var (
M_Api_User_SignUpStarted Counter
M_Api_User_SignUpCompleted Counter
M_Api_User_SignUpInvite Counter
M_Api_Dashboard_Get Counter
M_Api_Dashboard_Post Counter
M_Api_Dashboard_Save Timer
M_Api_Dashboard_Get Timer
M_Api_Dashboard_Search Timer
M_Api_Admin_User_Create Counter
M_Api_Login_Post Counter
M_Api_Login_OAuth Counter
......@@ -43,9 +44,11 @@ func initMetricVars(settings *MetricSettings) {
M_Api_User_SignUpStarted = RegCounter("api.user.signup_started")
M_Api_User_SignUpCompleted = RegCounter("api.user.signup_completed")
M_Api_User_SignUpInvite = RegCounter("api.user.signup_invite")
M_Api_Dashboard_Get = RegCounter("api.dashboard.get")
M_Api_Dashboard_Post = RegCounter("api.dashboard.post")
M_Api_Dashboard_Save = RegTimer("api.dashboard.save")
M_Api_Dashboard_Get = RegTimer("api.dashboard.get")
M_Api_Dashboard_Search = RegTimer("api.dashboard.search")
M_Api_Admin_User_Create = RegCounter("api.admin.user_create")
M_Api_Login_Post = RegCounter("api.login.post")
M_Api_Login_OAuth = RegCounter("api.login.oauth")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment