Skip to content

New. Code. Integrations performance base metrics. - #875

Open
alexandergull wants to merge 14 commits into
devfrom
integration-metrics.ag
Open

New. Code. Integrations performance base metrics.#875
alexandergull wants to merge 14 commits into
devfrom
integration-metrics.ag

Conversation

@alexandergull

Copy link
Copy Markdown
Member

@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.08333% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 30.26%. Comparing base (48d67e1) to head (d84bf9f).
⚠️ Report is 9 commits behind head on dev.

Files with missing lines Patch % Lines
...ntalk/Antispam/IntegrationsByClass/Woocommerce.php 0.00% 22 Missing ⚠️
lib/Cleantalk/Antispam/Integrations.php 70.00% 3 Missing ⚠️
lib/Cleantalk/Antispam/Integrations/NinjaForms.php 80.00% 3 Missing ⚠️
lib/Cleantalk/Antispam/IntegrationsByClass.php 0.00% 3 Missing ⚠️
...alk/Antispam/IntegrationMetrics/IMetricService.php 97.56% 2 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 IntegrationMetrics DTO (IMetricDTO), trait (IMetricDTOTrait), and service (IMetricService) for creating/finalizing metrics and recording spans/custom fields.
  • Wired metrics initialization/finalization into Integrations and IntegrationsByClass, 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.

Comment thread lib/Cleantalk/Antispam/IntegrationMetrics/IMetricService.php
Comment thread lib/Cleantalk/Antispam/IntegrationMetrics/IMetricService.php Outdated
Comment thread lib/Cleantalk/Antispam/IntegrationMetrics/IMetricService.php Outdated
Comment thread lib/Cleantalk/Antispam/Integrations/NinjaForms.php
Comment thread lib/Cleantalk/Antispam/IntegrationsByClass.php Outdated
Comment thread lib/Cleantalk/Antispam/IntegrationsByClass/Woocommerce.php
alexandergull and others added 6 commits September 2, 2026 11:26
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants