Implement metrics from adguard-exporter (#303)

* implement metrics
This commit is contained in:
Marc Brugger
2024-03-12 19:48:29 +01:00
committed by GitHub
parent 5a3f2004bc
commit d6d8d2148d
22 changed files with 612 additions and 60 deletions

11
testdata/e2e/bin/show-sync-metrics.sh vendored Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
set -e
echo "wait another scrape interval (30s)"
sleep 30
echo "## Pod adguardhome-sync metrics" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
curl http://localhost:9090/metrics -s >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY

View File

@@ -1,8 +1,14 @@
#!/bin/bash
kubectl wait --for=jsonpath='{.status.phase}'=Succeeded pod/adguardhome-sync --timeout=1m
RESULT=$?
if [[ "${RESULT}" != "0" ]]; then
kubectl logs adguardhome-sync
fi
exit ${RESULT}
kubectl wait --for=jsonpath='{.status.phase}'=Running pod/adguardhome-sync --timeout=1m
kubectl port-forward pod/adguardhome-sync 9090:9090 &
for i in {1..6}; do
sleep 10
RUNNING=$(curl http://localhost:9090/api/v1/status -s | jq -r .syncRunning)
echo "SyncRunning = ${RUNNING}"
if [[ "${RUNNING}" == "false" ]]; then
exit 0
fi
done

View File

@@ -5,8 +5,10 @@ metadata:
name: sync-conf
namespace: {{ .Release.Namespace }}
data:
API_PORT: '0'
LOG_FORMAT: json
API_PORT: '9090'
API_METRICS_ENABLED: 'true'
API_METRICS_SCRAPE_INTERVAL: '30s'
LOG_FORMAT: 'json'
ORIGIN_URL: 'http://service-origin.{{ $.Release.Namespace }}.svc.cluster.local:3000'
ORIGIN_PASSWORD: 'password'
ORIGIN_USERNAME: 'username'

View File

@@ -11,7 +11,10 @@ data:
username: username
password: password
api:
port: 0
port: 9090
metrics:
enabled: true
scrapeInterval: 30s
replicas:
{{- range $i,$version := .Values.replica.versions }}
- url: 'http://service-replica-{{ $version | toString | replace "." "-" }}.{{ $.Release.Namespace }}.svc.cluster.local:3000'