Skip to content
Permalink
Browse files

Move default histogram buckets to a constant

  • Loading branch information...
LeSuisse committed May 30, 2019
1 parent 6fff4cd commit a0e204b120183ca91a042d22d2806a3cae1b19a3
Showing with 21 additions and 26 deletions.
  1. +21 −26 src/Prometheus/Histogram.php
@@ -15,6 +15,26 @@
*/
final class Histogram extends Metric
{
/**
* List of default buckets suitable for typical web application latency metrics
*/
public const DEFAULT_BUCKETS = [
0.005,
0.01,
0.025,
0.05,
0.075,
0.1,
0.25,
0.5,
0.75,
1.0,
2.5,
5.0,
7.5,
10.0,
];
/** @var HistogramStorage */
private $storage;
@@ -30,7 +50,7 @@ public function __construct(HistogramStorage $storage, MetricName $name, string
$this->storage = $storage;
if ($buckets === null) {
$buckets = self::getDefaultBuckets();
$buckets = self::DEFAULT_BUCKETS;
}
if (count($buckets) === 0) {
@@ -48,31 +68,6 @@ public function __construct(HistogramStorage $storage, MetricName $name, string
$this->buckets = $buckets;
}
/**
* List of default buckets suitable for typical web application latency metrics
*
* @return float[]
*/
public static function getDefaultBuckets() : array
{
return [
0.005,
0.01,
0.025,
0.05,
0.075,
0.1,
0.25,
0.5,
0.75,
1.0,
2.5,
5.0,
7.5,
10.0,
];
}
/**
* @param float $value e.g. 123
* @param string[] $labelValues e.g. ['status', 'opcode']

0 comments on commit a0e204b

Please sign in to comment.
You can’t perform that action at this time.