feat: Add persistent storage support for Redis and APCu (v0.4.0)
All checks were successful
Create Release Package / build-release (push) Successful in 56s

- Add StorageFactory class for storage adapter selection with fallback
- Support Redis storage for shared metrics across instances
- Support APCu storage for high-performance single-server deployments
- Add Storage tab in admin settings with configuration UI
- Add connection testing for Redis and APCu adapters
- Support environment variables for Docker/containerized deployments
- Update Collector to use StorageFactory instead of hardcoded InMemory
- Add all translations (English and German)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-02 16:15:53 +01:00
parent bad977bef0
commit 898af5e9d2
11 changed files with 1693 additions and 13 deletions

View File

@@ -3,7 +3,7 @@
# This file is distributed under the GPL v2 or later.
msgid ""
msgstr ""
"Project-Id-Version: WP Prometheus 0.3.0\n"
"Project-Id-Version: WP Prometheus 0.4.0\n"
"Report-Msgid-Bugs-To: https://src.bundespruefstelle.ch/magdev/wp-prometheus/issues\n"
"POT-Creation-Date: 2026-02-02T00:00:00+00:00\n"
"PO-Revision-Date: 2026-02-02T00:00:00+00:00\n"
@@ -617,3 +617,265 @@ msgstr "WP Prometheus erfordert installierte Composer-Abhaengigkeiten. Bitte fue
#: wp-prometheus.php
msgid "WP Prometheus requires PHP version %s or higher."
msgstr "WP Prometheus erfordert PHP-Version %s oder hoeher."
#: src/Admin/Settings.php
msgid "Storage"
msgstr "Speicher"
#: src/Admin/Settings.php
msgid "Metrics Storage Configuration"
msgstr "Metriken-Speicherkonfiguration"
#: src/Admin/Settings.php
msgid "Configure how Prometheus metrics are stored. Persistent storage (Redis, APCu) allows metrics to survive between requests and aggregate data over time."
msgstr "Konfigurieren Sie, wie Prometheus-Metriken gespeichert werden. Persistenter Speicher (Redis, APCu) ermoeglicht es, Metriken zwischen Anfragen zu erhalten und Daten ueber Zeit zu aggregieren."
#: src/Admin/Settings.php
msgid "Environment Override Active"
msgstr "Umgebungsvariablen-Ueberschreibung aktiv"
#: src/Admin/Settings.php
msgid "Storage adapter is configured via environment variable. Admin settings will be ignored."
msgstr "Speicher-Adapter ist ueber Umgebungsvariable konfiguriert. Admin-Einstellungen werden ignoriert."
#: src/Admin/Settings.php
msgid "Storage Fallback Active"
msgstr "Speicher-Fallback aktiv"
#: src/Admin/Settings.php
msgid "Falling back to In-Memory storage."
msgstr "Faellt zurueck auf In-Memory-Speicher."
#: src/Admin/Settings.php
msgid "Current Status:"
msgstr "Aktueller Status:"
#. translators: %s: Active adapter name
#: src/Admin/Settings.php
msgid "Using %s storage."
msgstr "Verwende %s-Speicher."
#: src/Admin/Settings.php
msgid "Storage Adapter"
msgstr "Speicher-Adapter"
#: src/Admin/Settings.php
msgid "unavailable"
msgstr "nicht verfuegbar"
#: src/Admin/Settings.php
msgid "Select the storage backend for metrics. Redis and APCu require their respective PHP extensions."
msgstr "Waehlen Sie das Speicher-Backend fuer Metriken. Redis und APCu erfordern ihre jeweiligen PHP-Erweiterungen."
#: src/Admin/Settings.php
msgid "Redis Configuration"
msgstr "Redis-Konfiguration"
#: src/Admin/Settings.php
msgid "Host"
msgstr "Host"
#. translators: %s: Environment variable name
#: src/Admin/Settings.php
msgid "Can be overridden with %s environment variable."
msgstr "Kann mit Umgebungsvariable %s ueberschrieben werden."
#: src/Admin/Settings.php
msgid "Port"
msgstr "Port"
#: src/Admin/Settings.php
msgid "Password"
msgstr "Passwort"
#: src/Admin/Settings.php
msgid "Leave empty if not required"
msgstr "Leer lassen, falls nicht erforderlich"
#: src/Admin/Settings.php
msgid "Database"
msgstr "Datenbank"
#. translators: %s: Environment variable name
#: src/Admin/Settings.php
msgid "Redis database index (0-15). Can be overridden with %s."
msgstr "Redis-Datenbankindex (0-15). Kann mit %s ueberschrieben werden."
#: src/Admin/Settings.php
msgid "Key Prefix"
msgstr "Schluessel-Praefix"
#: src/Admin/Settings.php
msgid "Prefix for Redis keys. Useful when sharing Redis with other applications."
msgstr "Praefix fuer Redis-Schluessel. Nuetzlich bei gemeinsamer Redis-Nutzung mit anderen Anwendungen."
#: src/Admin/Settings.php
msgid "APCu Configuration"
msgstr "APCu-Konfiguration"
#. translators: %s: Environment variable name
#: src/Admin/Settings.php
msgid "Prefix for APCu keys. Can be overridden with %s."
msgstr "Praefix fuer APCu-Schluessel. Kann mit %s ueberschrieben werden."
#: src/Admin/Settings.php
msgid "Save Storage Settings"
msgstr "Speicher-Einstellungen speichern"
#: src/Admin/Settings.php
msgid "Test Connection"
msgstr "Verbindung testen"
#: src/Admin/Settings.php
msgid "Environment Variables"
msgstr "Umgebungsvariablen"
#: src/Admin/Settings.php
msgid "For Docker or containerized environments, you can configure storage using environment variables. These take precedence over admin settings."
msgstr "Fuer Docker- oder Container-Umgebungen koennen Sie den Speicher ueber Umgebungsvariablen konfigurieren. Diese haben Vorrang vor Admin-Einstellungen."
#: src/Admin/Settings.php
msgid "Variable"
msgstr "Variable"
#: src/Admin/Settings.php
msgid "Example"
msgstr "Beispiel"
#: src/Admin/Settings.php
msgid "Storage adapter to use"
msgstr "Zu verwendender Speicher-Adapter"
#: src/Admin/Settings.php
msgid "Redis server hostname"
msgstr "Redis-Server-Hostname"
#: src/Admin/Settings.php
msgid "Redis server port"
msgstr "Redis-Server-Port"
#: src/Admin/Settings.php
msgid "Redis authentication password"
msgstr "Redis-Authentifizierungspasswort"
#: src/Admin/Settings.php
msgid "Redis database index"
msgstr "Redis-Datenbankindex"
#: src/Admin/Settings.php
msgid "Redis key prefix"
msgstr "Redis-Schluessel-Praefix"
#: src/Admin/Settings.php
msgid "APCu key prefix"
msgstr "APCu-Schluessel-Praefix"
#: src/Admin/Settings.php
msgid "Docker Compose Example"
msgstr "Docker Compose-Beispiel"
#: src/Admin/Settings.php
msgid "Permission denied."
msgstr "Zugriff verweigert."
#: src/Admin/Settings.php
msgid "Storage adapter is configured via environment variable and cannot be changed."
msgstr "Speicher-Adapter ist ueber Umgebungsvariable konfiguriert und kann nicht geaendert werden."
#: src/Admin/Settings.php
msgid "Invalid storage adapter."
msgstr "Ungueltiger Speicher-Adapter."
#: src/Admin/Settings.php
msgid "Storage settings saved successfully."
msgstr "Speicher-Einstellungen erfolgreich gespeichert."
#: src/Admin/Settings.php
msgid "Storage settings saved, but connection test failed:"
msgstr "Speicher-Einstellungen gespeichert, aber Verbindungstest fehlgeschlagen:"
#: src/Metrics/StorageFactory.php
msgid "In-Memory (default, no persistence)"
msgstr "In-Memory (Standard, keine Persistenz)"
#: src/Metrics/StorageFactory.php
msgid "Redis (requires PHP Redis extension)"
msgstr "Redis (erfordert PHP-Redis-Erweiterung)"
#: src/Metrics/StorageFactory.php
msgid "APCu (requires APCu extension)"
msgstr "APCu (erfordert APCu-Erweiterung)"
#: src/Metrics/StorageFactory.php
msgid "PHP Redis extension is not installed."
msgstr "PHP-Redis-Erweiterung ist nicht installiert."
#. translators: %s: Error message
#: src/Metrics/StorageFactory.php
msgid "Redis connection failed: %s"
msgstr "Redis-Verbindung fehlgeschlagen: %s"
#. translators: %s: Error message
#: src/Metrics/StorageFactory.php
msgid "Redis error: %s"
msgstr "Redis-Fehler: %s"
#. translators: %s: Error message
#: src/Metrics/StorageFactory.php
msgid "Storage error: %s"
msgstr "Speicherfehler: %s"
#: src/Metrics/StorageFactory.php
msgid "APCu extension is not installed."
msgstr "APCu-Erweiterung ist nicht installiert."
#: src/Metrics/StorageFactory.php
msgid "APCu is installed but not enabled."
msgstr "APCu ist installiert, aber nicht aktiviert."
#. translators: %s: Error message
#: src/Metrics/StorageFactory.php
msgid "APCu error: %s"
msgstr "APCu-Fehler: %s"
#: src/Metrics/StorageFactory.php
msgid "In-Memory storage is always available."
msgstr "In-Memory-Speicher ist immer verfuegbar."
#: src/Metrics/StorageFactory.php
msgid "Unknown storage adapter."
msgstr "Unbekannter Speicher-Adapter."
#: src/Metrics/StorageFactory.php
msgid "Could not connect to Redis server."
msgstr "Verbindung zum Redis-Server konnte nicht hergestellt werden."
#: src/Metrics/StorageFactory.php
msgid "Redis authentication failed."
msgstr "Redis-Authentifizierung fehlgeschlagen."
#. translators: %s: Redis host:port
#: src/Metrics/StorageFactory.php
msgid "Successfully connected to Redis at %s."
msgstr "Erfolgreich mit Redis verbunden unter %s."
#: src/Metrics/StorageFactory.php
msgid "Redis ping failed."
msgstr "Redis-Ping fehlgeschlagen."
#: src/Metrics/StorageFactory.php
msgid "APCu is installed but not enabled. Check your php.ini settings."
msgstr "APCu ist installiert, aber nicht aktiviert. Pruefen Sie Ihre php.ini-Einstellungen."
#: src/Metrics/StorageFactory.php
msgid "APCu store operation failed."
msgstr "APCu-Speicheroperation fehlgeschlagen."
#. translators: %s: Memory info
#: src/Metrics/StorageFactory.php
msgid "APCu is working. Memory: %s used."
msgstr "APCu funktioniert. Speicher: %s belegt."
#: src/Metrics/StorageFactory.php
msgid "APCu fetch operation returned unexpected value."
msgstr "APCu-Abrufoperation hat unerwarteten Wert zurueckgegeben."