Commit 56353b27 authored by Dominik Hebeler's avatar Dominik Hebeler

Merge branch '952-implement-prometheus-exporter' into 'development'

Resolve "Implement Prometheus Exporter"

Closes #952

See merge request !1562
parents 0a8c463d 50a37dec
......@@ -8,10 +8,14 @@ podDisruptionBudget:
enabled: true
minAvailable: 1
maxUnavailable:
podAnnotations:
prometheus.io/scrape: "true"
prometheus.io/path: /metrics
prometheus.io/port: "80"
ingress:
annotations:
certmanager.k8s.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/configuration-snippet: |
if ($host = "www.metager3.de") {
return 301 https://metager3.de$request_uri;
}
\ No newline at end of file
}
......@@ -6,8 +6,12 @@ hpa:
maxReplicas: 25
podDisruptionBudget:
enabled: true
minAvailable: 5
minAvailable: 4
maxUnavailable:
podAnnotations:
prometheus.io/scrape: "true"
prometheus.io/path: /metrics
prometheus.io/port: "80"
ingress:
annotations:
certmanager.k8s.io/cluster-issuer: letsencrypt-prod
......
......@@ -122,6 +122,10 @@ class MetaGerSearch extends Controller
dd($timings);
}
$registry = \Prometheus\CollectorRegistry::getDefault();
$gauge = $registry->getOrRegisterGauge('metager', 'result_gauge', 'counts total number of returned results');
$gauge->set(sizeof($metager->getResults()));
return $resultpage;
}
......@@ -183,6 +187,7 @@ class MetaGerSearch extends Controller
];
$result["nextSearchLink"] = $metager->nextSearchLink();
$newResults = 0;
foreach ($metager->getResults() as $index => $resultTmp) {
if ($resultTmp->new) {
if ($metager->getFokus() !== "bilder") {
......@@ -196,6 +201,7 @@ class MetaGerSearch extends Controller
$result['newResults'][$index] = $html;
$result["imagesearch"] = true;
}
$newResults++;
}
}
......
......@@ -50,13 +50,13 @@ prometheus:
metrics: false
livenessProbe:
path: "/"
initialDelaySeconds: 40
initialDelaySeconds: 20
timeoutSeconds: 15
scheme: "HTTP"
probeType: "httpGet"
readinessProbe:
path: "/"
initialDelaySeconds: 30
initialDelaySeconds: 15
timeoutSeconds: 15
scheme: "HTTP"
probeType: "httpGet"
......
<?php
use Jenssegers\Agent\Agent;
use Prometheus\RenderTextFormat;
/*
|--------------------------------------------------------------------------
......@@ -234,4 +235,14 @@ Route::group(
->header('Content-Type', 'text/plain');
});
});
Route::get('metrics', function() {
$registry = \Prometheus\CollectorRegistry::getDefault();
$renderer = new RenderTextFormat();
$result = $renderer->render($registry->getMetricFamilySamples());
return response($result, 200)
->header('Content-Type', RenderTextFormat::MIME_TYPE);
});
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment