Add MFolderIDsServiceCount to count folderIDs in services pkg (#81237)
This commit is contained in:
@@ -367,6 +367,7 @@ func getExistingDashboardByTitleAndFolder(sess *db.Session, dash *dashboards.Das
|
||||
return isParentFolderChanged, dashboards.ErrDashboardFolderWithSameNameAsDashboard
|
||||
}
|
||||
|
||||
metrics.MFolderIDsServiceCount.WithLabelValues(metrics.Dashboard).Inc()
|
||||
// nolint:staticcheck
|
||||
if !dash.IsFolder && (dash.FolderID != existing.FolderID || dash.ID == 0) {
|
||||
isParentFolderChanged = true
|
||||
@@ -818,6 +819,7 @@ func (d *dashboardStore) deleteAlertDefinition(dashboardId int64, sess *db.Sessi
|
||||
func (d *dashboardStore) GetDashboard(ctx context.Context, query *dashboards.GetDashboardQuery) (*dashboards.Dashboard, error) {
|
||||
var queryResult *dashboards.Dashboard
|
||||
err := d.store.WithDbSession(ctx, func(sess *db.Session) error {
|
||||
metrics.MFolderIDsServiceCount.WithLabelValues(metrics.Dashboard).Inc()
|
||||
// nolint:staticcheck
|
||||
if query.ID == 0 && len(query.UID) == 0 && (query.Title == nil || (query.FolderID == nil && query.FolderUID == "")) {
|
||||
return dashboards.ErrDashboardIdentifierNotSet
|
||||
@@ -837,6 +839,7 @@ func (d *dashboardStore) GetDashboard(ctx context.Context, query *dashboards.Get
|
||||
// nolint:staticcheck
|
||||
dashboard.FolderID = *query.FolderID
|
||||
mustCols = append(mustCols, "folder_id")
|
||||
metrics.MFolderIDsServiceCount.WithLabelValues(metrics.Dashboard).Inc()
|
||||
}
|
||||
|
||||
has, err := sess.MustCols(mustCols...).Get(&dashboard)
|
||||
@@ -940,7 +943,7 @@ func (d *dashboardStore) FindDashboards(ctx context.Context, query *dashboards.F
|
||||
if len(query.Type) > 0 {
|
||||
filters = append(filters, searchstore.TypeFilter{Dialect: d.store.GetDialect(), Type: query.Type})
|
||||
}
|
||||
|
||||
metrics.MFolderIDsServiceCount.WithLabelValues(metrics.Dashboard).Inc()
|
||||
// nolint:staticcheck
|
||||
if len(query.FolderIds) > 0 {
|
||||
filters = append(filters, searchstore.FolderFilter{IDs: query.FolderIds})
|
||||
@@ -1013,6 +1016,7 @@ func (d *dashboardStore) CountDashboardsInFolder(
|
||||
var count int64
|
||||
var err error
|
||||
err = d.store.WithDbSession(ctx, func(sess *db.Session) error {
|
||||
metrics.MFolderIDsServiceCount.WithLabelValues(metrics.Dashboard).Inc()
|
||||
// nolint:staticcheck
|
||||
session := sess.In("folder_id", req.FolderID).In("org_id", req.OrgID).
|
||||
In("is_folder", d.store.GetDialect().BooleanStr(false))
|
||||
|
||||
Reference in New Issue
Block a user