Repository: minio/minio (language: go)

Issue:
Wrong metric type for minio_s3_time_ttfb_seconds_distribution?
Problem: it is not possible to use histogram_quantile function on minio_s3_time_ttfb_seconds_distribution

Assumption: minio probably use wrong metric type for request duration.

1. According prometheus documentation for distribution should be used summary and histogram metrics type
https://prometheus.io/docs/practices/histograms/

2. According https://github.com/minio/minio/blob/master/cmd/metrics-v2.go
request duration is the only minio distribution metric, which use gauge.

Other distributions use Histogram.

```
sizeDistribution = "size_distribution"
versionDistribution = "version_distribution"
ttfbDistribution = "ttfb_seconds_distribution"

...
Name: sizeDistribution,
Help: "Distribution of object sizes in the bucket, includes label for the bucket name",
Type: histogramMetric,

Name: versionDistribution,
Help: "Distribution of object sizes in the bucket, includes label for the bucket name",
Type: histogramMetric,

Name: ttfbDistribution,
Help: "Distribution of the time to first byte across API calls",
Type: gaugeMetric,

Name: latencyMilliSec,
Help: "Replication latency in milliseconds",
Type: histogramMetric,
```

3. Even data of this metric looks in tsdb as cumulative counter, not a gauge, it always goes up.


I search for answer in github issues, but didn't find it.

It was previously asked in 
https://github.com/minio/minio/discussions/14293
https://github.com/minio/minio/issues/12540
but there was no answer

By any chance is it possible that it's some kind of mistake? Is there any information for such decision?
Thank you.



Discussion / hints:

Fix patch:
diff --git a/cmd/metrics-v2.go b/cmd/metrics-v2.go
index fbb728ca823f7..f3f4537ca3af3 100644
--- a/cmd/metrics-v2.go
+++ b/cmd/metrics-v2.go
@@ -936,7 +936,7 @@ func getS3TTFBDistributionMD() MetricDescription {
 		Subsystem: timeSubsystem,
 		Name:      ttfbDistribution,
 		Help:      "Distribution of the time to first byte across API calls",
-		Type:      gaugeMetric,
+		Type:      histogramMetric,
 	}
 }
 


Test patch: