metrics: Add canceled requests (#11881)

Add metric for canceled requests
This commit is contained in:
Klaus Post
2021-03-24 18:25:27 +01:00
committed by GitHub
parent 410e84d273
commit 749e9c5771
5 changed files with 44 additions and 1 deletions
+18
View File
@@ -74,6 +74,7 @@ type MetricName string
const (
total MetricName = "total"
errorsTotal MetricName = "error_total"
canceledTotal MetricName = "canceled_total"
healTotal MetricName = "heal_total"
hitsTotal MetricName = "hits_total"
inflightTotal MetricName = "inflight_total"
@@ -495,6 +496,15 @@ func getS3RequestsErrorsMD() MetricDescription {
Type: counterMetric,
}
}
func getS3RequestsCanceledMD() MetricDescription {
return MetricDescription{
Namespace: s3MetricNamespace,
Subsystem: requestsSubsystem,
Name: canceledTotal,
Help: "Total number S3 requests that were canceled from the client while processing",
Type: counterMetric,
}
}
func getCacheHitsTotalMD() MetricDescription {
return MetricDescription{
Namespace: minioNamespace,
@@ -576,6 +586,7 @@ func getHealObjectsHealTotalMD() MetricDescription {
Type: gaugeMetric,
}
}
func getHealObjectsFailTotalMD() MetricDescription {
return MetricDescription{
Namespace: healMetricNamespace,
@@ -1077,6 +1088,13 @@ func getHTTPMetrics() MetricsGroup {
VariableLabels: map[string]string{"api": api},
})
}
for api, value := range httpStats.TotalS3Canceled.APIStats {
metrics = append(metrics, Metric{
Description: getS3RequestsCanceledMD(),
Value: float64(value),
VariableLabels: map[string]string{"api": api},
})
}
return
},
}