1 | <?php |
||
17 | final class InfluxDbEventListener |
||
18 | { |
||
19 | const STORAGE_KEY_UDP = 'udp'; |
||
20 | const STORAGE_KEY_HTTP = 'http'; |
||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | private $connection; |
||
25 | /** |
||
26 | * @var bool |
||
27 | */ |
||
28 | private $isDefault; |
||
29 | /** |
||
30 | * @var Database |
||
31 | */ |
||
32 | private $httpDatabase; |
||
33 | /** |
||
34 | * @var Database |
||
35 | */ |
||
36 | private $udpDatabase; |
||
37 | /** |
||
38 | * @var array |
||
39 | */ |
||
40 | private $storage; |
||
41 | |||
42 | /** |
||
43 | * @param string $connection |
||
44 | * @param bool $isDefault |
||
45 | * @param Database $httpDatabase |
||
46 | * @param Database $udpDatabase |
||
47 | */ |
||
48 | 8 | public function __construct( |
|
60 | |||
61 | /** |
||
62 | * @param AbstractInfluxDbEvent $event |
||
63 | * |
||
64 | * @return bool |
||
65 | */ |
||
66 | 8 | public function onPointsCollected(AbstractInfluxDbEvent $event): bool |
|
84 | |||
85 | 3 | public function onProcessTerminate(): bool |
|
100 | |||
101 | /** |
||
102 | * @return bool |
||
103 | */ |
||
104 | 2 | public function onKernelTerminate(): bool |
|
108 | |||
109 | /** |
||
110 | * @return bool |
||
111 | */ |
||
112 | 1 | public function onConsoleTerminate(): bool |
|
116 | |||
117 | 8 | private function initStorage() |
|
124 | |||
125 | /** |
||
126 | * @param Point[] $points |
||
127 | * @param string $precision |
||
128 | */ |
||
129 | 2 | private function writeUdpPoints(array $points, string $precision) |
|
133 | |||
134 | /** |
||
135 | * @param Point[] $points |
||
136 | * @param string $precision |
||
137 | */ |
||
138 | 3 | private function writeHttpPoints(array $points, string $precision) |
|
142 | |||
143 | /** |
||
144 | * @param AbstractInfluxDbEvent $event |
||
145 | */ |
||
146 | 3 | private function addEventPointsToStorage(AbstractInfluxDbEvent $event) |
|
160 | |||
161 | /** |
||
162 | * @param AbstractInfluxDbEvent $event |
||
163 | * |
||
164 | * @return bool |
||
165 | */ |
||
166 | 8 | private function isConcerned(AbstractInfluxDbEvent $event): bool |
|
170 | |||
171 | /** |
||
172 | * @param AbstractInfluxDbEvent $event |
||
173 | */ |
||
174 | 7 | private function testUdpConnection(AbstractInfluxDbEvent $event) |
|
183 | |||
184 | /** |
||
185 | * @param AbstractInfluxDbEvent $event |
||
186 | */ |
||
187 | 2 | private function writeEventPoints(AbstractInfluxDbEvent $event) |
|
200 | } |
||
201 |