Forked from
Arch Linux / aurweb
1343 commits behind the upstream repository.
-
Kevin Morris authored
Along with this initial requests metric implementation, we also now serve the `/metrics` route, which grabs request metrics out of cache and renders them properly for Prometheus. **NOTE** Metrics are only enabled when the aurweb system admin has enabled caching by configuring `options.cache` correctly in `$AUR_CONFIG`. Otherwise, an error is logged about no cache being configured. New dependencies have been added which require the use of `composer`. See `INSTALL` for the dependency section in regards to composer dependencies and how to install them properly for aurweb. Metrics are in the following forms: aurweb_http_requests_count(method="GET",route="/some_route") aurweb_api_requests_count(method="GET",route="/rpc",type="search") This should allow us to search through the requests for specific routes and queries. Signed-off-by:
Kevin Morris <kevr@0cost.org>
Kevin Morris authoredAlong with this initial requests metric implementation, we also now serve the `/metrics` route, which grabs request metrics out of cache and renders them properly for Prometheus. **NOTE** Metrics are only enabled when the aurweb system admin has enabled caching by configuring `options.cache` correctly in `$AUR_CONFIG`. Otherwise, an error is logged about no cache being configured. New dependencies have been added which require the use of `composer`. See `INSTALL` for the dependency section in regards to composer dependencies and how to install them properly for aurweb. Metrics are in the following forms: aurweb_http_requests_count(method="GET",route="/some_route") aurweb_api_requests_count(method="GET",route="/rpc",type="search") This should allow us to search through the requests for specific routes and queries. Signed-off-by:
Kevin Morris <kevr@0cost.org>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
metrics.php 481 B
<?php
/**
* Provide some variable Prometheus metrics. A new requests.route type
* gets created for each request made and we keep a count using our
* existing Memcached or APC configurable cache, with route
* = {request_uri}?{query_string}.
*
* TL;DR -- The 'requests' counter is used to give variable requests
* based on their request_uris and query_strings.
**/
include_once('metricfuncs.inc.php');
// Render metrics based on options.cache storage.
render_metrics();
?>