Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | |
3 | namespace CirrusSearch; |
4 | |
5 | /** |
6 | * Represents logging information for a single network operation made between |
7 | * php and elasticsearch. Information returned from here goes through the |
8 | * RequestLogger class and gets logged to the cirrussearch-request channel |
9 | * for later processing in analytics platforms. |
10 | */ |
11 | interface RequestLog { |
12 | /** |
13 | * Called when the network request is started |
14 | */ |
15 | public function start(); |
16 | |
17 | /** |
18 | * Called when the network request has finished |
19 | */ |
20 | public function finish(); |
21 | |
22 | /** |
23 | * @return string The type of query that was performed |
24 | */ |
25 | public function getQueryType(); |
26 | |
27 | /** |
28 | * @return string Get the raw psr-3 compliant request description |
29 | */ |
30 | public function getDescription(); |
31 | |
32 | /** |
33 | * @return string Get the request description, formatted as per psr-3 guidelines |
34 | * with self::getLogVariables() |
35 | */ |
36 | public function formatDescription(); |
37 | |
38 | /** |
39 | * @return int|null The number of ms php spend waiting for the request, |
40 | * or null if the request has not finished yet. |
41 | */ |
42 | public function getTookMs(); |
43 | |
44 | /** |
45 | * @return int The number of ms elasticsearch reported spending on the request, |
46 | * or -1 if no request was made (such as cached responses). |
47 | */ |
48 | public function getElasticTookMs(); |
49 | |
50 | /** |
51 | * @return bool Was this query answered without talking to elasticsearch? |
52 | */ |
53 | public function isCachedResponse(); |
54 | |
55 | /** |
56 | * @return array Various information about the request(s). The exact set of |
57 | * returned keys can vary, but should generally conform to what is expected |
58 | * in RequestLogger::buildRequestSetLog(). This must return a single map |
59 | * of k/v pairs regardless of the number of requests represented here. |
60 | * This is utilized primarily for error reporting purposes. |
61 | */ |
62 | public function getLogVariables(); |
63 | |
64 | /** |
65 | * @return array[] array of arrays containing various information about the |
66 | * request(s). The exact returned keys can vary, but should generally |
67 | * conform to what is expected in RequestLogger::buildRequestSetLog(). This |
68 | * must return one map per request represented by this log. This is |
69 | * primarily used for structured logging of request data to be analyzed in |
70 | * analytics platforms. |
71 | */ |
72 | public function getRequests(); |
73 | } |