railwatch 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AGENTS.md +42 -26
- data/CHANGELOG.md +41 -0
- data/README.md +40 -29
- data/app/frontend/components/app-content.tsx +26 -0
- data/app/frontend/components/app-logo-icon.tsx +23 -0
- data/app/frontend/components/app-logo.tsx +14 -0
- data/app/frontend/components/app-shell.tsx +38 -0
- data/app/frontend/components/app-sidebar-header.tsx +54 -0
- data/app/frontend/components/app-sidebar.tsx +94 -0
- data/app/frontend/components/app-wordmark.tsx +29 -0
- data/app/frontend/components/breadcrumbs.tsx +46 -0
- data/app/frontend/components/icon.tsx +16 -0
- data/app/frontend/components/input-error.tsx +18 -0
- data/app/frontend/components/nav-footer.tsx +46 -0
- data/app/frontend/components/nav-main.tsx +41 -0
- data/app/frontend/components/nav-user.tsx +50 -0
- data/app/frontend/components/railwatch/chart-hover.tsx +34 -0
- data/app/frontend/components/railwatch/chart-panel.tsx +170 -0
- data/app/frontend/components/railwatch/code.tsx +28 -0
- data/app/frontend/components/railwatch/command-palette.tsx +132 -0
- data/app/frontend/components/railwatch/copy-block.tsx +52 -0
- data/app/frontend/components/railwatch/copy-id.tsx +49 -0
- data/app/frontend/components/railwatch/cursor-load-more.tsx +39 -0
- data/app/frontend/components/railwatch/data-table.tsx +195 -0
- data/app/frontend/components/railwatch/digit-roll.tsx +312 -0
- data/app/frontend/components/railwatch/empty-state.tsx +159 -0
- data/app/frontend/components/railwatch/env-nav.tsx +130 -0
- data/app/frontend/components/railwatch/env-switcher.tsx +145 -0
- data/app/frontend/components/railwatch/filter-bar.tsx +153 -0
- data/app/frontend/components/railwatch/flamegraph.tsx +324 -0
- data/app/frontend/components/railwatch/frames.tsx +295 -0
- data/app/frontend/components/railwatch/json-viewer.tsx +159 -0
- data/app/frontend/components/railwatch/live-dot.tsx +78 -0
- data/app/frontend/components/railwatch/live-toggle.tsx +76 -0
- data/app/frontend/components/railwatch/metric-chart.tsx +112 -0
- data/app/frontend/components/railwatch/mobile-page-switcher.tsx +89 -0
- data/app/frontend/components/railwatch/onboarding.tsx +91 -0
- data/app/frontend/components/railwatch/origin-identity.tsx +84 -0
- data/app/frontend/components/railwatch/page-header.tsx +42 -0
- data/app/frontend/components/railwatch/percentile-picker.tsx +18 -0
- data/app/frontend/components/railwatch/relative-time.tsx +18 -0
- data/app/frontend/components/railwatch/saved-views.tsx +232 -0
- data/app/frontend/components/railwatch/segmented.tsx +64 -0
- data/app/frontend/components/railwatch/series-chart.tsx +400 -0
- data/app/frontend/components/railwatch/shortcuts-dialog.tsx +89 -0
- data/app/frontend/components/railwatch/signal-toast.tsx +121 -0
- data/app/frontend/components/railwatch/sort-header.tsx +37 -0
- data/app/frontend/components/railwatch/source-link.tsx +57 -0
- data/app/frontend/components/railwatch/sparkline-cell.tsx +14 -0
- data/app/frontend/components/railwatch/sql-block.tsx +116 -0
- data/app/frontend/components/railwatch/stat.tsx +173 -0
- data/app/frontend/components/railwatch/status-badge.tsx +79 -0
- data/app/frontend/components/railwatch/step-picker.tsx +57 -0
- data/app/frontend/components/railwatch/timeline.tsx +405 -0
- data/app/frontend/components/railwatch/utilisation-bar.tsx +44 -0
- data/app/frontend/components/railwatch/window-picker.tsx +147 -0
- data/app/frontend/components/ui/avatar.tsx +51 -0
- data/app/frontend/components/ui/badge.tsx +46 -0
- data/app/frontend/components/ui/breadcrumb.tsx +109 -0
- data/app/frontend/components/ui/button.tsx +60 -0
- data/app/frontend/components/ui/card.tsx +92 -0
- data/app/frontend/components/ui/chart.tsx +374 -0
- data/app/frontend/components/ui/checkbox.tsx +32 -0
- data/app/frontend/components/ui/collapsible.tsx +31 -0
- data/app/frontend/components/ui/command.tsx +182 -0
- data/app/frontend/components/ui/dialog.tsx +158 -0
- data/app/frontend/components/ui/dropdown-menu.tsx +255 -0
- data/app/frontend/components/ui/hover-card.tsx +42 -0
- data/app/frontend/components/ui/input.tsx +21 -0
- data/app/frontend/components/ui/label.tsx +24 -0
- data/app/frontend/components/ui/popover.tsx +87 -0
- data/app/frontend/components/ui/select.tsx +185 -0
- data/app/frontend/components/ui/separator.tsx +28 -0
- data/app/frontend/components/ui/sheet.tsx +137 -0
- data/app/frontend/components/ui/sidebar.tsx +726 -0
- data/app/frontend/components/ui/skeleton.tsx +13 -0
- data/app/frontend/components/ui/sonner.tsx +41 -0
- data/app/frontend/components/ui/table.tsx +114 -0
- data/app/frontend/components/ui/tabs.tsx +91 -0
- data/app/frontend/components/ui/textarea.tsx +18 -0
- data/app/frontend/components/ui/tooltip.tsx +61 -0
- data/app/frontend/components/user-info.tsx +32 -0
- data/app/frontend/components/user-menu-content.tsx +94 -0
- data/app/frontend/entrypoints/application.css +244 -0
- data/app/frontend/entrypoints/inertia.tsx +95 -0
- data/app/frontend/fonts/CommitMono-Bold.woff2 +0 -0
- data/app/frontend/fonts/CommitMono-Regular.woff2 +0 -0
- data/app/frontend/fonts/Roboto-Black.woff2 +0 -0
- data/app/frontend/fonts/Roboto-Bold.woff2 +0 -0
- data/app/frontend/fonts/Roboto-Medium.woff2 +0 -0
- data/app/frontend/fonts/Roboto-Regular.woff2 +0 -0
- data/app/frontend/hooks/use-appearance.tsx +67 -0
- data/app/frontend/hooks/use-clipboard.ts +32 -0
- data/app/frontend/hooks/use-flash.tsx +23 -0
- data/app/frontend/hooks/use-hotkeys.ts +63 -0
- data/app/frontend/hooks/use-initials.tsx +15 -0
- data/app/frontend/hooks/use-live.ts +179 -0
- data/app/frontend/hooks/use-mobile-navigation.ts +8 -0
- data/app/frontend/hooks/use-mobile.ts +21 -0
- data/app/frontend/hooks/use-percentile.ts +24 -0
- data/app/frontend/hooks/use-reduced-motion.ts +25 -0
- data/app/frontend/hooks/use-row-nav.ts +106 -0
- data/app/frontend/hooks/use-step.ts +27 -0
- data/app/frontend/hooks/use-ticker.ts +12 -0
- data/app/frontend/hooks/use-window.ts +58 -0
- data/app/frontend/layouts/app/app-sidebar-layout.tsx +107 -0
- data/app/frontend/layouts/app-layout.tsx +21 -0
- data/app/frontend/layouts/env-layout.tsx +53 -0
- data/app/frontend/layouts/persistent-layout.tsx +18 -0
- data/app/frontend/lib/cable.ts +10 -0
- data/app/frontend/lib/env-pages.ts +236 -0
- data/app/frontend/lib/execution-path.ts +55 -0
- data/app/frontend/lib/explain.ts +50 -0
- data/app/frontend/lib/filter.ts +25 -0
- data/app/frontend/lib/flamegraph.ts +155 -0
- data/app/frontend/lib/format.ts +71 -0
- data/app/frontend/lib/keyboard.ts +18 -0
- data/app/frontend/lib/source-link.ts +217 -0
- data/app/frontend/lib/utils.ts +6 -0
- data/app/frontend/pages/alerts/index.tsx +171 -0
- data/app/frontend/pages/broadcasts/index.tsx +171 -0
- data/app/frontend/pages/cache_events/index.tsx +127 -0
- data/app/frontend/pages/commands/index.tsx +143 -0
- data/app/frontend/pages/deploys/index.tsx +94 -0
- data/app/frontend/pages/deploys/show.tsx +309 -0
- data/app/frontend/pages/deprecations/index.tsx +176 -0
- data/app/frontend/pages/exceptions/index.tsx +271 -0
- data/app/frontend/pages/executions/show.tsx +821 -0
- data/app/frontend/pages/issues/index.tsx +399 -0
- data/app/frontend/pages/issues/show.tsx +1367 -0
- data/app/frontend/pages/jobs/index.tsx +381 -0
- data/app/frontend/pages/jobs/klass.tsx +215 -0
- data/app/frontend/pages/llm_calls/index.tsx +664 -0
- data/app/frontend/pages/logs/index.tsx +303 -0
- data/app/frontend/pages/mails/index.tsx +218 -0
- data/app/frontend/pages/notifications/index.tsx +161 -0
- data/app/frontend/pages/outgoing_requests/index.tsx +309 -0
- data/app/frontend/pages/overview/show.tsx +333 -0
- data/app/frontend/pages/people/index.tsx +102 -0
- data/app/frontend/pages/people/show.tsx +149 -0
- data/app/frontend/pages/processes/index.tsx +335 -0
- data/app/frontend/pages/profiles/index.tsx +110 -0
- data/app/frontend/pages/profiles/show.tsx +105 -0
- data/app/frontend/pages/queries/index.tsx +492 -0
- data/app/frontend/pages/queries/show.tsx +276 -0
- data/app/frontend/pages/releases/index.tsx +190 -0
- data/app/frontend/pages/releases/release-health.tsx +68 -0
- data/app/frontend/pages/releases/release-path.ts +25 -0
- data/app/frontend/pages/releases/show.tsx +262 -0
- data/app/frontend/pages/requests/index.tsx +235 -0
- data/app/frontend/pages/requests/route.tsx +159 -0
- data/app/frontend/pages/scheduled_tasks/index.tsx +220 -0
- data/app/frontend/pages/spans/index.tsx +229 -0
- data/app/frontend/pages/spans/show.tsx +220 -0
- data/app/frontend/pages/storage_ops/index.tsx +150 -0
- data/app/frontend/pages/tenants/index.tsx +236 -0
- data/app/frontend/pages/tenants/show.tsx +477 -0
- data/app/frontend/pages/tenants/tenant-path.ts +26 -0
- data/app/frontend/pages/thresholds/index.tsx +414 -0
- data/app/frontend/pages/traces/show.tsx +208 -0
- data/app/frontend/pages/transactions/index.tsx +220 -0
- data/app/frontend/pages/view_renders/index.tsx +241 -0
- data/app/frontend/pages/visits/index.tsx +321 -0
- data/app/frontend/public/icon.png +0 -0
- data/app/frontend/public/icon.svg +5 -0
- data/app/frontend/routes/index.d.ts +2136 -0
- data/app/frontend/routes/index.js +2112 -0
- data/app/frontend/types/globals.d.ts +9 -0
- data/app/frontend/types/index.ts +288 -0
- data/app/frontend/types/vite-env.d.ts +9 -0
- data/app/jobs/railwatch/rollup_job.rb +3 -1
- data/app/models/railwatch/ingest/rollup_absorber.rb +1 -1
- data/docs/ai-and-mcp.md +9 -3
- data/docs/configuration.md +68 -27
- data/docs/embedded.md +76 -43
- data/docs/faq.md +22 -10
- data/docs/getting-started.md +116 -41
- data/docs/records.md +13 -10
- data/docs/replacing-nightwatch.md +16 -14
- data/docs/replacing-sentry.md +19 -10
- data/docs/security.md +24 -3
- data/docs/self-hosting.md +9 -1
- data/docs/testing.md +14 -4
- data/docs/troubleshooting.md +62 -23
- data/lib/generators/railwatch/install/install_generator.rb +5 -4
- data/lib/generators/railwatch/install/templates/initializer.rb.tt +2 -2
- data/lib/railwatch/version.rb +1 -1
- data/lib/railwatch.rb +8 -3
- data/llms.txt +21 -18
- data/public/railwatch/assets/app-layout-LvxN9xSS.js +41 -0
- data/public/railwatch/assets/application-Cc5v_Vk9.css +1 -0
- data/public/railwatch/assets/{arrow-up-EmePsTKP.js → arrow-up-DG01k9AL.js} +1 -1
- data/public/railwatch/assets/{braces-iZ7MEfYP.js → braces-C3w7pfxS.js} +1 -1
- data/public/railwatch/assets/{card-DqdEEKcJ.js → card-Dpwlr0uY.js} +1 -1
- data/public/railwatch/assets/{chart-C4k7Ub9W.js → chart-DJHv3R7W.js} +1 -1
- data/public/railwatch/assets/{chart-hover-2yZG3w2u.js → chart-hover-CEH-DtXO.js} +1 -1
- data/public/railwatch/assets/{chart-panel-CONkZcn9.js → chart-panel-CUdIzJvk.js} +1 -1
- data/public/railwatch/assets/code-BRZprwun.js +1 -0
- data/public/railwatch/assets/copy-id-CwhGGiwF.js +1 -0
- data/public/railwatch/assets/cursor-load-more-uF1_955Q.js +1 -0
- data/public/railwatch/assets/data-table-DYi-N0hm.js +1 -0
- data/public/railwatch/assets/env-layout-HdcOaPPX.js +1 -0
- data/public/railwatch/assets/{execution-path-DWovhgLi.js → execution-path-CElXXFO_.js} +1 -1
- data/public/railwatch/assets/filter-bar-DEv0G_34.js +1 -0
- data/public/railwatch/assets/{flamegraph-BNbNIuKT.js → flamegraph-SKD9yxW9.js} +2 -2
- data/public/railwatch/assets/frames-CUpyJQDy.js +1 -0
- data/public/railwatch/assets/index-2W-ppwap.js +1 -0
- data/public/railwatch/assets/index-74ocuU5d.js +1 -0
- data/public/railwatch/assets/{index-Zkt4W_CM.js → index-B8NA62Lz.js} +2 -2
- data/public/railwatch/assets/index-BBCEkLqp.js +1 -0
- data/public/railwatch/assets/index-BDcglJzX.js +1 -0
- data/public/railwatch/assets/index-B_KFb9LS.js +1 -0
- data/public/railwatch/assets/index-BqK_VKom.js +1 -0
- data/public/railwatch/assets/index-BxCXBHP2.js +1 -0
- data/public/railwatch/assets/index-C1jc1OoH.js +1 -0
- data/public/railwatch/assets/index-C7zREldp.js +1 -0
- data/public/railwatch/assets/index-CEetm4oC.js +1 -0
- data/public/railwatch/assets/index-CIaZkokF.js +1 -0
- data/public/railwatch/assets/index-CNH85TZp.js +1 -0
- data/public/railwatch/assets/index-Ce4SB5AB.js +1 -0
- data/public/railwatch/assets/index-CiRMSYMn.js +1 -0
- data/public/railwatch/assets/index-CjxXgOs-.js +1 -0
- data/public/railwatch/assets/index-ClL-PYEV.js +1 -0
- data/public/railwatch/assets/index-CteZ6fop.js +1 -0
- data/public/railwatch/assets/index-CvqfEExO.js +1 -0
- data/public/railwatch/assets/index-CxTLT-Qh.js +1 -0
- data/public/railwatch/assets/index-DJd3OUSd.js +1 -0
- data/public/railwatch/assets/index-DPD-rLp6.js +1 -0
- data/public/railwatch/assets/index-DYK_dps4.js +1 -0
- data/public/railwatch/assets/index-DrayARrI.js +1 -0
- data/public/railwatch/assets/index-HRXGir-0.js +1 -0
- data/public/railwatch/assets/index-UJOUALr_.js +1 -0
- data/public/railwatch/assets/index-d-3J7gQ5.js +1 -0
- data/public/railwatch/assets/index-oQrvBpOm.js +1 -0
- data/public/railwatch/assets/inertia-FoqYZAk8.js +97 -0
- data/public/railwatch/assets/json-viewer-CxqMojEm.js +1 -0
- data/public/railwatch/assets/klass-DEF-Vat5.js +1 -0
- data/public/railwatch/assets/origin-identity-Y6gvfQVR.js +1 -0
- data/public/railwatch/assets/{percentile-picker-BxIVblBw.js → percentile-picker-E2aUdLxx.js} +1 -1
- data/public/railwatch/assets/relative-time-DcJbkKlN.js +1 -0
- data/public/railwatch/assets/{release-health-Cb1tMOOO.js → release-health-C8WSCDKD.js} +1 -1
- data/public/railwatch/assets/route-qO5vX1p-.js +1 -0
- data/public/railwatch/assets/{segmented-C4oWE73o.js → segmented-BWee8uc9.js} +1 -1
- data/public/railwatch/assets/select-G7rNBzv0.js +1 -0
- data/public/railwatch/assets/series-chart-C5nXIUc5.js +1 -0
- data/public/railwatch/assets/show-BEWisLQw.js +1 -0
- data/public/railwatch/assets/show-BEa9PGu1.js +2 -0
- data/public/railwatch/assets/{show-gtwKsTsl.js → show-BiT_Aloc.js} +3 -3
- data/public/railwatch/assets/show-BpCO49d3.js +1 -0
- data/public/railwatch/assets/show-CH7yxt7R.js +1 -0
- data/public/railwatch/assets/show-CTO8Lvd2.js +1 -0
- data/public/railwatch/assets/show-DnYsDMUt.js +2 -0
- data/public/railwatch/assets/show-DyzHM527.js +1 -0
- data/public/railwatch/assets/show-Nfpxs8su.js +1 -0
- data/public/railwatch/assets/show-ddjUMo9G.js +1 -0
- data/public/railwatch/assets/show-ksjbSzDH.js +1 -0
- data/public/railwatch/assets/{sort-header-CPM6fhXv.js → sort-header-uOq5VlrB.js} +1 -1
- data/public/railwatch/assets/{sparkline-cell-CXCxXPWt.js → sparkline-cell-DgGij0cu.js} +1 -1
- data/public/railwatch/assets/stat-BTzNKTm2.js +1 -0
- data/public/railwatch/assets/status-badge-BDkOXa-C.js +1 -0
- data/public/railwatch/assets/{tenant-path-C4aM_cO0.js → tenant-path-DU0ezKSU.js} +1 -1
- data/public/railwatch/assets/{use-clipboard-C1ApSwzA.js → use-clipboard-DoENmlWY.js} +1 -1
- data/public/railwatch/assets/{use-live-DWwLg1Nj.js → use-live-CE_fN5_6.js} +1 -1
- data/public/railwatch/manifest.json +612 -1591
- metadata +242 -117
- data/public/railwatch/assets/app-layout-2xAKndVD.js +0 -1
- data/public/railwatch/assets/app-wordmark-Bt6XqURo.js +0 -1
- data/public/railwatch/assets/appearance-DyCfeh9o.js +0 -1
- data/public/railwatch/assets/application-B7h1MIhi.css +0 -1
- data/public/railwatch/assets/auth-layout-BuwogWMZ.js +0 -1
- data/public/railwatch/assets/badge-Dv7I-ebP.js +0 -1
- data/public/railwatch/assets/checkbox-DKbThbxr.js +0 -1
- data/public/railwatch/assets/code-CYahYQHZ.js +0 -1
- data/public/railwatch/assets/copy-DaQMJWoT.js +0 -1
- data/public/railwatch/assets/copy-block-CbJum9s8.js +0 -1
- data/public/railwatch/assets/copy-id-JmvLfkmx.js +0 -1
- data/public/railwatch/assets/cursor-load-more-C1ylbqqL.js +0 -1
- data/public/railwatch/assets/data-table-CVKR2wkq.js +0 -1
- data/public/railwatch/assets/edit-BXF5oNYA.js +0 -1
- data/public/railwatch/assets/edit-BwSEVrTG.js +0 -8
- data/public/railwatch/assets/edit-D5BRDwLT.js +0 -1
- data/public/railwatch/assets/empty-state-Bn48Gplm.js +0 -1
- data/public/railwatch/assets/env-layout-CKLL8Ds7.js +0 -1
- data/public/railwatch/assets/filter-bar-xcbJC93z.js +0 -1
- data/public/railwatch/assets/frames-Bk39xfJG.js +0 -1
- data/public/railwatch/assets/google-sign-in-button-B5as2ps1.js +0 -1
- data/public/railwatch/assets/index-Atp1FTgX.js +0 -1
- data/public/railwatch/assets/index-B-FXAo1w.js +0 -1
- data/public/railwatch/assets/index-B0xgzHuN.js +0 -1
- data/public/railwatch/assets/index-BDVShWMs.js +0 -1
- data/public/railwatch/assets/index-BRvRkfob.js +0 -1
- data/public/railwatch/assets/index-BVWapDeB.js +0 -1
- data/public/railwatch/assets/index-Bd4YpOIO.js +0 -1
- data/public/railwatch/assets/index-BeQw69GM.js +0 -1
- data/public/railwatch/assets/index-BfitxVBv.js +0 -1
- data/public/railwatch/assets/index-C-EwH4lO.js +0 -1
- data/public/railwatch/assets/index-C8JIdb3_.js +0 -1
- data/public/railwatch/assets/index-CBFCtJAR.js +0 -1
- data/public/railwatch/assets/index-CDXlITyG.js +0 -1
- data/public/railwatch/assets/index-COd9lT84.js +0 -1
- data/public/railwatch/assets/index-C_hQmVTP.js +0 -1
- data/public/railwatch/assets/index-CcennT28.js +0 -1
- data/public/railwatch/assets/index-CiaeS-n7.js +0 -1
- data/public/railwatch/assets/index-CrA7jBTK.js +0 -1
- data/public/railwatch/assets/index-D0mKj3Hg.js +0 -1
- data/public/railwatch/assets/index-DV5MdmpY.js +0 -1
- data/public/railwatch/assets/index-DaE-1xhx.js +0 -1
- data/public/railwatch/assets/index-DdVg9LKX.js +0 -1
- data/public/railwatch/assets/index-DeLtMWou.js +0 -1
- data/public/railwatch/assets/index-DiQ4mqT_.js +0 -1
- data/public/railwatch/assets/index-LKgpCzoR.js +0 -1
- data/public/railwatch/assets/index-S0NVaLj9.js +0 -1
- data/public/railwatch/assets/index-Vj93BTR5.js +0 -1
- data/public/railwatch/assets/index-XjXcV-EO.js +0 -1
- data/public/railwatch/assets/index-aPCZX-pW.js +0 -1
- data/public/railwatch/assets/index-cTzBycCg.js +0 -1
- data/public/railwatch/assets/index-dpG-19ZN.js +0 -1
- data/public/railwatch/assets/index-gCvuyG1l.js +0 -1
- data/public/railwatch/assets/index-o1xqGvLo.js +0 -1
- data/public/railwatch/assets/index-w_skgMmK.js +0 -1
- data/public/railwatch/assets/inertia-CqnzqPVD.js +0 -97
- data/public/railwatch/assets/input-error-ByT28UdP.js +0 -1
- data/public/railwatch/assets/json-viewer-Bnu9RsJL.js +0 -1
- data/public/railwatch/assets/klass-nLiBV-Az.js +0 -1
- data/public/railwatch/assets/label-1nSzpSB6.js +0 -1
- data/public/railwatch/assets/layout-D7lE1Doo.js +0 -1
- data/public/railwatch/assets/live-dot-UdzOfzJb.js +0 -41
- data/public/railwatch/assets/nav-BRCgp2w3.js +0 -1
- data/public/railwatch/assets/new-C60G72DR.js +0 -1
- data/public/railwatch/assets/new-COyDKOOb.js +0 -1
- data/public/railwatch/assets/new-Cd9zPNJ8.js +0 -1
- data/public/railwatch/assets/new-DMJGKjmH.js +0 -1
- data/public/railwatch/assets/new-Omvf-c9s.js +0 -1
- data/public/railwatch/assets/new-vjRzERL3.js +0 -1
- data/public/railwatch/assets/onboarding-gUjJQc-6.js +0 -1
- data/public/railwatch/assets/origin-identity-M1YUPYS0.js +0 -1
- data/public/railwatch/assets/relative-time-DQ4kjowZ.js +0 -1
- data/public/railwatch/assets/route-BJkoEm7r.js +0 -1
- data/public/railwatch/assets/select-ocdQJdQo.js +0 -1
- data/public/railwatch/assets/separator-Ct2UcZ2x.js +0 -1
- data/public/railwatch/assets/series-chart-D6upsrSn.js +0 -1
- data/public/railwatch/assets/show-B4bwI9x2.js +0 -2
- data/public/railwatch/assets/show-BAjfddEn.js +0 -6
- data/public/railwatch/assets/show-BLJOyLb_.js +0 -1
- data/public/railwatch/assets/show-BoVyMQS6.js +0 -1
- data/public/railwatch/assets/show-Bsu1rvnK.js +0 -1
- data/public/railwatch/assets/show-C6OiJ6Hr.js +0 -1
- data/public/railwatch/assets/show-C8TkpEgm.js +0 -1
- data/public/railwatch/assets/show-CBFBiBY2.js +0 -1
- data/public/railwatch/assets/show-CEhPVMMT.js +0 -1
- data/public/railwatch/assets/show-CV-lG2b6.js +0 -2
- data/public/railwatch/assets/show-CX_pab9S.js +0 -2
- data/public/railwatch/assets/show-D6lgzL6n.js +0 -1
- data/public/railwatch/assets/show-DDVsv-uS.js +0 -1
- data/public/railwatch/assets/show-Dwiq-8hA.js +0 -1
- data/public/railwatch/assets/show-eKazflRI.js +0 -1
- data/public/railwatch/assets/show-yEOrk6Pt.js +0 -1
- data/public/railwatch/assets/stat-BNEfE8X1.js +0 -1
- data/public/railwatch/assets/status-badge-D0aylrM5.js +0 -1
- data/public/railwatch/assets/text-link-CP4lqUi6.js +0 -1
- data/public/railwatch/assets/textarea-DzJo2ds4.js +0 -1
- data/public/railwatch/assets/timeline-BNcJ9PMc.js +0 -1
- data/public/railwatch/assets/transition-BX2M1iaq.js +0 -5
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Link, usePage } from "@inertiajs/react"
|
|
2
|
+
|
|
3
|
+
import { Flamegraph } from "@/components/railwatch/flamegraph"
|
|
4
|
+
import { PageHeader } from "@/components/railwatch/page-header"
|
|
5
|
+
import { Stat, StatStrip } from "@/components/railwatch/stat"
|
|
6
|
+
import { Card, CardContent } from "@/components/ui/card"
|
|
7
|
+
import EnvLayout from "@/layouts/env-layout"
|
|
8
|
+
import { executionPath } from "@/lib/execution-path"
|
|
9
|
+
import { bytes, count, ms, when } from "@/lib/format"
|
|
10
|
+
import * as R from "@/routes"
|
|
11
|
+
import type { SharedProps } from "@/types"
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
profile: {
|
|
15
|
+
id: number
|
|
16
|
+
profiler: string
|
|
17
|
+
mode: string | null
|
|
18
|
+
interval: number | null
|
|
19
|
+
duration: number
|
|
20
|
+
samples: number
|
|
21
|
+
stacks_bytes: number | null
|
|
22
|
+
group_hash: string | null
|
|
23
|
+
execution_id: string | null
|
|
24
|
+
execution_preview: string | null
|
|
25
|
+
execution_source: string | null
|
|
26
|
+
occurred_at: string
|
|
27
|
+
deploy: string | null
|
|
28
|
+
server: string | null
|
|
29
|
+
}
|
|
30
|
+
collapsed: string
|
|
31
|
+
truncated: boolean
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default function ProfileShow(p: Props) {
|
|
35
|
+
const { environment, window } = usePage<SharedProps>().props
|
|
36
|
+
const a = environment!.application_id
|
|
37
|
+
const e = environment!.id
|
|
38
|
+
const x = p.profile
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<EnvLayout
|
|
42
|
+
title={x.execution_preview ?? "Profile"}
|
|
43
|
+
crumbs={[
|
|
44
|
+
{
|
|
45
|
+
title: "Profiles",
|
|
46
|
+
href: R.applicationEnvironmentProfilesPath(a, e, { window }),
|
|
47
|
+
},
|
|
48
|
+
{ title: x.execution_preview ?? `Profile ${x.id}`, href: "#" },
|
|
49
|
+
]}
|
|
50
|
+
>
|
|
51
|
+
<PageHeader
|
|
52
|
+
withWindow={false}
|
|
53
|
+
title={
|
|
54
|
+
<span className="font-mono">
|
|
55
|
+
{x.execution_preview ?? `Profile ${x.id}`}
|
|
56
|
+
</span>
|
|
57
|
+
}
|
|
58
|
+
description={
|
|
59
|
+
<span className="flex flex-wrap gap-x-3 text-xs">
|
|
60
|
+
<span>{when(x.occurred_at)}</span>
|
|
61
|
+
<span>
|
|
62
|
+
{x.profiler}
|
|
63
|
+
{x.mode ? ` · ${x.mode}` : ""}
|
|
64
|
+
</span>
|
|
65
|
+
{x.server && <span>server {x.server}</span>}
|
|
66
|
+
{x.deploy && <span>deploy {x.deploy.slice(0, 12)}</span>}
|
|
67
|
+
{x.execution_id && (
|
|
68
|
+
<Link
|
|
69
|
+
className="hover:underline"
|
|
70
|
+
href={executionPath({
|
|
71
|
+
applicationId: a,
|
|
72
|
+
environmentId: e,
|
|
73
|
+
source: x.execution_source,
|
|
74
|
+
executionId: x.execution_id,
|
|
75
|
+
})!}
|
|
76
|
+
>
|
|
77
|
+
view execution
|
|
78
|
+
</Link>
|
|
79
|
+
)}
|
|
80
|
+
</span>
|
|
81
|
+
}
|
|
82
|
+
/>
|
|
83
|
+
<StatStrip>
|
|
84
|
+
<Stat label="Samples" value={count(x.samples)} />
|
|
85
|
+
<Stat
|
|
86
|
+
label="Duration"
|
|
87
|
+
value={ms(x.duration)}
|
|
88
|
+
hint={x.interval ? `every ${ms(x.interval / 1000, 2)}` : undefined}
|
|
89
|
+
/>
|
|
90
|
+
<Stat label="Profiler" value={x.profiler} hint={x.mode ?? undefined} />
|
|
91
|
+
<Stat
|
|
92
|
+
label="Stacks"
|
|
93
|
+
value={bytes(x.stacks_bytes)}
|
|
94
|
+
hint={p.truncated ? "truncated for display" : "uncompressed"}
|
|
95
|
+
tone={p.truncated ? "warning" : undefined}
|
|
96
|
+
/>
|
|
97
|
+
</StatStrip>
|
|
98
|
+
<Card>
|
|
99
|
+
<CardContent className="pt-4">
|
|
100
|
+
<Flamegraph collapsed={p.collapsed} />
|
|
101
|
+
</CardContent>
|
|
102
|
+
</Card>
|
|
103
|
+
</EnvLayout>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
import { Link, router, usePage } from "@inertiajs/react"
|
|
2
|
+
import {
|
|
3
|
+
CheckIcon,
|
|
4
|
+
ChevronDown,
|
|
5
|
+
ChevronRight,
|
|
6
|
+
CopyIcon,
|
|
7
|
+
Database,
|
|
8
|
+
} from "lucide-react"
|
|
9
|
+
import { useState } from "react"
|
|
10
|
+
|
|
11
|
+
import { Sql } from "@/components/railwatch/code"
|
|
12
|
+
import { CursorLoadMore } from "@/components/railwatch/cursor-load-more"
|
|
13
|
+
import { DataTable } from "@/components/railwatch/data-table"
|
|
14
|
+
import { EmptyState } from "@/components/railwatch/empty-state"
|
|
15
|
+
import { FilterBar } from "@/components/railwatch/filter-bar"
|
|
16
|
+
import { PageHeader } from "@/components/railwatch/page-header"
|
|
17
|
+
import { PercentilePicker } from "@/components/railwatch/percentile-picker"
|
|
18
|
+
import { SortHeader } from "@/components/railwatch/sort-header"
|
|
19
|
+
import { SparklineCell } from "@/components/railwatch/sparkline-cell"
|
|
20
|
+
import { Stat, StatStrip } from "@/components/railwatch/stat"
|
|
21
|
+
import { Button } from "@/components/ui/button"
|
|
22
|
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
|
23
|
+
import { useClipboard } from "@/hooks/use-clipboard"
|
|
24
|
+
import { usePercentile } from "@/hooks/use-percentile"
|
|
25
|
+
import { useWindow } from "@/hooks/use-window"
|
|
26
|
+
import EnvLayout from "@/layouts/env-layout"
|
|
27
|
+
import { count, ms } from "@/lib/format"
|
|
28
|
+
import * as R from "@/routes"
|
|
29
|
+
import type {
|
|
30
|
+
CursorMeta,
|
|
31
|
+
GroupRow,
|
|
32
|
+
SharedProps,
|
|
33
|
+
SummaryWithDelta,
|
|
34
|
+
} from "@/types"
|
|
35
|
+
|
|
36
|
+
// Telemetry::NPlusOne#suggestion — the fix Railwatch reads off the repeated
|
|
37
|
+
// statement's shape. Null when the SQL isn't a shape a preload can fix.
|
|
38
|
+
interface Suggestion {
|
|
39
|
+
kind: string
|
|
40
|
+
parent: string | null
|
|
41
|
+
association: string
|
|
42
|
+
code: string
|
|
43
|
+
explanation: string
|
|
44
|
+
}
|
|
45
|
+
interface N1 {
|
|
46
|
+
group_hash: string
|
|
47
|
+
occurrences: number
|
|
48
|
+
sql: string
|
|
49
|
+
source: string | null
|
|
50
|
+
max_count: number
|
|
51
|
+
suggestion: Suggestion | null
|
|
52
|
+
}
|
|
53
|
+
interface Sample {
|
|
54
|
+
id: number
|
|
55
|
+
sql: string
|
|
56
|
+
duration: number
|
|
57
|
+
occurred_at: string
|
|
58
|
+
execution_id: string | null
|
|
59
|
+
execution_preview: string | null
|
|
60
|
+
source: string | null
|
|
61
|
+
group_hash: string
|
|
62
|
+
}
|
|
63
|
+
interface Props {
|
|
64
|
+
queries: GroupRow[]
|
|
65
|
+
n_plus_ones: N1[]
|
|
66
|
+
slowest: Sample[]
|
|
67
|
+
summary: SummaryWithDelta
|
|
68
|
+
sort: string
|
|
69
|
+
dir: string
|
|
70
|
+
q: string
|
|
71
|
+
pagination: CursorMeta
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const COPIED_RESET_MS = 1500
|
|
75
|
+
|
|
76
|
+
// The fix for one N+1, revealed under its row. Mono block plus a Copy
|
|
77
|
+
// button so the suggested `includes` goes straight into the editor.
|
|
78
|
+
function Fix({ suggestion }: { suggestion: Suggestion }) {
|
|
79
|
+
const [, copy] = useClipboard()
|
|
80
|
+
const [copied, setCopied] = useState(false)
|
|
81
|
+
|
|
82
|
+
const handleCopy = () => {
|
|
83
|
+
void copy(suggestion.code).then((ok) => {
|
|
84
|
+
if (!ok) return
|
|
85
|
+
setCopied(true)
|
|
86
|
+
window.setTimeout(() => setCopied(false), COPIED_RESET_MS)
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<div className="border-warning/40 bg-muted/40 mt-2 space-y-2 rounded-lg border p-2">
|
|
92
|
+
<div className="flex items-start justify-between gap-2">
|
|
93
|
+
<pre className="overflow-x-auto font-mono text-xs whitespace-pre-wrap">
|
|
94
|
+
{suggestion.code}
|
|
95
|
+
</pre>
|
|
96
|
+
<Button
|
|
97
|
+
type="button"
|
|
98
|
+
variant="ghost"
|
|
99
|
+
size="sm"
|
|
100
|
+
className="h-6 shrink-0 gap-1 px-1.5 text-xs"
|
|
101
|
+
onClick={(event) => {
|
|
102
|
+
event.stopPropagation()
|
|
103
|
+
handleCopy()
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
{copied ? (
|
|
107
|
+
<CheckIcon className="size-3 text-emerald-500" />
|
|
108
|
+
) : (
|
|
109
|
+
<CopyIcon className="size-3 opacity-60" />
|
|
110
|
+
)}
|
|
111
|
+
Copy
|
|
112
|
+
</Button>
|
|
113
|
+
</div>
|
|
114
|
+
<p className="text-muted-foreground text-xs whitespace-normal">
|
|
115
|
+
{suggestion.explanation}
|
|
116
|
+
</p>
|
|
117
|
+
</div>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export default function Queries(p: Props) {
|
|
122
|
+
const { environment, window, range } = usePage<SharedProps>().props
|
|
123
|
+
const { percentile } = usePercentile()
|
|
124
|
+
const { label: windowLabel } = useWindow()
|
|
125
|
+
// group_hash of the N+1 row whose suggested fix is expanded, if any.
|
|
126
|
+
const [openFix, setOpenFix] = useState<string | null>(null)
|
|
127
|
+
const a = environment!.application_id
|
|
128
|
+
const e = environment!.id
|
|
129
|
+
const timeParams =
|
|
130
|
+
window === "custom"
|
|
131
|
+
? { from: range?.from, to: range?.to }
|
|
132
|
+
: { window: window }
|
|
133
|
+
const cursorTimeParams = range
|
|
134
|
+
? { from: range.from, to: range.to }
|
|
135
|
+
: timeParams
|
|
136
|
+
const samplesPath = (cursor?: string, q = p.q) =>
|
|
137
|
+
R.applicationEnvironmentQueriesPath(a, e, {
|
|
138
|
+
...(cursor ? cursorTimeParams : timeParams),
|
|
139
|
+
q: q || undefined,
|
|
140
|
+
cursor,
|
|
141
|
+
limit: p.pagination.limit,
|
|
142
|
+
sort: p.sort,
|
|
143
|
+
dir: p.dir,
|
|
144
|
+
})
|
|
145
|
+
const summary = p.summary.current
|
|
146
|
+
const previous = p.summary.previous
|
|
147
|
+
const deltaCaption =
|
|
148
|
+
window === "custom" ? "vs previous period" : `vs previous ${windowLabel}`
|
|
149
|
+
const fixable = p.n_plus_ones.filter((n) => n.suggestion).length
|
|
150
|
+
|
|
151
|
+
const toggleFix = (n: N1) => {
|
|
152
|
+
if (!n.suggestion) return
|
|
153
|
+
setOpenFix((current) => (current === n.group_hash ? null : n.group_hash))
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const sortBy = (field: string) =>
|
|
157
|
+
router.visit(
|
|
158
|
+
R.applicationEnvironmentQueriesPath(a, e, {
|
|
159
|
+
...timeParams,
|
|
160
|
+
q: p.q || undefined,
|
|
161
|
+
sort: field,
|
|
162
|
+
dir: p.sort === field && p.dir === "desc" ? "asc" : "desc",
|
|
163
|
+
}),
|
|
164
|
+
{ preserveState: true },
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
const queryHref = (groupHash: string) =>
|
|
168
|
+
R.applicationEnvironmentQueryPath(a, e, groupHash, timeParams)
|
|
169
|
+
const openQuery = (groupHash: string, opts?: { newTab?: boolean }) =>
|
|
170
|
+
opts?.newTab
|
|
171
|
+
? globalThis.window.open(queryHref(groupHash), "_blank")
|
|
172
|
+
: router.visit(queryHref(groupHash))
|
|
173
|
+
|
|
174
|
+
return (
|
|
175
|
+
<EnvLayout title="Queries">
|
|
176
|
+
<PageHeader
|
|
177
|
+
title="Queries"
|
|
178
|
+
description="Every SQL shape your app ran, grouped by normalized statement."
|
|
179
|
+
actions={<PercentilePicker />}
|
|
180
|
+
/>
|
|
181
|
+
<StatStrip>
|
|
182
|
+
<Stat
|
|
183
|
+
label="Queries"
|
|
184
|
+
value={count(summary.count)}
|
|
185
|
+
delta={{
|
|
186
|
+
current: summary.count,
|
|
187
|
+
previous: previous.count,
|
|
188
|
+
goodDirection: "down",
|
|
189
|
+
}}
|
|
190
|
+
deltaCaption={deltaCaption}
|
|
191
|
+
/>
|
|
192
|
+
<Stat
|
|
193
|
+
label="N+1 groups"
|
|
194
|
+
value={count(p.n_plus_ones.length)}
|
|
195
|
+
tone={p.n_plus_ones.length > 0 ? "warning" : undefined}
|
|
196
|
+
hint={
|
|
197
|
+
p.n_plus_ones.length > 0
|
|
198
|
+
? `${fixable} with a suggested fix`
|
|
199
|
+
: undefined
|
|
200
|
+
}
|
|
201
|
+
/>
|
|
202
|
+
<Stat
|
|
203
|
+
label="Avg"
|
|
204
|
+
value={ms(summary.avg / 1000, 2)}
|
|
205
|
+
delta={{
|
|
206
|
+
current: summary.avg,
|
|
207
|
+
previous: previous.avg,
|
|
208
|
+
goodDirection: "down",
|
|
209
|
+
}}
|
|
210
|
+
deltaCaption={deltaCaption}
|
|
211
|
+
/>
|
|
212
|
+
<Stat
|
|
213
|
+
label="p95"
|
|
214
|
+
value={ms(summary.p95 / 1000, 2)}
|
|
215
|
+
hint={`p99 ${ms(summary.p99 / 1000, 2)}`}
|
|
216
|
+
delta={{
|
|
217
|
+
current: summary.p95,
|
|
218
|
+
previous: previous.p95,
|
|
219
|
+
goodDirection: "down",
|
|
220
|
+
}}
|
|
221
|
+
deltaCaption={deltaCaption}
|
|
222
|
+
/>
|
|
223
|
+
</StatStrip>
|
|
224
|
+
{p.n_plus_ones.length > 0 && (
|
|
225
|
+
<Card className="border-amber-500/40">
|
|
226
|
+
<CardHeader>
|
|
227
|
+
<CardTitle>N+1 queries detected</CardTitle>
|
|
228
|
+
</CardHeader>
|
|
229
|
+
<CardContent>
|
|
230
|
+
<DataTable
|
|
231
|
+
rows={p.n_plus_ones}
|
|
232
|
+
rowKey={(n) => n.group_hash}
|
|
233
|
+
onRowClick={toggleFix}
|
|
234
|
+
keyboardNav={{
|
|
235
|
+
onOpen: (n, opts) => openQuery(n.group_hash, opts),
|
|
236
|
+
}}
|
|
237
|
+
columns={[
|
|
238
|
+
{
|
|
239
|
+
key: "sql",
|
|
240
|
+
header: "Query shape",
|
|
241
|
+
grow: true,
|
|
242
|
+
cell: (n) => (
|
|
243
|
+
<>
|
|
244
|
+
<Link
|
|
245
|
+
href={R.applicationEnvironmentQueryPath(
|
|
246
|
+
a,
|
|
247
|
+
e,
|
|
248
|
+
n.group_hash,
|
|
249
|
+
)}
|
|
250
|
+
>
|
|
251
|
+
<Sql className="hover:underline">{n.sql}</Sql>
|
|
252
|
+
</Link>
|
|
253
|
+
{openFix === n.group_hash && n.suggestion && (
|
|
254
|
+
<Fix suggestion={n.suggestion} />
|
|
255
|
+
)}
|
|
256
|
+
</>
|
|
257
|
+
),
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
key: "fix",
|
|
261
|
+
header: "Fix",
|
|
262
|
+
cell: (n) =>
|
|
263
|
+
n.suggestion ? (
|
|
264
|
+
<button
|
|
265
|
+
type="button"
|
|
266
|
+
aria-expanded={openFix === n.group_hash}
|
|
267
|
+
aria-label={`Suggested fix: ${n.suggestion.code}`}
|
|
268
|
+
onClick={(event) => {
|
|
269
|
+
event.stopPropagation()
|
|
270
|
+
toggleFix(n)
|
|
271
|
+
}}
|
|
272
|
+
className="border-warning/50 text-warning hover:bg-warning/10 inline-flex items-center gap-0.5 rounded-md border py-0.5 pr-1.5 pl-0.5 font-mono text-[11px] uppercase"
|
|
273
|
+
>
|
|
274
|
+
{openFix === n.group_hash ? (
|
|
275
|
+
<ChevronDown className="size-3" />
|
|
276
|
+
) : (
|
|
277
|
+
<ChevronRight className="size-3" />
|
|
278
|
+
)}
|
|
279
|
+
Fix
|
|
280
|
+
</button>
|
|
281
|
+
) : null,
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
key: "src",
|
|
285
|
+
hideOnMobile: true,
|
|
286
|
+
header: "Source",
|
|
287
|
+
cell: (n) => (
|
|
288
|
+
<span className="text-muted-foreground font-mono text-xs">
|
|
289
|
+
{n.source ?? ""}
|
|
290
|
+
</span>
|
|
291
|
+
),
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
key: "occ",
|
|
295
|
+
header: "Executions affected",
|
|
296
|
+
align: "right",
|
|
297
|
+
cell: (n) => n.occurrences,
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
key: "mx",
|
|
301
|
+
hideOnMobile: true,
|
|
302
|
+
header: "Max repeats",
|
|
303
|
+
align: "right",
|
|
304
|
+
cell: (n) => n.max_count,
|
|
305
|
+
},
|
|
306
|
+
]}
|
|
307
|
+
/>
|
|
308
|
+
</CardContent>
|
|
309
|
+
</Card>
|
|
310
|
+
)}
|
|
311
|
+
<DataTable
|
|
312
|
+
rows={p.queries}
|
|
313
|
+
rowKey={(q) => q.group_hash}
|
|
314
|
+
empty={
|
|
315
|
+
<EmptyState
|
|
316
|
+
icon={Database}
|
|
317
|
+
title="No queries in this window"
|
|
318
|
+
description="SQL queries executed by your app appear here as they're reported."
|
|
319
|
+
/>
|
|
320
|
+
}
|
|
321
|
+
hoverKey={(q) => q.group_hash}
|
|
322
|
+
keyboardNav={{
|
|
323
|
+
onOpen: (q, opts) => openQuery(q.group_hash, opts),
|
|
324
|
+
}}
|
|
325
|
+
columns={[
|
|
326
|
+
{
|
|
327
|
+
key: "sql",
|
|
328
|
+
header: "Query",
|
|
329
|
+
grow: true,
|
|
330
|
+
cell: (q) => (
|
|
331
|
+
<Link href={queryHref(q.group_hash)}>
|
|
332
|
+
<Sql className="hover:underline">{q.name}</Sql>
|
|
333
|
+
</Link>
|
|
334
|
+
),
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
key: "trend",
|
|
338
|
+
hideOnMobile: true,
|
|
339
|
+
header: "Trend",
|
|
340
|
+
cell: (q) => (
|
|
341
|
+
<SparklineCell data={q.sparkline} hoverKey={q.group_hash} />
|
|
342
|
+
),
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
key: "n",
|
|
346
|
+
header: (
|
|
347
|
+
<SortHeader
|
|
348
|
+
label="Count"
|
|
349
|
+
active={p.sort === "count"}
|
|
350
|
+
dir={p.dir === "asc" ? "asc" : "desc"}
|
|
351
|
+
onClick={() => sortBy("count")}
|
|
352
|
+
/>
|
|
353
|
+
),
|
|
354
|
+
align: "right",
|
|
355
|
+
cell: (q) => count(q.count),
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
key: "avg",
|
|
359
|
+
hideOnMobile: true,
|
|
360
|
+
header: (
|
|
361
|
+
<SortHeader
|
|
362
|
+
label="Avg"
|
|
363
|
+
active={p.sort === "avg"}
|
|
364
|
+
dir={p.dir === "asc" ? "asc" : "desc"}
|
|
365
|
+
onClick={() => sortBy("avg")}
|
|
366
|
+
/>
|
|
367
|
+
),
|
|
368
|
+
align: "right",
|
|
369
|
+
cell: (q) => ms(q.avg, 2),
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
key: percentile,
|
|
373
|
+
header: (
|
|
374
|
+
<SortHeader
|
|
375
|
+
label={percentile}
|
|
376
|
+
active={p.sort === percentile}
|
|
377
|
+
dir={p.dir === "asc" ? "asc" : "desc"}
|
|
378
|
+
onClick={() => sortBy(percentile)}
|
|
379
|
+
/>
|
|
380
|
+
),
|
|
381
|
+
align: "right",
|
|
382
|
+
cell: (q) => (
|
|
383
|
+
<span className="font-semibold">{ms(q[percentile], 2)}</span>
|
|
384
|
+
),
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
key: "max",
|
|
388
|
+
hideOnMobile: true,
|
|
389
|
+
header: (
|
|
390
|
+
<SortHeader
|
|
391
|
+
label="Max"
|
|
392
|
+
active={p.sort === "max"}
|
|
393
|
+
dir={p.dir === "asc" ? "asc" : "desc"}
|
|
394
|
+
onClick={() => sortBy("max")}
|
|
395
|
+
/>
|
|
396
|
+
),
|
|
397
|
+
align: "right",
|
|
398
|
+
cell: (q) => ms(q.max, 2),
|
|
399
|
+
},
|
|
400
|
+
]}
|
|
401
|
+
/>
|
|
402
|
+
<h2 className="text-sm font-semibold">Slowest individual queries</h2>
|
|
403
|
+
<FilterBar
|
|
404
|
+
value={p.q}
|
|
405
|
+
fields={[
|
|
406
|
+
{ key: "after", label: "After" },
|
|
407
|
+
{ key: "before", label: "Before" },
|
|
408
|
+
{ key: "user", label: "User" },
|
|
409
|
+
{ key: "tenant", label: "Tenant" },
|
|
410
|
+
{ key: "deploy", label: "Deploy" },
|
|
411
|
+
{ key: "source", label: "Source" },
|
|
412
|
+
{
|
|
413
|
+
key: "kind",
|
|
414
|
+
label: "Execution kind",
|
|
415
|
+
options: ["request", "job", "scheduled_task", "command"],
|
|
416
|
+
},
|
|
417
|
+
{ key: "connection", label: "Connection" },
|
|
418
|
+
{ key: "role", label: "Role" },
|
|
419
|
+
{ key: "adapter", label: "Adapter" },
|
|
420
|
+
]}
|
|
421
|
+
onChange={(q) =>
|
|
422
|
+
router.visit(samplesPath(undefined, q), {
|
|
423
|
+
only: ["slowest", "pagination", "q"],
|
|
424
|
+
preserveState: true,
|
|
425
|
+
reset: ["slowest"],
|
|
426
|
+
})
|
|
427
|
+
}
|
|
428
|
+
placeholder="connection:primary role:reading source:app/models"
|
|
429
|
+
/>
|
|
430
|
+
<DataTable
|
|
431
|
+
rows={p.slowest}
|
|
432
|
+
rowKey={(s) => s.id}
|
|
433
|
+
keyboardNav={{
|
|
434
|
+
onOpen: (s, opts) => openQuery(s.group_hash, opts),
|
|
435
|
+
}}
|
|
436
|
+
columns={[
|
|
437
|
+
{
|
|
438
|
+
key: "sql",
|
|
439
|
+
header: "SQL",
|
|
440
|
+
grow: true,
|
|
441
|
+
cell: (s) => (
|
|
442
|
+
<Link href={queryHref(s.group_hash)}>
|
|
443
|
+
<Sql className="hover:underline">{s.sql}</Sql>
|
|
444
|
+
</Link>
|
|
445
|
+
),
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
key: "exe",
|
|
449
|
+
hideOnMobile: true,
|
|
450
|
+
header: "In",
|
|
451
|
+
cell: (s) =>
|
|
452
|
+
s.execution_id ? (
|
|
453
|
+
<Link
|
|
454
|
+
className="font-mono text-xs hover:underline"
|
|
455
|
+
href={R.applicationEnvironmentRequestPath(
|
|
456
|
+
a,
|
|
457
|
+
e,
|
|
458
|
+
s.execution_id,
|
|
459
|
+
)}
|
|
460
|
+
>
|
|
461
|
+
{s.execution_preview}
|
|
462
|
+
</Link>
|
|
463
|
+
) : (
|
|
464
|
+
<span className="text-muted-foreground text-xs">–</span>
|
|
465
|
+
),
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
key: "src",
|
|
469
|
+
hideOnMobile: true,
|
|
470
|
+
header: "Source",
|
|
471
|
+
cell: (s) => (
|
|
472
|
+
<span className="text-muted-foreground font-mono text-xs">
|
|
473
|
+
{s.source ?? ""}
|
|
474
|
+
</span>
|
|
475
|
+
),
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
key: "d",
|
|
479
|
+
header: "Duration",
|
|
480
|
+
align: "right",
|
|
481
|
+
cell: (s) => ms(s.duration, 2),
|
|
482
|
+
},
|
|
483
|
+
]}
|
|
484
|
+
/>
|
|
485
|
+
<CursorLoadMore
|
|
486
|
+
meta={p.pagination}
|
|
487
|
+
href={samplesPath}
|
|
488
|
+
only={["slowest", "pagination"]}
|
|
489
|
+
/>
|
|
490
|
+
</EnvLayout>
|
|
491
|
+
)
|
|
492
|
+
}
|