New. Code. Integrations performance base metrics. - #875
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev #875 +/- ##
============================================
+ Coverage 30.00% 30.26% +0.25%
- Complexity 6539 6590 +51
============================================
Files 289 292 +3
Lines 26259 26396 +137
============================================
+ Hits 7880 7989 +109
- Misses 18379 18407 +28 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
There are runtime-breaking issues (trait property collisions causing fatal errors, and lease()/dumpVarsSize() behaviors that can throw or mutate released DTOs) that must be fixed before merge.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR introduces an “integration metrics” telemetry layer to capture per-integration performance baselines and spans (time + memory), and attaches the resulting metrics payload into sender_info for downstream processing/analytics.
Changes:
- Added
IntegrationMetricsDTO (IMetricDTO), trait (IMetricDTOTrait), and service (IMetricService) for creating/finalizing metrics and recording spans/custom fields. - Wired metrics initialization/finalization into
IntegrationsandIntegrationsByClass, and added span/custom-field instrumentation in WooCommerce and NinjaForms. - Added PHPUnit coverage for the DTO, trait behavior, and service lifecycle.
File summaries
| File | Description |
|---|---|
| tests/Antispam/IntegrationMetrics/IMetricServiceTest.php | Adds unit tests for span lifecycle, finalization, and variable size tracking. |
| tests/Antispam/IntegrationMetrics/IMetricDTOTraitTest.php | Tests trait storage semantics and DTO version override behavior. |
| tests/Antispam/IntegrationMetrics/IMetricDTOTest.php | Tests DTO defaults and serialization filtering. |
| lib/Cleantalk/Antispam/IntegrationsByClass/Woocommerce.php | Instruments WooCommerce flows to create spans and attach finalized metrics into sender_info. |
| lib/Cleantalk/Antispam/IntegrationsByClass/IntegrationByClassBase.php | Enables metrics storage on all “by-class” integrations via the DTO trait. |
| lib/Cleantalk/Antispam/IntegrationsByClass.php | Initializes metrics DTOs for by-class integrations during construction. |
| lib/Cleantalk/Antispam/Integrations/NinjaForms.php | Adds custom fields, span timing, and variable-size profiling to NinjaForms integration. |
| lib/Cleantalk/Antispam/Integrations/IntegrationBase.php | Enables metrics storage on all “classic” integrations via the DTO trait. |
| lib/Cleantalk/Antispam/Integrations.php | Initializes metrics, wraps key stages in spans, and embeds finalized metrics into sender_info. |
| lib/Cleantalk/Antispam/IntegrationMetrics/IMetricService.php | Implements the metrics API (DTO creation, seek/lease spans, finalize, custom fields, var-size tracking). |
| lib/Cleantalk/Antispam/IntegrationMetrics/IMetricDTOTrait.php | Provides per-integration DTO storage and optional schema version override. |
| lib/Cleantalk/Antispam/IntegrationMetrics/IMetricDTO.php | Defines the metrics payload structure and JSON/array serialization behavior. |
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 6
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
6d5c6cc to
c867c68
Compare
https://app.doboard.com/1/task/42423