You've already forked wp-prometheus
feat: Add runtime metrics for HTTP requests and database queries (v0.1.0)
All checks were successful
Create Release Package / build-release (push) Successful in 59s
All checks were successful
Create Release Package / build-release (push) Successful in 59s
- Add RuntimeCollector class for tracking request lifecycle metrics - Add wordpress_http_requests_total counter (method, status, endpoint) - Add wordpress_http_request_duration_seconds histogram - Add wordpress_db_queries_total counter (endpoint) - Add wordpress_db_query_duration_seconds histogram (requires SAVEQUERIES) - Update Collector to expose stored runtime metrics - Add new settings options for enabling/disabling runtime metrics - Create translation files (.pot, .po, .mo) for internationalization - Update documentation and changelog Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
31
CLAUDE.md
31
CLAUDE.md
@@ -14,6 +14,7 @@ This plugin provides a Prometheus `/metrics` endpoint and an extensible way to a
|
||||
|
||||
- Prometheus compatible authenticated `/metrics` endpoint
|
||||
- Optional default metrics (users, posts, comments, plugins)
|
||||
- Runtime metrics (HTTP requests, request duration, database queries)
|
||||
- Dedicated plugin settings under 'Settings/Metrics' menu
|
||||
- Extensible by other plugins using `wp_prometheus_collect_metrics` action hook
|
||||
- License management integration
|
||||
@@ -26,11 +27,11 @@ This project is proudly **"vibe-coded"** using Claude.AI - the entire codebase w
|
||||
|
||||
**Note for AI Assistants:** Clean this section after the specific features are done or new releases are made. Effective changes are tracked in `CHANGELOG.md`. Do not add completed versions here - document them in the Session History section at the end of this file.
|
||||
|
||||
### Version 0.1.0 (Planned)
|
||||
### Version 0.2.0 (Planned)
|
||||
|
||||
- Add request/response timing metrics
|
||||
- Add HTTP status code counters
|
||||
- Add database query metrics
|
||||
- WooCommerce integration metrics
|
||||
- Cron job metrics
|
||||
- Transient cache metrics
|
||||
|
||||
## Technical Stack
|
||||
|
||||
@@ -224,7 +225,8 @@ wp-prometheus/
|
||||
│ ├── License/
|
||||
│ │ └── Manager.php # License management
|
||||
│ ├── Metrics/
|
||||
│ │ └── Collector.php # Prometheus metrics collector
|
||||
│ │ ├── Collector.php # Prometheus metrics collector
|
||||
│ │ └── RuntimeCollector.php # Runtime metrics collector
|
||||
│ ├── Installer.php # Activation/Deactivation
|
||||
│ ├── Plugin.php # Main plugin class
|
||||
│ └── index.php
|
||||
@@ -280,6 +282,25 @@ add_action( 'wp_prometheus_collect_metrics', function( $collector ) {
|
||||
|
||||
## Session History
|
||||
|
||||
### 2026-02-02 - Runtime Metrics (v0.1.0)
|
||||
|
||||
- Implemented runtime metrics collection for HTTP requests and database queries
|
||||
- Created `RuntimeCollector` class that hooks into WordPress request lifecycle
|
||||
- Added new metrics:
|
||||
- `wordpress_http_requests_total` - Counter by method, status, endpoint
|
||||
- `wordpress_http_request_duration_seconds` - Histogram of request durations
|
||||
- `wordpress_db_queries_total` - Counter by endpoint
|
||||
- `wordpress_db_query_duration_seconds` - Histogram (requires SAVEQUERIES)
|
||||
- Updated `Collector` class to expose stored runtime metrics
|
||||
- Added new settings options in admin for enabling/disabling runtime metrics
|
||||
- Created translation files (.pot, .po, .mo) for internationalization
|
||||
- **Key Learning**: With InMemory Prometheus storage, counters/histograms reset per request
|
||||
- Solution: Store aggregated data in WordPress options, read during metrics collection
|
||||
- Histograms exposed as gauge metrics following Prometheus naming conventions (`_bucket`, `_sum`, `_count`)
|
||||
- **Key Learning**: Endpoint normalization is important for cardinality control
|
||||
- Group requests into categories (admin, ajax, cron, rest-api, frontend, etc.)
|
||||
- Avoid high-cardinality labels like full URL paths
|
||||
|
||||
### 2026-02-01 - CI/CD Fixes (v0.0.2)
|
||||
|
||||
- Fixed composer.json dependency configuration for CI compatibility
|
||||
|
||||
Reference in New Issue
Block a user