diff --git a/src/Collector.php b/src/Collector.php index 676bfd1..e99cfe5 100644 --- a/src/Collector.php +++ b/src/Collector.php @@ -107,4 +107,12 @@ public static function counter(): self { return new self(CollectorType::Counter); } + + /** + * New summary metric. + */ + public static function summary(): self + { + return new self(CollectorType::Summary); + } } diff --git a/src/CollectorType.php b/src/CollectorType.php index 21f5ba0..71de029 100644 --- a/src/CollectorType.php +++ b/src/CollectorType.php @@ -9,4 +9,5 @@ enum CollectorType: string case Histogram = 'histogram'; case Gauge = 'gauge'; case Counter = 'counter'; + case Summary = 'summary'; } diff --git a/tests/Unit/CollectorTest.php b/tests/Unit/CollectorTest.php index dfc4a58..3c6e0f0 100644 --- a/tests/Unit/CollectorTest.php +++ b/tests/Unit/CollectorTest.php @@ -74,6 +74,14 @@ public function testCounter(): void $this->assertSame([], $collector->toArray()['buckets']); } + public function testSummary(): void + { + $collector = Collector::summary(); + + $this->assertSame(CollectorType::Summary, $collector->type); + $this->assertSame([], $collector->toArray()['buckets']); + } + public function testWithNamespace(): void { $collector = Collector::counter();