summaryrefslogtreecommitdiff
path: root/src/Controllers
diff options
context:
space:
mode:
Diffstat (limited to 'src/Controllers')
-rw-r--r--src/Controllers/CreditsController.php13
-rw-r--r--src/Controllers/Metrics/Controller.php21
2 files changed, 31 insertions, 3 deletions
diff --git a/src/Controllers/CreditsController.php b/src/Controllers/CreditsController.php
index b2805b84..ade97649 100644
--- a/src/Controllers/CreditsController.php
+++ b/src/Controllers/CreditsController.php
@@ -3,6 +3,7 @@
namespace Engelsystem\Controllers;
use Engelsystem\Config\Config;
+use Engelsystem\Helpers\Version;
use Engelsystem\Http\Response;
class CreditsController extends BaseController
@@ -13,14 +14,19 @@ class CreditsController extends BaseController
/** @var Response */
protected $response;
+ /** @var Version */
+ protected $version;
+
/**
* @param Response $response
* @param Config $config
+ * @param Version $version
*/
- public function __construct(Response $response, Config $config)
+ public function __construct(Response $response, Config $config, Version $version)
{
$this->config = $config;
$this->response = $response;
+ $this->version = $version;
}
/**
@@ -30,7 +36,10 @@ class CreditsController extends BaseController
{
return $this->response->withView(
'pages/credits.twig',
- ['credits' => $this->config->get('credits')]
+ [
+ 'credits' => $this->config->get('credits'),
+ 'version' => $this->version->getVersion(),
+ ]
);
}
}
diff --git a/src/Controllers/Metrics/Controller.php b/src/Controllers/Metrics/Controller.php
index f6ea3967..ffb2a41b 100644
--- a/src/Controllers/Metrics/Controller.php
+++ b/src/Controllers/Metrics/Controller.php
@@ -4,6 +4,7 @@ namespace Engelsystem\Controllers\Metrics;
use Engelsystem\Config\Config;
use Engelsystem\Controllers\BaseController;
+use Engelsystem\Helpers\Version;
use Engelsystem\Http\Exceptions\HttpForbidden;
use Engelsystem\Http\Request;
use Engelsystem\Http\Response;
@@ -26,25 +27,31 @@ class Controller extends BaseController
/** @var Stats */
protected $stats;
+ /** @var Version */
+ protected $version;
+
/**
* @param Response $response
* @param MetricsEngine $engine
* @param Config $config
* @param Request $request
* @param Stats $stats
+ * @param Version $version
*/
public function __construct(
Response $response,
MetricsEngine $engine,
Config $config,
Request $request,
- Stats $stats
+ Stats $stats,
+ Version $version
) {
$this->config = $config;
$this->engine = $engine;
$this->request = $request;
$this->response = $response;
$this->stats = $stats;
+ $this->version = $version;
}
/**
@@ -68,6 +75,18 @@ class Controller extends BaseController
$data = [
$this->config->get('app_name') . ' stats',
+ 'info' => [
+ 'type' => 'gauge',
+ 'help' => 'About the environment',
+ [
+ 'labels' => [
+ 'os' => PHP_OS_FAMILY,
+ 'php' => implode('.', [PHP_MAJOR_VERSION, PHP_MINOR_VERSION]),
+ 'version' => $this->version->getVersion(),
+ ],
+ 'value' => 1,
+ ],
+ ],
'users' => [
'type' => 'gauge',
['labels' => ['state' => 'incoming'], 'value' => $this->stats->newUsers()],