Add Opik span instrumentation to core generation pipeline: - class-article-worker.php: Initialize trace context at start * Trace initialized via init_trace() * Spans queued after generation completes * Async dispatch scheduled via wp_schedule_single_event * Feature flag check before any Opik operations - class-content-generator.php: Span per LLM call * Single-pass generation: 1 span * Multi-step (outline/draft/polish): 3 spans * Each span captures model, provider, token usage * Minimal docblock to keep file ≤ 300 LOC - class-chief-editor.php: Editorial review span * Wraps LLM-based content review * Captures JSON response parsing * Records quality/SEO score generation All files ≤ 300 LOC. Spans capture usage data but not full prompts (per security policy). Feature-flag default OFF. Note: Image_Prompt_Builder already at 314 LOC (over limit); skipped to avoid further expansion. Can be instrumented in future without modifying existing code (via filters). Part of Wave 1 integration. Target: v0.12.0
5.6 KiB
Executable File
5.6 KiB
Executable File