Update CLAUDE.md with v0.7.4 session learnings

- Removed v0.7.4 from roadmap (completed)
- Added session history for Prometheus metrics integration
- Documented new PrometheusController and metrics implementation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-03 10:57:01 +01:00
parent 73ba7fb929
commit fb4be7124b

View File

@@ -1990,3 +1990,44 @@ Added `ResponseSigner::getServerSecret()` static method that checks multiple sou
- The fix maintains backward compatibility with standard WordPress installations using constants - The fix maintains backward compatibility with standard WordPress installations using constants
- Docker environments can now use environment variables directly without needing the constant to be defined - Docker environments can now use environment variables directly without needing the constant to be defined
- All three methods (`isSigningEnabled()`, `getCustomerSecretForLicense()`, and constructor) now use the centralized `getServerSecret()` method - All three methods (`isSigningEnabled()`, `getCustomerSecretForLicense()`, and constructor) now use the centralized `getServerSecret()` method
### 2026-02-03 - Version 0.7.4 - Prometheus Metrics Integration
**Overview:**
Added Prometheus metrics integration to expose license and API metrics for monitoring. Requires the WP Prometheus plugin.
**New files:**
- `src/Metrics/PrometheusController.php` - Prometheus metrics collection controller
**Implemented:**
- New "Metrics" settings section with enable/disable toggle
- Hooks into `wp_prometheus_collect_metrics` action for metric collection
- License gauges using existing `LicenseManager::getStatistics()`:
- `wclp_licenses_total{status}` - License counts by status
- `wclp_licenses_lifetime_total` - Lifetime licenses count
- `wclp_licenses_expiring_total` - Expiring licenses count
- `wclp_licenses_expiring_soon` - Licenses expiring within 30 days
- Download gauges using existing `VersionManager::getDownloadStatistics()`:
- `wclp_downloads_total` - Total downloads
- `wclp_versions_active_total` - Active product versions
- API counters (stored in WordPress options for persistence):
- `wclp_api_requests_total{endpoint,result}` - API requests by endpoint and result
- `wclp_rate_limit_exceeded_total{endpoint}` - Rate limit exceeded events
- `wclp_validation_errors_total{error_type}` - Validation errors by type
**Modified files:**
- `src/Admin/SettingsController.php` - Added 'metrics' section with settings
- `src/Api/RestApiController.php` - Added metric tracking for API requests
- `src/Api/UpdateController.php` - Added metric tracking for update-check requests
- `src/Plugin.php` - Initialize PrometheusController
**Technical notes:**
- Metrics are only collected when enabled via settings toggle
- Static methods allow increment from API controllers without dependency injection
- Counter values persist across requests via `wclp_prometheus_counters` option
- Gauges query database on each metric collection (uses existing statistics methods)