SQL Expressions: Fixes for Prometheus Metric Instrumentation (#106722)
* capture errors on metrics * rename seconds to sql_command_duration_milliseconds to match unit that has been captured, and update buckets * rename sql_command_errors_total to sql_command_count
This commit is contained in:
+12
-12
@@ -10,7 +10,7 @@ type ExprMetrics struct {
|
||||
DSRequests *prometheus.CounterVec
|
||||
ExpressionsQuerySummary *prometheus.SummaryVec
|
||||
SqlCommandDuration *prometheus.HistogramVec
|
||||
SqlCommandErrorCount *prometheus.CounterVec
|
||||
SqlCommandCount *prometheus.CounterVec
|
||||
SqlCommandCellCount *prometheus.HistogramVec
|
||||
}
|
||||
|
||||
@@ -37,17 +37,17 @@ func newExprMetrics(subsystem string) *ExprMetrics {
|
||||
SqlCommandDuration: prometheus.NewHistogramVec(prometheus.HistogramOpts{
|
||||
Namespace: "grafana",
|
||||
Subsystem: subsystem,
|
||||
Name: "sql_command_duration_seconds",
|
||||
Help: "Duration of SQL command execution",
|
||||
Buckets: prometheus.DefBuckets,
|
||||
Name: "sql_command_duration_milliseconds",
|
||||
Help: "Duration of SQL command execution in milliseconds",
|
||||
Buckets: []float64{100, 200, 300, 500, 750, 1000, 2000, 5000, 10000},
|
||||
}, []string{"status"}),
|
||||
|
||||
SqlCommandErrorCount: prometheus.NewCounterVec(prometheus.CounterOpts{
|
||||
SqlCommandCount: prometheus.NewCounterVec(prometheus.CounterOpts{
|
||||
Namespace: "grafana",
|
||||
Subsystem: subsystem,
|
||||
Name: "sql_command_errors_total",
|
||||
Help: "Total number of SQL command execution errors",
|
||||
}, []string{}),
|
||||
Name: "sql_command_count",
|
||||
Help: "Total number of SQL command executions with a status label",
|
||||
}, []string{"status"}),
|
||||
|
||||
SqlCommandCellCount: prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
@@ -73,7 +73,7 @@ func NewSSEMetrics(reg prometheus.Registerer) *ExprMetrics {
|
||||
|
||||
SqlCommandDuration: newExprMetrics(metricsSubSystem).SqlCommandDuration,
|
||||
|
||||
SqlCommandErrorCount: newExprMetrics(metricsSubSystem).SqlCommandErrorCount,
|
||||
SqlCommandCount: newExprMetrics(metricsSubSystem).SqlCommandCount,
|
||||
|
||||
SqlCommandCellCount: newExprMetrics(metricsSubSystem).SqlCommandCellCount,
|
||||
}
|
||||
@@ -83,7 +83,7 @@ func NewSSEMetrics(reg prometheus.Registerer) *ExprMetrics {
|
||||
m.DSRequests,
|
||||
m.ExpressionsQuerySummary,
|
||||
m.SqlCommandDuration,
|
||||
m.SqlCommandErrorCount,
|
||||
m.SqlCommandCount,
|
||||
m.SqlCommandCellCount,
|
||||
)
|
||||
}
|
||||
@@ -102,7 +102,7 @@ func NewQueryServiceExpressionsMetrics(reg prometheus.Registerer) *ExprMetrics {
|
||||
|
||||
SqlCommandDuration: newExprMetrics(metricsSubSystem).SqlCommandDuration,
|
||||
|
||||
SqlCommandErrorCount: newExprMetrics(metricsSubSystem).SqlCommandErrorCount,
|
||||
SqlCommandCount: newExprMetrics(metricsSubSystem).SqlCommandCount,
|
||||
|
||||
SqlCommandCellCount: newExprMetrics(metricsSubSystem).SqlCommandCellCount,
|
||||
}
|
||||
@@ -112,7 +112,7 @@ func NewQueryServiceExpressionsMetrics(reg prometheus.Registerer) *ExprMetrics {
|
||||
m.DSRequests,
|
||||
m.ExpressionsQuerySummary,
|
||||
m.SqlCommandDuration,
|
||||
m.SqlCommandErrorCount,
|
||||
m.SqlCommandCount,
|
||||
m.SqlCommandCellCount,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user