Rendering: Add metrics (#23827)

* Rendering: base metrics

* Rendering: rendering_queue_size metric

* Chore: fix linter error

* Rendering metrics: refactoring

* Apply suggestions from code review

Co-Authored-By: Marcus Efraimsson <marcus.efraimsson@gmail.com>

* Rendering metrics: handle DeadlineExceeded errors

* Rendering metrics: don't measure canceled request time

* Rendering metrics: revert deleting summary for canceled requests

* Update pkg/services/rendering/rendering.go

Co-Authored-By: Marcus Efraimsson <marcus.efraimsson@gmail.com>

* Rendering: return ErrTimeout if context deadline exceeded

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
This commit is contained in:
Alexander Zobnin
2020-04-27 15:29:46 +03:00
committed by GitHub
co-authored by Marcus Efraimsson
parent 830e8dc5fd
commit fa710a3172
3 changed files with 65 additions and 0 deletions
+37
View File
@@ -98,6 +98,12 @@ var (
// LDAPUsersSyncExecutionTime is a metric summary for LDAP users sync execution duration
LDAPUsersSyncExecutionTime prometheus.Summary
// MRenderingRequestTotal is a metric counter for image rendering requests
MRenderingRequestTotal *prometheus.CounterVec
// MRenderingQueue is a metric gauge for image rendering queue size
MRenderingQueue prometheus.Gauge
)
// Timers
@@ -107,6 +113,9 @@ var (
// MAlertingExecutionTime is a metric summary of alert exeuction duration
MAlertingExecutionTime prometheus.Summary
// MRenderingSummary is a metric summary for image rendering request duration
MRenderingSummary *prometheus.SummaryVec
)
// StatTotals
@@ -343,6 +352,31 @@ func init() {
Namespace: ExporterName,
})
MRenderingRequestTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "rendering_request_total",
Help: "counter for image rendering requests",
Namespace: ExporterName,
},
[]string{"status"},
)
MRenderingSummary = prometheus.NewSummaryVec(
prometheus.SummaryOpts{
Name: "rendering_request_duration_milliseconds",
Help: "summary of image rendering request duration",
Objectives: objectiveMap,
Namespace: ExporterName,
},
[]string{"status"},
)
MRenderingQueue = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "rendering_queue_size",
Help: "size of image rendering queue",
Namespace: ExporterName,
})
MDataSourceProxyReqTimer = prometheus.NewSummary(prometheus.SummaryOpts{
Name: "api_dataproxy_request_all_milliseconds",
Help: "summary for dataproxy request duration",
@@ -489,6 +523,9 @@ func initMetricVars() {
MAwsCloudWatchGetMetricData,
MDBDataSourceQueryByID,
LDAPUsersSyncExecutionTime,
MRenderingRequestTotal,
MRenderingSummary,
MRenderingQueue,
MAlertingActiveAlerts,
MStatTotalDashboards,
MStatTotalUsers,