mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: capitalise messages for alerting (#74335)
This commit is contained in:
@@ -54,7 +54,7 @@ func (srv AlertmanagerSrv) RouteGetAMStatus(c *contextmodel.ReqContext) response
|
||||
func (srv AlertmanagerSrv) RouteCreateSilence(c *contextmodel.ReqContext, postableSilence apimodels.PostableSilence) response.Response {
|
||||
err := postableSilence.Validate(strfmt.Default)
|
||||
if err != nil {
|
||||
srv.log.Error("silence failed validation", "error", err)
|
||||
srv.log.Error("Silence failed validation", "error", err)
|
||||
return ErrResp(http.StatusBadRequest, err, "silence failed validation")
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ func (srv AlertmanagerSrv) RouteDeleteAlertingConfig(c *contextmodel.ReqContext)
|
||||
}
|
||||
|
||||
if err := am.SaveAndApplyDefaultConfig(c.Req.Context()); err != nil {
|
||||
srv.log.Error("unable to save and apply default alertmanager configuration", "error", err)
|
||||
srv.log.Error("Unable to save and apply default alertmanager configuration", "error", err)
|
||||
return ErrResp(http.StatusInternalServerError, err, "failed to save and apply default Alertmanager configuration")
|
||||
}
|
||||
|
||||
@@ -471,6 +471,6 @@ func (srv AlertmanagerSrv) AlertmanagerFor(orgID int64) (Alertmanager, *response
|
||||
return am, response.Error(http.StatusConflict, err.Error(), err)
|
||||
}
|
||||
|
||||
srv.log.Error("unable to obtain the org's Alertmanager", "error", err)
|
||||
srv.log.Error("Unable to obtain the org's Alertmanager", "error", err)
|
||||
return nil, response.Error(http.StatusInternalServerError, "unable to obtain org's Alertmanager", err)
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ func (srv ConfigSrv) RouteDeleteNGalertConfig(c *contextmodel.ReqContext) respon
|
||||
|
||||
err := srv.store.DeleteAdminConfiguration(c.OrgID)
|
||||
if err != nil {
|
||||
srv.log.Error("unable to delete configuration", "error", err)
|
||||
srv.log.Error("Unable to delete configuration", "error", err)
|
||||
return ErrResp(http.StatusInternalServerError, err, "")
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ func (srv PrometheusSrv) RouteGetRuleStatuses(c *contextmodel.ReqContext) respon
|
||||
}
|
||||
|
||||
if len(namespaceMap) == 0 {
|
||||
srv.log.Debug("user does not have access to any namespaces")
|
||||
srv.log.Debug("User does not have access to any namespaces")
|
||||
return response.JSON(http.StatusOK, ruleResponse)
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ func (srv PrometheusSrv) RouteGetRuleStatuses(c *contextmodel.ReqContext) respon
|
||||
for groupKey, rules := range groupedRules {
|
||||
folder := namespaceMap[groupKey.NamespaceUID]
|
||||
if folder == nil {
|
||||
srv.log.Warn("query returned rules that belong to folder the user does not have access to. All rules that belong to that namespace will not be added to the response", "folder_uid", groupKey.NamespaceUID)
|
||||
srv.log.Warn("Query returned rules that belong to folder the user does not have access to. All rules that belong to that namespace will not be added to the response", "folder_uid", groupKey.NamespaceUID)
|
||||
continue
|
||||
}
|
||||
if !authorizeAccessToRuleGroup(rules, hasAccess) {
|
||||
@@ -443,7 +443,7 @@ func ruleToQuery(logger log.Logger, rule *ngmodels.AlertRule) string {
|
||||
}
|
||||
|
||||
// For any other type of error, it is unexpected abort and return the whole JSON.
|
||||
logger.Debug("failed to parse a query", "error", err)
|
||||
logger.Debug("Failed to parse a query", "error", err)
|
||||
queryErr = err
|
||||
break
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ func (srv RulerSrv) RouteDeleteAlertRules(c *contextmodel.ReqContext, namespaceT
|
||||
}
|
||||
|
||||
if len(ruleList) == 0 {
|
||||
logger.Debug("no alert rules to delete from namespace/group")
|
||||
logger.Debug("No alert rules to delete from namespace/group")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ func (srv RulerSrv) RouteGetRulesConfig(c *contextmodel.ReqContext) response.Res
|
||||
result := apimodels.NamespaceConfigResponse{}
|
||||
|
||||
if len(namespaceMap) == 0 {
|
||||
srv.log.Debug("user has no access to any namespaces")
|
||||
srv.log.Debug("User has no access to any namespaces")
|
||||
return response.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ func (srv RulerSrv) RouteGetRulesConfig(c *contextmodel.ReqContext) response.Res
|
||||
for groupKey, rules := range configs {
|
||||
folder, ok := namespaceMap[groupKey.NamespaceUID]
|
||||
if !ok {
|
||||
srv.log.Error("namespace not visible to the user", "user", c.SignedInUser.UserID, "namespace", groupKey.NamespaceUID)
|
||||
srv.log.Error("Namespace not visible to the user", "user", c.SignedInUser.UserID, "namespace", groupKey.NamespaceUID)
|
||||
continue
|
||||
}
|
||||
if !authorizeAccessToRuleGroup(rules, hasAccess) {
|
||||
@@ -331,7 +331,7 @@ func (srv RulerSrv) updateAlertRulesInGroup(c *contextmodel.ReqContext, groupKey
|
||||
|
||||
if groupChanges.IsEmpty() {
|
||||
finalChanges = groupChanges
|
||||
logger.Info("no changes detected in the request. Do nothing")
|
||||
logger.Info("No changes detected in the request. Do nothing")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ func (srv RulerSrv) updateAlertRulesInGroup(c *contextmodel.ReqContext, groupKey
|
||||
}
|
||||
|
||||
finalChanges = store.UpdateCalculatedRuleFields(groupChanges)
|
||||
logger.Debug("updating database with the authorized changes", "add", len(finalChanges.New), "update", len(finalChanges.New), "delete", len(finalChanges.Delete))
|
||||
logger.Debug("Updating database with the authorized changes", "add", len(finalChanges.New), "update", len(finalChanges.New), "delete", len(finalChanges.Delete))
|
||||
|
||||
// Delete first as this could prevent future unique constraint violations.
|
||||
if len(finalChanges.Delete) > 0 {
|
||||
@@ -368,7 +368,7 @@ func (srv RulerSrv) updateAlertRulesInGroup(c *contextmodel.ReqContext, groupKey
|
||||
if len(finalChanges.Update) > 0 {
|
||||
updates := make([]ngmodels.UpdateRule, 0, len(finalChanges.Update))
|
||||
for _, update := range finalChanges.Update {
|
||||
logger.Debug("updating rule", "rule_uid", update.New.UID, "diff", update.Diff.String())
|
||||
logger.Debug("Updating rule", "rule_uid", update.New.UID, "diff", update.Diff.String())
|
||||
updates = append(updates, ngmodels.UpdateRule{
|
||||
Existing: update.Existing,
|
||||
New: *update.New,
|
||||
|
||||
@@ -25,7 +25,7 @@ func NewHooks(logger log.Logger) *Hooks {
|
||||
// Add creates a new request hook for a path, causing requests to the path to
|
||||
// be handled by the hook function, and not the original handler.
|
||||
func (h *Hooks) Set(path string, hook RequestHandlerFunc) {
|
||||
h.logger.Info("setting hook override for the specified route", "path", path)
|
||||
h.logger.Info("Setting hook override for the specified route", "path", path)
|
||||
h.hooks[path] = hook
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ func (h *Hooks) Set(path string, hook RequestHandlerFunc) {
|
||||
func (h *Hooks) Wrap(next RequestHandlerFunc) RequestHandlerFunc {
|
||||
return func(req *contextmodel.ReqContext) response.Response {
|
||||
if hook, ok := h.hooks[req.Context.Req.URL.Path]; ok {
|
||||
h.logger.Debug("hook defined - invoking new handler", "path", req.Context.Req.URL.Path)
|
||||
h.logger.Debug("Hook defined - invoking new handler", "path", req.Context.Req.URL.Path)
|
||||
return hook(req)
|
||||
}
|
||||
return next(req)
|
||||
|
||||
Reference in New Issue
Block a user