feat(admin): métriques d'utilisation (dérivé DB + AnalyticsEvent) #13
Closed
kyuno
wants to merge 1 commit from
feat/admin-metrics into feat/admin-web-scaffold
pull from: feat/admin-metrics
merge into: kyuno:feat/admin-web-scaffold
kyuno:main
kyuno:feat/release-push-docker-images
kyuno:feat/admin-user-accounts
kyuno:fix/forgejo-env-passthrough
kyuno:chore/release-0.2.3
kyuno:feat/login-password-toggle
kyuno:feat/common-source-search
kyuno:feat/onboarding-wizard-order
kyuno:feat/missing-tech-steps
kyuno:feat/auto-recipe-diets
kyuno:feat/seasoning-ingredients
kyuno:feat/recipe-form-sticky-actions
kyuno:chore/release-0.2.2
kyuno:fix/manger-bouger-empty-filter
kyuno:feat/forgejo-issue-from-contact-message
kyuno:feat/admin-contact-messages
kyuno:feat/contact-message-model-and-form
kyuno:fix/android-values-night-xml-comment
kyuno:feat/shopping-list-check-items
kyuno:fix/android-status-bar-dark-mode
kyuno:fix/hide-app-settings-tab-on-web
kyuno:fix/mobile-bottom-nav-icons-only
kyuno:fix/landing-hide-open-app-in-native
kyuno:fix/client-force-logout-on-401
kyuno:fix/mobile-update-check-on-open
kyuno:fix/layout-spec-freeze-clock
kyuno:fix/planning-grid-fluid-height
kyuno:fix/recipe-picker-dialog-mobile-empty
kyuno:chore/version-0.2.1
kyuno:feat/mobile-planning-view
kyuno:feat/mobile-landing-download
kyuno:feat/mobile-app-settings
kyuno:feat/mobile-shopping-recipes
kyuno:feat/mobile-cooking-session
kyuno:feat/mobile-cypress-viewports
kyuno:feat/mobile-popovers-safe
kyuno:feat/mobile-app-redirect
kyuno:fix/ci-test-job-serialization
kyuno:feat/mobile-ui-shell
kyuno:fix/cors-origin-capacitor-app
kyuno:fix/logout-redirect-landing
kyuno:feat/mobile-download-proxy
kyuno:fix/forgejo-latest-release-url
kyuno:fix/forgejo-release-curl-install
kyuno:fix/forgejo-release-native-api
kyuno:fix/sanity-build-docker
kyuno:fix/release-yml-forgejo
kyuno:fix/upload-artifact-ghes-compat
kyuno:feat/landing-apk-download
kyuno:fix/gradlew-executable-bit
kyuno:feat/mobile-ci-android-apk
kyuno:feat/mobile-update-check
kyuno:claude/magical-stonebraker-5dc636
kyuno:feat/capacitor-android-native
kyuno:claude/practical-swartz-648594
kyuno:feat/admin-tour-page
kyuno:feat/tour-engine
kyuno:feat/admin-tour-crud
kyuno:feat/tour-scenarios-backend
kyuno:feat/landing-page
kyuno:feat/capacitor-android-shell
kyuno:feat/mobile-responsive-pass
kyuno:feat/mobile-bearer-auth
kyuno:feat/ohmonbento-recipe-source
kyuno:feat/quitoque-recipe-source
kyuno:feat/leftovers-drag-drop
kyuno:feat/leftovers-basket
kyuno:feat/leftovers-assign-discard
kyuno:feat/leftovers-portions-foundations
kyuno:fix/correction-popover-span-selection
kyuno:fix/source-scroll-loop
kyuno:feat/admin-monitoring-websocket
kyuno:fix/admin-monitoring-spa-route-collision
kyuno:fix/step-counter-scoped-to-direct-children
kyuno:fix/admin-monitoring-intercept
kyuno:feat/tech-step-temperature-correction
kyuno:feat/tech-step-metadata-editor-redesign
kyuno:feat/cooking-recipes-inline-detail
kyuno:feat/cooking-stepper-recipe-groups
kyuno:fix/recipe-tech-step-metadata-on-update
kyuno:perf/nlp-textcat-width
kyuno:feat/cooking-session-stepper
kyuno:feat/cooking-optimizer-metadata
kyuno:feat/temperature-metadata
kyuno:ci/postgres-as-background-container
kyuno:feat/merge-admin-into-web
kyuno:docs/environment-variables
kyuno:fix/mocha-db-suites-first-run
kyuno:feat/admin-tech-steps
kyuno:feat/off-catalog-ingredients
kyuno:feat/cooking-session-ui
kyuno:feat/admin-monitoring
kyuno:feat/admin-web-scaffold
kyuno:feat/admin-auth
kyuno:feat/cooking-session-api
kyuno:feat/cooking-optimizer-engine
kyuno:feat/tech-step-correction-merged-editor
kyuno:fix/tech-step-correction-metadata-discoverability
kyuno:feat/tech-step-correction-metadata
kyuno:feat/tech-step-metadata
kyuno:feat/tech-step-intent-service
kyuno:feat/shopping-list
kyuno:feat/fr-ingredient-unit-matching
kyuno:feat/sources-infinite-scroll
kyuno:fix/750g-browse-empty-query
kyuno:feat/marmiton-recipe-source
kyuno:feat/tech-step-detection-reliability
kyuno:experiment/llm-tech-step-poc
kyuno:feat/nlp-tech-step-detection
kyuno:chore/biome-style-rules
kyuno:feat/unify-source-detail-view
kyuno:fix/isolate-test-database
kyuno:fix/json-ld-not-a-browsable-source
kyuno:feat/browse-sources-backend
kyuno:feat/browse-sources-ui
kyuno:feat/import-recipe-review
kyuno:feat/plan-import-flow
kyuno:feat/highlight-tech-steps
kyuno:fix/runtime-seed-source-sync
kyuno:feat/english-matching
kyuno:feat/jsonld-source-adapter
kyuno:feat/recipe-step-translation
kyuno:feat/themealdb-source-icon
kyuno:feat/house-source-preferences
kyuno:feat/tech-steps-catalog
kyuno:feat/recipe-source-adapter
kyuno:feat/recipe-source-linking
kyuno:feat/ingredient-unit-catalog
kyuno:feat/ingredient-reproducible-flag
kyuno:refactor/catalog-camel-case-uids
kyuno:experiment/cucumber-cypress
kyuno:feat/recipe-catalog-v2
kyuno:feat/planning-page-design
kyuno:feat/settings-household-account
kyuno:feat/user-preferences-sidebar-nav
1 commit
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
| b08081e48d |
feat(admin): metriques d'utilisation (derive DB + AnalyticsEvent)
PR 3 du chantier admin. Tableau de bord metriques : snapshot de compteurs
+ series temporelles journalieres.
Schema (migration admin_metrics) :
- AnalyticsEvent (type String libre, actorType/actorId sans FK, context Json,
index [type, created_at]) + WorkerHeartbeat (cable en PR 4).
- colonnes createdAt @default(now()) sur UserProfile / Recipe / Planning /
PlanningItem (lecture admin uniquement ; lignes existantes = timestamp de
la migration).
Instrumentation (lib/analytics.service.ts, fire-and-forget) :
- analytics.recordEvent(type, {actorId?, context?}) : retourne void, insert
detache, echec loggue+avale, jamais de latence sur la requete.
- points d'appel : user.signup, recipe.created, recipe.imported,
planning.item_added, tech_step.correction_submitted, shopping_list.viewed.
API : GET /admin/metrics?days= (7-365, defaut 30, requireAdmin) ->
admin-metrics.service.ts. bucketByDay pur (zero-remplissage, teste sans
base). MetricsView dans packages/shared.
Front : DashboardPage (tuiles KPI + un graphe recharts par serie + listes
recettes-par-source / evenements), logique pure dans dashboard.ts, i18n
admin.dashboard.*. AdminApiClient.getMetrics.
reset-db.ts truncate analytics_events + worker_heartbeats.
Tests : Mocha admin-metrics.test.ts (bucketByDay pur x2 verts ; snapshot,
series zero-remplies, event user.signup fire-and-forget) ; Cypress
dashboard.cy.ts (2 verts). specs/backend-architecture.md : section admin.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|