[WIP, NO MERGE]: Added Tinybird-backed stats to the automations browse endpoint by troyciesco · Pull Request #30504 · TryGhost/Ghost · GitHub
Skip to content

[WIP, NO MERGE]: Added Tinybird-backed stats to the automations browse endpoint - #30504

Draft
troyciesco wants to merge 1 commit into
NY-1559_tinybird-sync-jobfrom
NY-1560_stats-from-tinybird
Draft

[WIP, NO MERGE]: Added Tinybird-backed stats to the automations browse endpoint#30504
troyciesco wants to merge 1 commit into
NY-1559_tinybird-sync-jobfrom
NY-1560_stats-from-tinybird

Conversation

@troyciesco

Copy link
Copy Markdown
Contributor

ref https://linear.app/ghost/issue/NY-1560

Stacked on NY-1559, which syncs automation runs and steps into Tinybird. This cannot be merged until that lands.
Also note that we may want a different feature flag, so might need to break that out and do it first as well.

  • Gates the Tinybird path on the automationRunAnalytics private flag and on Tinybird being configured; otherwise browse behaves exactly as before
  • Keeps the Tinybird read in the API layer: browse asks the repository for automations without database stats and fetches the api_automation_browse_stats pipe in parallel, then merges by automation id
  • Reuses the stats service's Tinybird client and the shared service wrapper, so the JWT, site UUID, local mode, and request timeout match web analytics
  • Validates the pipe response and omits stats entirely when Tinybird is unavailable or returns an unexpected shape, which Admin already handles by hiding the columns
  • Adds an includeDatabaseStats option to the repository so the expensive MySQL aggregate is skipped when Tinybird supplies the numbers
  • Covers response parsing with unit tests and the end-to-end path with nock against the real config, wrapper, and request layer

…e endpoint

ref https://linear.app/ghost/issue/NY-1560/ghost-backend-conditionally-based-on-feature-flag-populate-stats-from

Stacked on NY-1559, which syncs automation runs and steps into Tinybird.
This cannot be merged until that lands.

- Gates the Tinybird path on the automationRunAnalytics private flag and on
  Tinybird being configured; otherwise browse behaves exactly as before
- Keeps the Tinybird read in the API layer: browse asks the repository for
  automations without database stats and fetches the
  api_automation_browse_stats pipe in parallel, then merges by automation id
- Reuses the stats service's Tinybird client and the shared service wrapper,
  so the JWT, site UUID, local mode, and request timeout match web analytics
- Validates the pipe response and omits stats entirely when Tinybird is
  unavailable or returns an unexpected shape, which Admin already handles by
  hiding the columns
- Adds an includeDatabaseStats option to the repository so the expensive
  MySQL aggregate is skipped when Tinybird supplies the numbers
- Covers response parsing with unit tests and the end-to-end path with nock
  against the real config, wrapper, and request layer
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

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.

1 participant