mirror of
https://github.com/pgsty/minio.git
synced 2026-07-23 06:00:24 +03:00
add validation test for v3 metrics for all its endpoints (#20094)
add unit test for v3 metrics for all its exposed endpoints
Bonus:
- support OpenMetrics encoding
- adds boot time for prometheus
- continueOnError is better to serve as
much metrics as possible.
This commit is contained in:
@@ -35,8 +35,8 @@ type collectorPath string
|
||||
// converted to snake-case (by replaced '/' and '-' with '_') and prefixed with
|
||||
// `minio_`.
|
||||
func (cp collectorPath) metricPrefix() string {
|
||||
s := strings.TrimPrefix(string(cp), "/")
|
||||
s = strings.ReplaceAll(s, "/", "_")
|
||||
s := strings.TrimPrefix(string(cp), SlashSeparator)
|
||||
s = strings.ReplaceAll(s, SlashSeparator, "_")
|
||||
s = strings.ReplaceAll(s, "-", "_")
|
||||
return "minio_" + s
|
||||
}
|
||||
@@ -56,8 +56,8 @@ func (cp collectorPath) isDescendantOf(arg string) bool {
|
||||
if len(arg) >= len(descendant) {
|
||||
return false
|
||||
}
|
||||
if !strings.HasSuffix(arg, "/") {
|
||||
arg += "/"
|
||||
if !strings.HasSuffix(arg, SlashSeparator) {
|
||||
arg += SlashSeparator
|
||||
}
|
||||
return strings.HasPrefix(descendant, arg)
|
||||
}
|
||||
@@ -72,10 +72,11 @@ const (
|
||||
GaugeMT
|
||||
// HistogramMT - represents a histogram metric.
|
||||
HistogramMT
|
||||
// rangeL - represents a range label.
|
||||
rangeL = "range"
|
||||
)
|
||||
|
||||
// rangeL - represents a range label.
|
||||
const rangeL = "range"
|
||||
|
||||
func (mt MetricType) String() string {
|
||||
switch mt {
|
||||
case CounterMT:
|
||||
|
||||
Reference in New Issue
Block a user