GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Metrics   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 27
c 1
b 0
f 0
dl 0
loc 59
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 0 27 1
A responseTime() 0 3 1
A requests() 0 3 1
A defaultLabels() 0 3 1
A inflight() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ReactInspector\HttpMiddleware;
6
7
use WyriHaximus\Metrics\Factory;
8
use WyriHaximus\Metrics\Label;
9
use WyriHaximus\Metrics\Label\Name;
10
use WyriHaximus\Metrics\Registry;
11
use WyriHaximus\Metrics\Registry\Counters;
12
use WyriHaximus\Metrics\Registry\Gauges;
13
use WyriHaximus\Metrics\Registry\Summaries;
14
15
use function array_map;
16
17
final class Metrics
18
{
19
    /** @var array<Label> */
20
    private array $defaultLabels;
21
22
    public function __construct(private Gauges $inflight, private Counters $requests, private Summaries $responseTime, Label ...$defaultLabels)
23
    {
24
        $this->defaultLabels = $defaultLabels;
25
    }
26
27
    public static function create(Registry $registry, Label ...$defaultLabels): self
28
    {
29
        $defaultLabelNames = array_map(static fn (Label $label): Name => new Name($label->name()), $defaultLabels);
30
31
        return new self(
32
            $registry->gauge(
33
                'http_requests_inflight',
34
                'The number of HTTP requests that are currently inflight within the application',
35
                new Name('method'),
36
                ...$defaultLabelNames,
37
            ),
38
            $registry->counter(
39
                'http_requests',
40
                'The number of HTTP requests handled by HTTP request method and response status code',
41
                new Name('method'),
42
                new Name('code'),
43
                ...$defaultLabelNames,
44
            ),
45
            $registry->summary(
46
                'http_response_times',
47
                'The time it took to come to a response by HTTP request method and response status code',
48
                Factory::defaultQuantiles(),
49
                new Name('method'),
50
                new Name('code'),
51
                ...$defaultLabelNames,
52
            ),
53
            ...$defaultLabels,
54
        );
55
    }
56
57
    /** @return array<Label> */
58
    public function defaultLabels(): array
59
    {
60
        return $this->defaultLabels;
61
    }
62
63
    public function inflight(): Gauges
64
    {
65
        return $this->inflight;
66
    }
67
68
    public function requests(): Counters
69
    {
70
        return $this->requests;
71
    }
72
73
    public function responseTime(): Summaries
74
    {
75
        return $this->responseTime;
76
    }
77
}
78