Skip to content

[Telemetry] Report Data Importer setup as usage.data_importer - #689

Merged
martineiber merged 3 commits into
2026.xfrom
telemetry/usage-data_importer
Sep 8, 2026
Merged

[Telemetry] Report Data Importer setup as usage.data_importer#689
martineiber merged 3 commits into
2026.xfrom
telemetry/usage-data_importer

Conversation

@martineiber

@martineiber martineiber commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

What

Adds the usage.data_importer provider for Pimcore product telemetry: a boolean answering "is the Data Importer set up" (L3 – configured), emitted once a day inside the maintenance snapshot.

Set up means at least one import configuration is active. Active rather than merely existing: a disabled import is one somebody built and then switched off, which is the opposite of adoption. Whether an import has actually run is the exercised (L4) fact, lives in the last-execution table, and is deliberately not what this key reports, so the usage.* namespace stays comparable bundle to bundle.

How

Import configurations are Data Hub configurations of this bundle's adapter type (dataImporterDataObject). So the question is put to Data Hub's shared, memoised DataHubConfigurationUsage — the same instance the four Data Hub satellites already use (pimcore/data-hub#1138) — via hasActiveOfType().

That is a deliberate choice over a table probe:

  • Zero additional reads. Data Hub already loads the configuration list once per snapshot for usage.data_hub and datahub.*; this key is answered from that same pass.
  • Location-aware for free. pimcore_data_hub.config_location.data_hub selects between the settings store and Symfony config files under var/config/data_hub/. A probe against plugin_datahub_config would report "no configurations" for every customer on the file target — inventing an adoption gap rather than measuring one. Going through the configuration API gets both locations right.

Layout:

  • DataImporterUsageProvider — the BundleUsageProviderInterface implementation; null (unknown, key omitted) when the store could not be read, never false.
  • ImportConfigurationsInterface + DataHubImportConfigurations — the seam to Data Hub's read, holding the one adapter-type constant.
  • telemetry.yaml, loaded from the extension. Data Hub is a hard dependency of this bundle, so the wiring is unconditional.

Content-never: one boolean leaves the install. Configuration names are never emitted.

Verification

  • Tests in the unit suite, where the bundle's Codeception run finds them:
    • DataImporterUsageProviderTest (4) — an active import is used; none active is false, not unknown; an unreadable store is passed through as null; and the key. Mocks the seam.
    • DataHubImportConfigurationsTest (2, one DB-backed) — the adapter exercised against the real Data Hub read: an import configuration is seeded exactly as Data Hub's Dao stores it (settings-store scope pimcore_data_hub), read back through Configuration::getList(), and the adapter's answer checked. The seed carries the type this bundle registers under pimcore_data_hub.supported_types, read from that registration, and is the only active configuration in the store — so the adapter reads true only if it asks Data Hub for exactly that type. A typo or drift in dataImporterDataObject fails this test while the mocked provider tests would still pass. The second test pins the registration itself to that identifier. One store-backed case deliberately: Data Hub's Dao memoises the configuration list for the process and offers no reset, so a second listing would still see the first one's store; whether an inactive or another adapter's configuration counts is DataHubConfigurationUsage::hasActiveOfType()'s decision, not this bundle's.
  • Live: usage.data_importer reads true on the demo install, and the provider resolves and is tagged in the container. The round trip was also run against the demo's booted kernel: a seeded active import is read back with the right type and turns the adapter true, and is gone after cleanup.
  • PHPStan level 6 clean on src/Telemetry. php-cs-fixer not run locally; CI validates it.

Requires

Both are the same bumps the four Data Hub satellite bundles already carry on their 2026.x.

Refs pimcore/product-management#1414

🤖 Generated with Claude Code

Reports whether the Data Importer is set up, as an L3 "configured"
boolean in the usage.* telemetry namespace: at least one import
configuration is active. Active rather than merely existing - a disabled
import is one somebody built and then switched off. Whether an import
has run is the exercised fact and deliberately not what this key
reports, so the namespace stays comparable bundle to bundle.

Import configurations are Data Hub configurations of this bundle's
adapter type, so the question is put to Data Hub's shared, memoised
DataHubConfigurationUsage - the same read the Data Hub satellites use.
That costs no additional statement and is location-aware: a probe
against plugin_datahub_config would report "no configurations" for
every customer whose Data Hub config lives in Symfony config files.

An unreadable store yields null (unknown), never false.

Requires the usage.* extension point on pimcore/pimcore 2026.x and
DataHubConfigurationUsage on pimcore/data-hub 2026.x, neither tagged
yet - hence both constraints move to ^2026.3, as the Data Hub satellite
bundles already did.

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 4, 2026 07:35
@martineiber martineiber added this to the 2026.3.0 milestone Sep 4, 2026

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

The production adapter mapping that determines the reported usage state lacks regression coverage.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds daily usage.data_importer telemetry based on active Data Hub importer configurations.

Changes:

  • Adds the telemetry provider and Data Hub adapter.
  • Registers services and raises required Pimcore/Data Hub versions.
  • Adds provider-level unit tests.

Review contract:

  • The Data Hub abstraction addresses configuration-location handling at the correct service boundary (DataHubImportConfigurations.php:38-40).
  • The change is additive and introduces no public API break.
  • Provider behavior is tested, but the adapter mapping itself remains untested (DataImporterUsageProviderTest.php:54-59).
  • No documentation change appears necessary for this internal telemetry signal.
  • Remaining risk: adapter-type drift could silently produce incorrect telemetry.
File summaries
File Description
composer.json Requires telemetry-capable dependency versions.
src/DependencyInjection/PimcoreDataImporterExtension.php Loads telemetry services.
src/Resources/config/telemetry.yaml Registers and wires provider services.
src/Telemetry/DataHubImportConfigurations.php Queries active importer configurations.
src/Telemetry/DataImporterUsageProvider.php Exposes the usage key and state.
src/Telemetry/ImportConfigurationsInterface.php Defines the configuration-query seam.
tests/unit/Telemetry/DataImporterUsageProviderTest.php Tests provider delegation and tri-state behavior.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Telemetry/DataHubImportConfigurations.php
Review follow-up on #689: the provider tests mock the seam, so nothing
exercised DataHubImportConfigurations or checked that the type it names
is the one Data Hub stores import configurations under.

DataHubImportConfigurationsTest seeds a configuration exactly as Data
Hub's Dao stores it (settings-store scope pimcore_data_hub), reads it
back through Configuration::getList() and checks the adapter: an active
import is used, an inactive one is false rather than unknown, another
adapter's active configuration is not an import, and the seeded type is
the one this bundle registers under pimcore_data_hub.supported_types.

Data Hub's Dao memoises the list in a private static for the lifetime
of the process; the test resets it between cases. Seeded entries carry
unique names and are removed in _after().

Co-Authored-By: Claude <noreply@anthropic.com>

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.

🟢 Approval recommended

The implementation matches the telemetry contract and includes focused coverage across its key behaviors.

Review details
  • Files reviewed: 8/8 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

SonarCloud flagged the ReflectionProperty write that cleared Data Hub's
private static configuration-list memo between cases.

Data Hub's Dao memoises the list for the lifetime of the process and
offers no reset, so the test now keeps exactly one store-backed case,
which runs against the first non-empty listing: an active import
configuration seeded with the type this bundle registers under
pimcore_data_hub.supported_types - read from that registration - as
the only active configuration in the store. The adapter therefore
reads true only if it asks Data Hub for exactly that type, which is
the drift the review asked to pin.

Whether an inactive configuration or another adapter's configuration
counts is DataHubConfigurationUsage::hasActiveOfType()'s decision and
is no longer re-tested from this bundle. A second, store-free test pins
the registration itself to the identifier Data Hub knows this bundle by.

Co-Authored-By: Claude <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Sep 4, 2026

Copy link
Copy Markdown

@martineiber martineiber self-assigned this Sep 8, 2026
@martineiber
martineiber merged commit 441df9e into 2026.x Sep 8, 2026
22 of 23 checks passed
@martineiber
martineiber deleted the telemetry/usage-data_importer branch September 8, 2026 14:06
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants