Commit a5c38552 by Torkel Ödegaard

Added dashboard snapshot metrics

parent ddd3df26
...@@ -3,6 +3,7 @@ package api ...@@ -3,6 +3,7 @@ package api
import ( import (
"github.com/grafana/grafana/pkg/api/dtos" "github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/metrics"
"github.com/grafana/grafana/pkg/middleware" "github.com/grafana/grafana/pkg/middleware"
m "github.com/grafana/grafana/pkg/models" m "github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/util" "github.com/grafana/grafana/pkg/util"
...@@ -16,6 +17,8 @@ func CreateDashboardSnapshot(c *middleware.Context, cmd m.CreateDashboardSnapsho ...@@ -16,6 +17,8 @@ func CreateDashboardSnapshot(c *middleware.Context, cmd m.CreateDashboardSnapsho
return return
} }
metrics.M_Api_Dashboard_Snapshot_Create.Inc(1)
c.JSON(200, util.DynMap{"key": cmd.Key}) c.JSON(200, util.DynMap{"key": cmd.Key})
} }
...@@ -35,6 +38,9 @@ func GetDashboardSnapshot(c *middleware.Context) { ...@@ -35,6 +38,9 @@ func GetDashboardSnapshot(c *middleware.Context) {
Meta: dtos.DashboardMeta{IsSnapshot: true}, Meta: dtos.DashboardMeta{IsSnapshot: true},
} }
metrics.M_Api_Dashboard_Snapshot_Get.Inc(1)
c.Resp.Header().Set("Cache-Control", "public, max-age=31536000") c.Resp.Header().Set("Cache-Control", "public, max-age=31536000")
c.JSON(200, dto) c.JSON(200, dto)
} }
...@@ -21,5 +21,8 @@ var ( ...@@ -21,5 +21,8 @@ var (
M_Api_Login_OAuth = NewComboCounterRef("api.login.oauth") M_Api_Login_OAuth = NewComboCounterRef("api.login.oauth")
M_Api_Org_Create = NewComboCounterRef("api.org.create") M_Api_Org_Create = NewComboCounterRef("api.org.create")
M_Api_Dashboard_Snapshot_Create = NewComboCounterRef("api.dashboard_snapshot.create")
M_Api_Dashboard_Snapshot_Get = NewComboCounterRef("api.dashboard_snapshot.get")
M_Models_Dashboard_Insert = NewComboCounterRef("models.dashboard.insert") M_Models_Dashboard_Insert = NewComboCounterRef("models.dashboard.insert")
) )
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