Lines 100.00% 2 / 2
Functions and Methods 100.00% 2 / 2
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
RuntimeMetricsExporter 100.00% 2 / 2 100.00% 2 / 2 2 100.00% 1 / 1
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 exportMetrics 100.00% 1 / 1 100.00% 1 / 1 1
1<?php
2
3declare(strict_types=1);
4
5namespace Stewart\Runtime\Metrics;
6
7use Stewart\Runtime\Control\SnapshotSource;
8
9final readonly class RuntimeMetricsExporter
10{
11    public function __construct(
12        private SnapshotSource $snapshots,
13        private RuntimeMetricsCollector $collector,
14        private PrometheusTextEncoder $encoder,
15    ) {}
16
17    public function exportMetrics(): string
18    {
19        return $this->encoder->encodeFamilies($this->collector->collectMetrics($this->snapshots->takeSnapshot()));
20    }
21}