Latest Results
feat(telemetry): track per-feature usage counters on compile events (#6519)
* feat(telemetry): track per-feature usage counters on compile events
Introduce a typed FeatureName registry and `increment_feature` helper so
runtime call sites (uploads, cookies, storage, models, lifespan tasks,
shared state, dynamic routes) and the compile-time collector
(state-manager mode, CORS, background event handlers) feed a uniform
counters map into the compile event. Always emit every known key so
zeros are distinguishable from missing detectors.
* refactor(telemetry): derive feature counts from compile-time walks
Move TelemetryContext into reflex_base and drop the scattered
`increment_feature` call sites in Upload, lifespan, shared state,
storage classes, and Model. Compile-event collection now walks the
live app (states, pages, config, ModelRegistry) at compile end so the
counters reflect actual final state rather than import-time markers
that could double-count under reload or get out of sync.
* refactor(telemetry): thread Config and route helpers through feature collector
Drop the intermediate ``_ComponentWalk`` TypedDict in favor of a plain
tuple, pass the resolved ``Config`` and ``get_route_args`` into the
feature collector instead of re-resolving them, and lean on the
``_KNOWN_FEATURES`` zero-fill to drop the redundant storage-counter
seeding pass.
* fix(telemetry): avoid double-counting inherited storage fields
State classes that inherit Cookie/LocalStorage/SessionStorage fields were
re-counting the parent's fields on each descendant. Walk only the fields
declared on each class so the per-feature counters reflect distinct
storage vars across the state tree.
* Update tests/integration/test_telemetry_compile.py
Co-authored-by: Masen Furer <m_github@0x26.net>
* test(telemetry): drop leading underscores from local test classes
Rename `_TelAcct*`, `_Storage*`, `_Shared*`, `_BgState`, `_UserWalkState`,
`_StubMemoWrapper`, and `_PlainStub` to their non-underscored equivalents,
and construct `Upload`/`StyledUpload` via `create()` instead of
`object.__new__`.
* perf(telemetry): drop per-node Upload isinstance check from compile walk
The compile-event walk was paying for an ``isinstance(node, Upload)``
on every component in every page tree to derive ``upload_count``, which
profiled at ~20% of total walk overhead. ``Upload.is_used`` is already
maintained by upload call sites for the upload-endpoint mount gate;
read it directly off the class instead.
- Restore ``_count_components`` to its single-purpose, class-name-only
shape (no tuple return, no Upload special case).
- Drop the ``upload_count`` parameter from ``_collect_features_used``;
it now reads ``int(Upload.is_used)``.
- No change to ``Upload`` itself.
---------
Co-authored-by: Masen Furer <m_github@0x26.net> Latest Branches
0%
masenf/docs-ship-static-html 0%
masenf/expose-plugin-contexts 0%
masenf/router-url-frontend-path © 2026 CodSpeed Technology