Metrics: use consistent naming for exported variables (#18134)
* Metrics: remove unused metrics Metric `M_Grafana_Version` is not used anywhere, nor the mentioned `M_Grafana_Build_Version`. Seems to be an artefact? * Metrics: make the naming consistent * Metrics: add comments to exported vars * Metrics: use proper naming Fixes #18110
This commit is contained in:
committed by
Torkel Ödegaard
parent
15ce5a68cf
commit
75fa1f0207
@@ -70,5 +70,5 @@ func (e *DefaultEvalHandler) Eval(context *EvalContext) {
|
||||
context.EndTime = time.Now()
|
||||
|
||||
elapsedTime := context.EndTime.Sub(context.StartTime).Nanoseconds() / int64(time.Millisecond)
|
||||
metrics.M_Alerting_Execution_Time.Observe(float64(elapsedTime))
|
||||
metrics.MAlertingExecutionTime.Observe(float64(elapsedTime))
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ func (n *notificationService) sendAndMarkAsComplete(evalContext *EvalContext, no
|
||||
notifier := notifierState.notifier
|
||||
|
||||
n.log.Debug("Sending notification", "type", notifier.GetType(), "uid", notifier.GetNotifierUID(), "isDefault", notifier.GetIsDefault())
|
||||
metrics.M_Alerting_Notification_Sent.WithLabelValues(notifier.GetType()).Inc()
|
||||
metrics.MAlertingNotificationSent.WithLabelValues(notifier.GetType()).Inc()
|
||||
|
||||
err := notifier.Notify(evalContext)
|
||||
|
||||
|
||||
@@ -43,6 +43,6 @@ func (arr *defaultRuleReader) fetch() []*Rule {
|
||||
}
|
||||
}
|
||||
|
||||
metrics.M_Alerting_Active_Alerts.Set(float64(len(res)))
|
||||
metrics.MAlertingActiveAlerts.Set(float64(len(res)))
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ func (handler *defaultResultHandler) handle(evalContext *EvalContext) error {
|
||||
annotationData.Set("noData", true)
|
||||
}
|
||||
|
||||
metrics.M_Alerting_Result_State.WithLabelValues(string(evalContext.Rule.State)).Inc()
|
||||
metrics.MAlertingResultState.WithLabelValues(string(evalContext.Rule.State)).Inc()
|
||||
if evalContext.shouldUpdateAlertState() {
|
||||
handler.log.Info("New state change", "alertId", evalContext.Rule.ID, "newState", evalContext.Rule.State, "prev state", evalContext.PrevAlertState)
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ func saveDashboard(sess *DBSession, cmd *m.SaveDashboardCommand) error {
|
||||
dash.CreatedBy = userId
|
||||
dash.Updated = time.Now()
|
||||
dash.UpdatedBy = userId
|
||||
metrics.M_Api_Dashboard_Insert.Inc()
|
||||
metrics.MApiDashboardInsert.Inc()
|
||||
affectedRows, err = sess.Insert(dash)
|
||||
} else {
|
||||
dash.SetVersion(dash.Version + 1)
|
||||
|
||||
@@ -25,7 +25,7 @@ func init() {
|
||||
}
|
||||
|
||||
func GetDataSourceById(query *m.GetDataSourceByIdQuery) error {
|
||||
metrics.M_DB_DataSource_QueryById.Inc()
|
||||
metrics.MDBDataSourceQueryByID.Inc()
|
||||
|
||||
datasource := m.DataSource{OrgId: query.OrgId, Id: query.Id}
|
||||
has, err := x.Get(&datasource)
|
||||
|
||||
Reference in New Issue
Block a user