Conditions | 1 |
Paths | 1 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
49 | 32 | protected function transform(MetricFamilySamples $family): Collection |
|
50 | { |
||
51 | 32 | $metric = $family->metric(); |
|
52 | |||
53 | 32 | $lines = new Collection([ |
|
54 | 32 | "# HELP {$metric->key()} {$metric->description()}", |
|
55 | 32 | "# TYPE {$metric->key()} {$metric->type()}", |
|
56 | ]); |
||
57 | |||
58 | 32 | $metrics = $family |
|
59 | 32 | ->samples() |
|
60 | 32 | ->map(fn(Sample $sample) => "{$sample->name()}{$this->serialize($sample->labels())} {$sample->value()}") |
|
61 | 32 | ->values(); |
|
62 | |||
63 | 32 | return $lines->merge($metrics); |
|
64 | } |
||
66 |