| Conditions | 1 |
| Paths | 1 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | public function metrics() |
||
| 23 | { |
||
| 24 | $response = $this->app->response(); |
||
| 25 | |||
| 26 | $stats = $this->searcher->stats(); |
||
| 27 | |||
| 28 | $body = "# HELP xhgui_profiles_total Number of profiles collected.\n"; |
||
| 29 | $body .= "# TYPE xhgui_profiles_total gauge\n"; |
||
| 30 | $body .= sprintf("xhgui_profiles_total %0.1F\n\n", $stats['profiles']); |
||
| 31 | |||
| 32 | $body .= "# HELP xhgui_profile_bytes_total Size of profiles collected.\n"; |
||
| 33 | $body .= "# TYPE xhgui_profile_bytes_total gauge\n"; |
||
| 34 | $body .= sprintf("xhgui_profile_bytes_total %0.1F\n\n", $stats['bytes']); |
||
| 35 | |||
| 36 | $body .= "# HELP xhgui_latest_profile_seconds UNIX timestamp of most recent profile.\n"; |
||
| 37 | $body .= "# TYPE xhgui_latest_profile_seconds gauge\n"; |
||
| 38 | $body .= sprintf("xhgui_latest_profile_seconds %0.1F\n", $stats['latest']); |
||
| 39 | |||
| 40 | $response->body($body); |
||
| 41 | $response['Content-Type'] = 'text/plain; version=0.0.4'; |
||
| 42 | } |
||
| 43 | } |
||
| 44 |