Skip to content

Commit

Permalink
Adds summary metric type (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
butschster authored Oct 10, 2023
1 parent 15e89b2 commit 633cd8c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Collector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
1 change: 1 addition & 0 deletions src/CollectorType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ enum CollectorType: string
case Histogram = 'histogram';
case Gauge = 'gauge';
case Counter = 'counter';
case Summary = 'summary';
}
8 changes: 8 additions & 0 deletions tests/Unit/CollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 633cd8c

Please sign in to comment.