mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Revert "feat(PHP): add aurweb Prometheus metrics"
This reverts commit 986fa9ee30
.
This commit is contained in:
parent
5bfc1e9094
commit
040bb0d7f4
5 changed files with 2 additions and 183 deletions
|
@ -3,39 +3,10 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
|
|||
|
||||
include_once("aur.inc.php");
|
||||
include_once("pkgfuncs.inc.php");
|
||||
include_once("cachefuncs.inc.php");
|
||||
include_once("metricfuncs.inc.php");
|
||||
|
||||
$path = $_SERVER['PATH_INFO'];
|
||||
$tokens = explode('/', $path);
|
||||
|
||||
$query_string = $_SERVER['QUERY_STRING'];
|
||||
|
||||
// If no options.cache is configured, we no-op metric storage operations.
|
||||
$is_cached = defined('EXTENSION_LOADED_APC') || defined('EXTENSION_LOADED_MEMCACHE');
|
||||
if ($is_cached) {
|
||||
$method = $_SERVER['REQUEST_METHOD'];
|
||||
// We'll always add +1 to our total request count to this $path,
|
||||
// unless this path == /metrics.
|
||||
if ($path !== "/metrics")
|
||||
add_metric("http_requests_count", $method, $path);
|
||||
|
||||
// Extract $type out of $query_string, if we can.
|
||||
$type = null;
|
||||
$query = array();
|
||||
if ($query_string)
|
||||
parse_str($query_string, $query);
|
||||
$type = $query['type'];
|
||||
|
||||
// Only store RPC metrics for valid types.
|
||||
$good_types = [
|
||||
"info", "multiinfo", "search", "msearch",
|
||||
"suggest", "suggest-pkgbase", "get-comment-form"
|
||||
];
|
||||
if ($path === "/rpc" && in_array($type, $good_types))
|
||||
add_metric("api_requests_count", $method, $path, $type);
|
||||
}
|
||||
|
||||
if (config_get_bool('options', 'enable-maintenance') && (empty($tokens[1]) || ($tokens[1] != "css" && $tokens[1] != "images"))) {
|
||||
if (!in_array($_SERVER['REMOTE_ADDR'], explode(" ", config_get('options', 'maintenance-exceptions')))) {
|
||||
header("HTTP/1.0 503 Service Unavailable");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue