You've already forked wp-prometheus
docs: Update CLAUDE.md with v0.4.1 session history
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
26
CLAUDE.md
26
CLAUDE.md
@@ -291,6 +291,32 @@ add_action( 'wp_prometheus_collect_metrics', function( $collector ) {
|
|||||||
|
|
||||||
## Session History
|
## Session History
|
||||||
|
|
||||||
|
### 2026-02-02 - Plugin Compatibility Fix (v0.4.1)
|
||||||
|
|
||||||
|
- Fixed memory exhaustion (1GB limit) when wp-fedistream (Twig-based) plugin is active
|
||||||
|
- Root cause: Infinite recursion through WordPress hook system when content filters trigger Twig rendering
|
||||||
|
- Solution: Early metrics endpoint interception before full WordPress initialization
|
||||||
|
- Implementation changes:
|
||||||
|
- Added `wp_prometheus_early_metrics_check()` in bootstrap file (wp-prometheus.php)
|
||||||
|
- Checks REQUEST_URI for `/metrics` pattern before `plugins_loaded` fires
|
||||||
|
- Defines `WP_PROMETHEUS_EARLY_METRICS` constant to signal early mode
|
||||||
|
- Removes content filters (`the_content`, `the_excerpt`, `get_the_excerpt`, `the_title`)
|
||||||
|
- Collector skips `wp_prometheus_collect_metrics` action in early mode
|
||||||
|
- Changed MetricsEndpoint from `template_redirect` to `parse_request` hook
|
||||||
|
- **Key Learning**: WordPress plugin loading order and hook timing
|
||||||
|
- Plugins load alphabetically, so wp-fedistream ('f') loads before wp-prometheus ('p')
|
||||||
|
- `template_redirect` fires too late - after themes and Twig initialize
|
||||||
|
- `parse_request` fires earlier but still after plugin files load
|
||||||
|
- Earliest interception point: top-level code in plugin bootstrap file
|
||||||
|
- **Key Learning**: Content filter recursion in WordPress
|
||||||
|
- `get_the_excerpt()` internally triggers `apply_filters('the_content', ...)`
|
||||||
|
- This creates unexpected recursion vectors when Twig templates process content
|
||||||
|
- Solution: Remove all content-related filters before metrics collection
|
||||||
|
- **Key Learning**: Isolating metrics collection from WordPress template system
|
||||||
|
- Use `remove_all_filters()` to clear problematic filter chains
|
||||||
|
- Skip extensibility hooks (`do_action`) when in isolated early mode
|
||||||
|
- Exit immediately after output to prevent further WordPress processing
|
||||||
|
|
||||||
### 2026-02-02 - Persistent Storage (v0.4.0)
|
### 2026-02-02 - Persistent Storage (v0.4.0)
|
||||||
|
|
||||||
- Added persistent storage support for metrics:
|
- Added persistent storage support for metrics:
|
||||||
|
|||||||
Reference in New Issue
Block a user