mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: capitalise log messages for app platform (#74336)
This commit is contained in:
@@ -34,14 +34,14 @@ func (a *simpleAuthService) GetDashboardReadFilter(ctx context.Context, orgID in
|
||||
if kind == entityKindFolder {
|
||||
scopes, err := dashboards.GetInheritedScopes(ctx, orgID, uid, a.folderService)
|
||||
if err != nil {
|
||||
a.logger.Debug("could not retrieve inherited folder scopes:", "err", err)
|
||||
a.logger.Debug("Could not retrieve inherited folder scopes:", "err", err)
|
||||
}
|
||||
scopes = append(scopes, dashboards.ScopeFoldersProvider.GetResourceScopeUID(uid))
|
||||
return canReadFolder(scopes...)
|
||||
} else if kind == entityKindDashboard {
|
||||
scopes, err := dashboards.GetInheritedScopes(ctx, orgID, parent, a.folderService)
|
||||
if err != nil {
|
||||
a.logger.Debug("could not retrieve inherited folder scopes:", "err", err)
|
||||
a.logger.Debug("Could not retrieve inherited folder scopes:", "err", err)
|
||||
}
|
||||
scopes = append(scopes, dashboards.ScopeDashboardsProvider.GetResourceScopeUID(uid))
|
||||
scopes = append(scopes, dashboards.ScopeFoldersProvider.GetResourceScopeUID(parent))
|
||||
|
||||
@@ -380,7 +380,7 @@ func doSearchQuery(
|
||||
|
||||
reader, cancel, err := index.readerForIndex(indexTypeDashboard)
|
||||
if err != nil {
|
||||
logger.Error("error getting reader for dashboard index: %v", err)
|
||||
logger.Error("Error getting reader for dashboard index: %v", err)
|
||||
response.Error = err
|
||||
return response
|
||||
}
|
||||
@@ -493,7 +493,7 @@ func doSearchQuery(
|
||||
// execute this search on the reader
|
||||
documentMatchIterator, err := reader.Search(ctx, req)
|
||||
if err != nil {
|
||||
logger.Error("error executing search", "err", err)
|
||||
logger.Error("Error executing search", "err", err)
|
||||
response.Error = err
|
||||
return response
|
||||
}
|
||||
@@ -575,7 +575,7 @@ func doSearchQuery(
|
||||
return true
|
||||
})
|
||||
if err != nil {
|
||||
logger.Error("error loading stored fields", "err", err)
|
||||
logger.Error("Error loading stored fields", "err", err)
|
||||
response.Error = err
|
||||
return response
|
||||
}
|
||||
|
||||
@@ -60,9 +60,9 @@ func (q *PermissionFilter) logAccessDecision(decision bool, kind any, id string,
|
||||
|
||||
ctx = append(ctx, "kind", kind, "id", id, "reason", reason)
|
||||
if decision {
|
||||
q.log.Debug("allowing access", ctx...)
|
||||
q.log.Debug("Allowing access", ctx...)
|
||||
} else {
|
||||
q.log.Info("denying access", ctx...)
|
||||
q.log.Info("Denying access", ctx...)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -438,13 +438,13 @@ func (i *searchIndex) reportSizeOfIndexDiskBackup(orgID int64) {
|
||||
// create a temp directory to store the index
|
||||
tmpDir, err := os.MkdirTemp("", "grafana.dashboard_index")
|
||||
if err != nil {
|
||||
i.logger.Error("can't create temp dir", "error", err)
|
||||
i.logger.Error("Can't create temp dir", "error", err)
|
||||
return
|
||||
}
|
||||
defer func() {
|
||||
err := os.RemoveAll(tmpDir)
|
||||
if err != nil {
|
||||
i.logger.Error("can't remove temp dir", "error", err, "tmpDir", tmpDir)
|
||||
i.logger.Error("Can't remove temp dir", "error", err, "tmpDir", tmpDir)
|
||||
return
|
||||
}
|
||||
}()
|
||||
@@ -452,13 +452,13 @@ func (i *searchIndex) reportSizeOfIndexDiskBackup(orgID int64) {
|
||||
cancelCh := make(chan struct{})
|
||||
err = reader.Backup(tmpDir, cancelCh)
|
||||
if err != nil {
|
||||
i.logger.Error("can't create index disk backup", "error", err)
|
||||
i.logger.Error("Can't create index disk backup", "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
size, err := dirSize(tmpDir)
|
||||
if err != nil {
|
||||
i.logger.Error("can't calculate dir size", "error", err)
|
||||
i.logger.Error("Can't calculate dir size", "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -598,7 +598,7 @@ func (i *searchIndex) applyIndexUpdates(ctx context.Context, lastEventID int64)
|
||||
ctx = log.InitCounter(ctx)
|
||||
events, err := i.eventStore.GetAllEventsAfter(ctx, lastEventID)
|
||||
if err != nil {
|
||||
i.logger.Error("can't load events", "error", err)
|
||||
i.logger.Error("Can't load events", "error", err)
|
||||
return lastEventID
|
||||
}
|
||||
if len(events) == 0 {
|
||||
@@ -608,7 +608,7 @@ func (i *searchIndex) applyIndexUpdates(ctx context.Context, lastEventID int64)
|
||||
for _, e := range events {
|
||||
err := i.applyEventOnIndex(ctx, e)
|
||||
if err != nil {
|
||||
i.logger.Error("can't apply event", "error", err)
|
||||
i.logger.Error("Can't apply event", "error", err)
|
||||
return lastEventID
|
||||
}
|
||||
lastEventID = e.Id
|
||||
@@ -618,22 +618,22 @@ func (i *searchIndex) applyIndexUpdates(ctx context.Context, lastEventID int64)
|
||||
}
|
||||
|
||||
func (i *searchIndex) applyEventOnIndex(ctx context.Context, e *store.EntityEvent) error {
|
||||
i.logger.Debug("processing event", "event", e)
|
||||
i.logger.Debug("Processing event", "event", e)
|
||||
|
||||
if !strings.HasPrefix(e.EntityId, "database/") {
|
||||
i.logger.Warn("unknown storage", "entityId", e.EntityId)
|
||||
i.logger.Warn("Unknown storage", "entityId", e.EntityId)
|
||||
return nil
|
||||
}
|
||||
// database/org/entityType/path*
|
||||
parts := strings.SplitN(strings.TrimPrefix(e.EntityId, "database/"), "/", 3)
|
||||
if len(parts) != 3 {
|
||||
i.logger.Error("can't parse entityId", "entityId", e.EntityId)
|
||||
i.logger.Error("Can't parse entityId", "entityId", e.EntityId)
|
||||
return nil
|
||||
}
|
||||
orgIDStr := parts[0]
|
||||
orgID, err := strconv.ParseInt(orgIDStr, 10, 64)
|
||||
if err != nil {
|
||||
i.logger.Error("can't extract org ID", "entityId", e.EntityId)
|
||||
i.logger.Error("Can't extract org ID", "entityId", e.EntityId)
|
||||
return nil
|
||||
}
|
||||
kind := store.EntityType(parts[1])
|
||||
|
||||
@@ -198,7 +198,7 @@ func (s *StandardSearchService) getUser(ctx context.Context, backendUser *backen
|
||||
permissions, err := s.ac.GetUserPermissions(ctx, usr,
|
||||
accesscontrol.Options{ReloadCache: false})
|
||||
if err != nil {
|
||||
s.logger.Error("failed to retrieve user permissions", "error", err, "email", backendUser.Email)
|
||||
s.logger.Error("Failed to retrieve user permissions", "error", err, "email", backendUser.Email)
|
||||
return nil, errors.New("auth error")
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ func (s *StandardSearchService) doDashboardQuery(ctx context.Context, signedInUs
|
||||
|
||||
if q.WithAllowedActions {
|
||||
if err := s.addAllowedActionsField(ctx, orgID, signedInUser, response); err != nil {
|
||||
s.logger.Error("error when adding the allowedActions field", "err", err)
|
||||
s.logger.Error("Error when adding the allowedActions field", "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ func updateUsageStats(ctx context.Context, reader *bluge.Reader, logger log.Logg
|
||||
// execute this search on the reader
|
||||
documentMatchIterator, err := reader.Search(ctx, req)
|
||||
if err != nil {
|
||||
logger.Error("error executing search", "err", err)
|
||||
logger.Error("Error executing search", "err", err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user