Commit graph

233 commits

Author SHA1 Message Date
Anthony Alaribe
a7de262668
Log explorer improvements: early fetch and virtual parent placeholders (#284)
* Add virtual parent placeholders for orphaned spans in tree view

Remove automatic child span fetching and instead create virtual parent
nodes when child spans are loaded before their parents. This shows a
'Parent span pending' indicator with a dashed border in tree view.

* Replace browser preload with early JS fetch for log explorer

Browser preload used Accept: */* which returned HTML-wrapped JSON.
Early fetch uses Accept: application/json and stores promise on window
for the web component to await, eliminating duplicate request.

* Refactor: simplify code in log explorer components

- Use pattern match in toHtml for LogsGetJson to avoid repeating parameters
- Simplify worker timeout callback using && short-circuit
- Add tooltip with full parent ID on virtual parent spans
- Use nullish coalescing for cleaner startNs fallback
- Simplify orphan span grouping with spread operator

* Fix Monaco editor test mocks for jsdom environment

Add missing document.queryCommandSupported and document.execCommand mocks
for Monaco clipboard support, and add addEventListener/removeEventListener
to Worker mock.
2026-01-17 03:18:55 +01:00
Anthony Alaribe
c5c7fe087d Fix YAML editor rendering and add syntax highlighting
- Add w-full class to yaml-editor element to fix width rendering
- Register YAML language in Monaco using official language definition
- Simplify yaml-editor.ts to use global Monaco instance
2026-01-16 12:37:09 -08:00
Anthony Alaribe
9fe8441c97 Update Tagify dropdown positioning config
- Add position and place settings for dropdown placement
- Comment out appendTarget function
2026-01-16 07:42:53 -08:00
Anthony Alaribe
845f6cee89
Dashboard revamp: Golden Signals, enhanced observability tabs, and infrastructure monitoring (#283)
* Revamp overview dashboard with Golden Signals, enhanced tabs, and Infra monitoring

- Add Golden Signals metrics (Traffic, P95 Latency, Error Rate, Apdex) as primary overview
- Add secondary System Overview row with service/endpoint counts
- Enhance Services table with Apdex score and improved error rate calculation
- Revamp Logs tab: timeseries for errors/warnings, error patterns table, service treemap
- Revamp Databases tab: query optimization targets, latency percentiles, operation breakdown
- Add new Infra tab: CPU/memory utilization, container metrics, Kafka/Redis monitoring
- Add WTServiceMap and WTHeatmap widget types for future visualizations
- Track dashboard YAML files as TH dependencies for automatic recompilation

* Improve group widget layout and collapse behavior

- Fix group header to use auto height instead of flex ratio
- Add CSS for collapsed state (header fills space, chevron rotates)
- Balance GridStack margins (1rem top/bottom) for better centering
- Remove h-full from grid-stack-item-content for proper margin support
- Remove paddingBtm from widgets (GridStack margins handle spacing)
- Reduce dashboard page top padding

* Auto-format code with fourmolu

* Add client-side variable interpolation for widget titles

- Add data-var-template attribute to title/subtitle elements containing {{var-*}}
- Add JS function to interpolate {{var-*}} placeholders from URL params
- Run interpolation on page load and when variables change (update-query event)
- Support both regular widget headers and group widget titles

This enables dynamic title updates without server round-trips when
dashboard variables are changed.

* Add dashboard skeleton loader and simplify widget code

- Add skeleton loader shown while GridStack initializes to prevent
  layout flash where widgets appear squished in top-left corner
- Hide grid until initialized with CSS, fade in skeleton smoothly
- Simplify Widget.hs: isFullWidth, effectiveHeight, attrs using foldMap
- Add widget descriptions to overview dashboard

* Auto-format code with fourmolu

* Refactor dashboard code and fix performance issues

- Use System.FilePath (</>) instead of custom operator
- Simplify groupRequiredHeight fold with foldl'
- Use foldMap pattern for verbose boolean conditions
- Remove orphaned comments
- Fix race condition in collapse handler using widget-scoped flags
- Increase debounce from 200ms to 500ms
- Optimize compactGrid to only batch update when items moved
- Add 5s skeleton timeout fallback
- Replace setTimeout with requestAnimationFrame

* Fix Math.max -Infinity edge case and ensure skeleton cleanup

- Add guard Math.max(1, ...) to prevent -Infinity when array is empty
- Wrap GridStack.init in try-finally to ensure skeleton timeout cleanup

* Upgrade Node.js from 18 to 22 for Vite 7 compatibility

* Update ui-tests to Node.js 22 for consistency

* Fix widget title variable interpolation on initial load

- Make interpolateVarTemplates() globally accessible via window scope
- Call interpolation after GridStack initializes widgets
- Call interpolation after HTMX swaps tab content

Variables in widget titles now render correctly on page load and tab
switches, not just after taglist changes.

* Move interpolateVarTemplates definition outside DOMContentLoaded

* Add SQL syntax highlighting and lazy loading for dashboard widgets

- Add highlight.js with sql-formatter for SQL preview syntax highlighting
- Cache URL params in interpolateVarTemplates for efficiency
- Add HTMX update-query trigger for stat/table widgets to refresh on variable changes
- Refactor stat widget rendering with lazy loading support
- Remove eager flag from overview dashboard widgets

* Auto-format code with fourmolu

* Add .playwright-mcp to gitignore

* Clean up processWidget and add JS optimizations

- Remove unused replacePlaceholders parameters from processWidget
- Add requestAnimationFrame debouncing to interpolateVarTemplates
- Add null check to compactGrid function

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-01-15 21:06:33 +01:00
Anthony Alaribe
014e0ca2af
Kql update (#276)
* Add KQL scalar functions, SQL preview, and dashboard YAML editing

- Add scalar function support: coalesce, iff, isnull, isnotnull, toint, tofloat, tostring, round
- Fix extend column resolution for GROUP BY clauses
- Separate aggregations from extended columns in query components
- Add SQL debug preview endpoint for widgets
- Add dashboard YAML get/put endpoints for editing
- Show empty constants warning on dashboard pages
- Fix ORDER BY to use GROUP BY column when timestamp not in GROUP BY
- Add yaml-editor web component

* Auto-format code with fourmolu

* Refactor Widget.hs and DashboardUtils.hs for cleaner code

- Hoist V.toList dataRows conversion in renderTableWithDataAndParams
- Simplify KQL remapping using mapMaybe in variablePresetsKQL
- Replace forM_ (zip xs [0..]) with ifor_ for indexed iteration
- Add TODO comments for rawQuery/rawSql Phase 4 removal
- Add doctests for replacePlaceholders, constantToSQLList, constantToKQLList

* Auto-format code with fourmolu

* switch list to table in dashboard

* Add KQL arithmetic expressions and fix parser issues

- Add arithmetic support in summarize: count() / 5.0, count() * 100 / sum(x)
- Fix by-clause parsing to distinguish subjects from scalar functions
- Add ByClauseItem type for proper by-clause item representation
- Fix non-bin summarize queries to use aggregations in SELECT
- Fix extend operator to append columns to defaults (not replace)
- Add extendSelect field to QueryComponents for proper extend semantics
- Forward dashboard constants via data-constants attribute in HTMX
- Use variablePresetsKQL for KQL query expansion in chart endpoint

* Fix KQL arithmetic parsing and refactor SQL generation

- Fix arithmetic operator precedence using makeExprParser
- Fix numeric literal parsing order (try pNumericOnly before aggFunctionParser)
- Add try to arithmetic operators for proper backtracking with 'by' clause
- Add NormalizedQuery type for cleaner SQL generation
- Add transformAST for AST normalization (combineWheres, reorderSections)
- Add unit test for arithmetic division with bin_auto()
- Add doctest for percentiles with by clause regression

* Auto-format code with fourmolu

* Fix hlint warnings in Parser modules

* Performance and safety improvements for KQL parser and dashboards

- Fix KQL remapping bug: filter out -kql suffix entries from output
- Add time interval bounds checking (max 1 year) to prevent DoS
- Use Map.lookup instead of list lookup in resolveExtendedColumn (O(log n))
- Use Set for flattenedOtelAttributes for O(log n) membership checks
- Pre-compute replacement maps once in mkWidgetProcessor for efficiency

* Auto-format code with fourmolu

* Fix regex recompilation and restore rawQuery for Monaco editor

- Pre-compile placeholder regex at module load for performance
- Restore rawQuery field in Widget to preserve original query with placeholders
- Use rawQuery in widget editor for Monaco to display original KQL query

* Improve dashboard widget search and test assertions

- Fix findWidgetInDashboard to recursively search into children
- Process dashboard constants concurrently with pooledForConcurrently
- Simplify variablePresetsKQL using list comprehension
- Update ParserSpec tests to compare full SQL and error messages
- Remove T.isInfixOf partial matches in favor of exact comparisons

* Fix regex type safety and add argument validation to KQL functions

- Use Text instead of String in placeholder regex for type consistency
- Add argument count validation for iff, isnull, isnotnull, isempty, isnotempty
- Fix round() decimal validation logic (was inverted)
- Update doctest expected output for percentiles with by clause

* Optimize Widget rendering and add placeholder DoS protection

- Use Vector operations directly instead of converting to lists
- Add 1MB size limit to placeholder replacement to prevent DoS
- Refactor scalar function SQL generation to use Maps
- Fix empty constants check to include Nothing case

* simplify

* Fix widget query loss and SQL preview not loading

- Fix SQL preview: use 'toggle from:closest details' trigger since toggle
  event fires on parent details element, not child divs
- Fix SQL preview: use raw_query || query (snake_case JSON field names)
- Fix query loss: add mergeWidgetPreservingQuery to preserve original query
  and rawQuery fields when updating widgets instead of replacing entirely

* Fix stat widget color and add variable defaults to constants

- Fix timeseries_stat widgets showing green instead of blue by using
  default palette color for generic column names (value, count, etc.)
- Add addVariableDefaults to ensure dashboard constants can reference
  variables like {{var-resource}} even when not in URL params

* Fix widget duplication and deletion in dashboards

- Fix widget duplication to properly initialize charts and scripts
- Use template element to extract widget HTML and re-query DOM after GridStack adds it
- Process htmx, hyperscript, and scripts on the live DOM element
- Fix widget deletion to use closest grid-stack instead of global instance
- Fix hyperscript syntax for drawer close event

* Auto-format code with fourmolu

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-01-09 23:38:28 +01:00
Anthony Alaribe
20df28d320
Optimize query editor performance (#269)
* Optimize query editor performance with aggressive Monaco settings

- Add schema resolution caching (nestedCache, valueCache) to avoid
  redundant field lookups on every keystroke
- Add completion request cancellation via version counter to abandon
  stale requests when user types faster than completions resolve
- Add character-based pre-checks before running expensive regex patterns
- Disable Monaco features that add per-keystroke overhead:
  - accessibilitySupport, matchBrackets, links, contextmenu
  - hover, parameterHints, inlayHints, codeLens, lightbulb
  - occurrencesHighlight, selectionHighlight, colorDecorators
- Use requestIdleCallback in onDidChangeModelContent to defer
  non-critical work off the main thread
- Remove showSuggestions state update from keystroke path to
  reduce Lit component re-renders

* Fix query editor performance issues from code review

- Add cache invalidation to setDynamicResolver to prevent stale results
- Add fast-path includes('.') check before regex in updateSuggestions/insertCompletion
- Precompile whitespace and word boundary regexes used in hot loop
- Fix redundant mouseover re-renders by checking if selectedIndex changed
- Clean up global resize/keydown event listeners in disconnectedCallback

* Simplify filterAndSlice and fix requestIdleCallback fallback

- Revert filterAndSlice to simpler filter().slice(0,5) pattern
- Fix requestIdleCallback fallback - setTimeout doesn't accept options object
2026-01-07 19:08:25 +01:00
Anthony Alaribe
5f95c341dc Fix Tagify dropdown hover styles and positioning
- Add !important to hover/active styles to override library defaults
- Change dropdown position from 'text' to 'input' for proper alignment
- Consolidate hover and active selectors
2026-01-06 23:58:56 +01:00
Anthony Alaribe
94bb50c51d Fix trace rendering span overflow and improve text legibility
- Fix span overflow bug by using actual time range (maxEndTime - minStartTime)
  instead of max duration for rootVal calculation
- Add getContrastTextColor that returns tinted text colors instead of pure
  white/black for softer, more visually pleasing appearance
- Add left padding (ml-1) to span text for better readability
- Simplify buildHierarchy function and fix serviceName type in WaterfallItem
2026-01-06 23:37:58 +01:00
Anthony Alaribe
1108c73235 Fix log-list action rows to be clickable anywhere on the row
- Make entire row clickable for "Check for recent data", "Load more", and
  "Expand time range" actions instead of just the text link
- Fix row heights to match virtualizer's 28px item size to prevent overlaps
- Add CSS rule to prevent clicks on closed popovers
2026-01-06 21:05:09 +01:00
Anthony Alaribe
fdd5682a5a Fix log-list column header dropdowns
- Fix chevron-down SVG icon color in dark mode by using fill instead of stroke
- Replace tabindex-based dropdown with popover API to fix click-through bug
- Add cursor-pointer to dropdown trigger button

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-01-06 20:32:38 +01:00
Anthony Alaribe
e68776ccb6
Use htmx for dashboard widget reorders and new widgets (#268)
* Add tab-aware widget management with HTMX reordering

- Add tab slug parameter to widget put/reorder endpoints for tabbed dashboards
- Replace JS fetch with HTMX trigger for widget order updates
- Move response-targets HTMX extension from CDN to local assets
- Remove updateWidgetOrder JS function (now handled via HTMX)

* Auto-format code with fourmolu

* Add GitHub icon to SVG sprites

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-01-05 23:00:30 +01:00
Anthony Alaribe
c05de0450d
Implement lazy-loaded tabs with htmx (#264)
* feat(dashboard): implement htmx lazy-loading for dashboard tabs

- Add path-based tab navigation (/p/{pid}/dashboards/{did}/tab/{slug})
- Only process widgets for the active tab (lazy loading)
- Use htmx to fetch tab content dynamically on tab switch
- Update URL in browser when switching tabs (linkable tab URLs)
- Re-initialize GridStack after htmx swaps new tab content
- Active tab indicator updates via hyperscript on htmx:afterOnLoad
- Redirect legacy query-param based URLs to path-based format

* Auto-format code with fourmolu

* feat(dashboard): add active tab name to page breadcrumbs

- Add pageTitleSuffix field to BWConfig for breadcrumb extensions
- Show current tab name in breadcrumbs (Dashboards > Dashboard Title > Tab Name)
- Use htmx out-of-band swap to update breadcrumb when switching tabs
- Breadcrumb updates automatically when navigating between tabs via htmx

* Auto-format code with fourmolu

* feat(dashboard): add ability to rename tabs via breadcrumb click

- Add pageTitleSuffixModalId to BWConfig for tab rename modals
- Make tab name in breadcrumb clickable to open rename modal
- Add TabRenameForm and TabRenameRes types for form handling
- Add dashboardTabRenamePatchH handler to update tab names
- Add tab rename modal to dashboard page
- Redirect to new tab slug URL after rename
- Add "Rename tab" option to context menu dropdown

* refactor(dashboard): extract common processing logic and address code review

- Extract processConstantsAndExtendParams helper to reduce duplication
- Extract mkWidgetProcessor helper for widget processing with dashboard ID
- Add activeTabSlugKey constant to replace magic string "activeTabSlug"
- Fix potential race condition: use requestAnimationFrame instead of setTimeout
- Mark unused dashVM as _dashVM in dashboardTabContentGetH

* Auto-format code with fourmolu

* refactor(dashboard): simplify code and remove redundancy

- Remove redundant tabNameToSlug wrapper, use slugify directly
- Simplify getDefaultTabSlug using fmap and viaNonEmpty
- Extract breadcrumbSuffixOob_ helper for OOB breadcrumb swaps
- Remove unnecessary main widgets processing in dashboardTabGetH
  (tab-based dashboards don't need dash.widgets processed)

* fix(dashboard): remove redundant lambda in mkWidgetProcessor (hlint)

* refactor(dashboard): improve code succinctness per review

- Use point-free style in findTabBySlug
- Simplify processConstantsAndExtendParams with <&>
- Make mkWidgetProcessor point-free with fmap and lens
- Use lens ix for tab name update instead of zipWith
- Extract queryStringFrom helper for query string construction

* fix: resolve type errors and remove SET TRANSACTION warning

- Fix type signatures for processConstantsAndExtendParams and mkWidgetProcessor to use ATAuthCtx
- Fix ambiguous record update using lens syntax
- Make faSprite_ and breadcrumbSuffixOob_ polymorphic for ToHtml instance
- Remove unnecessary SET TRANSACTION READ ONLY that caused warnings

* parallel widget processing in dashboards. and adding consts to the query params

* Auto-format code with fourmolu

* fix(dashboard): add tab loading indicators and fix OOB breadcrumb on initial load

- Add per-tab loading spinner indicators
- Only include OOB breadcrumb swap for HTMX partial loads, not full page loads

* perf(dashboard): optimize tab switching performance

- Replace widget retry loops with widgetDepsReady flag pattern
- Remove duplicate tooltip initialization (afterSwap + afterSettle → afterSettle only)
- Add HTMX view transitions for smoother tab swaps
- Use htmx:afterSettle instead of afterSwap for GridStack init

* fix: address code review feedback

- Add READ ONLY transaction wrapper for user SQL queries (security)
- Fix tab rename to use OOB swap + history.replaceState instead of HX-Redirect

* revert: remove SQL transaction and tab rename changes

* fix: rename children to childWidgets to avoid shadowing lens import

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-01-03 21:55:15 +01:00
Anthony Alaribe
4af007eb65
Add KQL support for latency percentile queries (#255)
* Add KQL percentiles() function for latency percentile queries

- Add Percentiles aggregation function to Stats.hs that generates
  p50, p75, p90, p95, p99 percentiles with optional divisor for
  unit conversion (e.g., percentiles(duration, 1e6) for ns to ms)
- Update Parser.hs to generate LATERAL unnest SQL pattern when
  percentiles() is used in summarize queries
- Update Log.hs to use KQL query instead of raw SQL for latency
  percentiles widget
- Update dashboard YAML files to use KQL percentile queries:
  - opentelemetry-tracing.yaml
  - endpoint-stats.yaml
  - mysql.yaml
  - postgresql.yaml
  - apache.yaml
  - cloudflare.yaml

This reduces SQL boilerplate significantly and makes percentile
queries much more readable and maintainable.

* Auto-format code with fourmolu

* Update KQL percentile/percentiles to match Microsoft KQL syntax

Update the implementation to match Microsoft KQL semantics:
- percentile(expr, percentile) - single percentile value
- percentiles(expr, p1, p2, p3, ...) - multiple custom percentile values

Key changes:
- Parser now accepts explicit percentile values (e.g., 50, 75, 90, 95)
- If last value > 100, it's treated as a divisor for unit conversion
- SQL generation dynamically builds ARRAY based on specified percentiles
- Dashboard queries now use explicit percentile values

Examples:
  percentile(duration, 95) - single 95th percentile
  percentiles(duration, 50, 75, 90, 95) - multiple percentiles
  percentiles(duration, 50, 75, 90, 95, 1e6) - with divisor for ns->ms

* Match Microsoft KQL syntax for percentile/percentiles functions

Update the implementation to exactly match Microsoft KQL semantics:
- percentile(expr, percentile) - single percentile value
- percentiles(expr, p1, p2, ...) - multiple percentile values

Now supports expressions in the first argument for unit conversion:
  percentiles(duration / 1e6, 50, 75, 90, 95)

Key changes:
- Add SubjectExpr type to support field / number and field * number
- Parser accepts expression as first arg, then percentile values
- No more magic divisor detection - use explicit expressions
- Dashboard queries updated to use proper expression syntax

Examples matching Microsoft KQL:
  percentile(duration, 95)
  percentiles(duration, 50, 75, 90, 95)
  percentiles(duration / 1e6, 50, 75, 90, 95, 99)

* Auto-format code with fourmolu

* Fix chart widget query updates and combine where clauses

- Fix event dispatch in query-editor.ts: dispatch update-query to window
  so chart widgets receive query change events
- Fix Parser.hs: combine multiple where clauses with AND instead of
  replacing them, so filters like "service == X | duration != null"
  correctly apply both conditions
- Add combineWhereClause helper function
- Add unit test for combined where clause behavior
- Refactor Stats.hs: extract setAlias helper for namedAggregation

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-01-01 18:24:49 +01:00
Yussif Mohammed
377a63d650 fix flamegraph and waterfall charts 2025-12-25 06:41:20 +00:00
Yussif Mohammed
ae8749354b fix anomaly session replay rendering 2025-12-24 17:35:47 +00:00
Yussif Mohammed
cc51fda8a6
Alerts view & Error details page (#225)
* towards supporting teams in projects.

* Auto-format code with fourmolu

* improve team list

team view side page, alerts and dashbaord next

yeah well

validation checks and fixes

tiny details improvments

prepare endpoints for testing

Auto-format code with fourmolu

towards tests

Auto-format code with fourmolu

rm monoscope-test

more tests cases

Auto-format code with fourmolu

alerts page improvements bug fixes and teams link

Auto-format code with fourmolu

feat: alerts section, teams.

send notifications

Auto-format code with fourmolu

fix errs and slack install

Auto-format code with fourmolu

towards table component

Auto-format code with fourmolu

dashbaord bulk actions delete

dashboards with teams

team dashboard

Auto-format code with fourmolu

feat: teams bulk actions delete

Auto-format code with fourmolu

feat: add title field & teams to dashboard modal

Auto-format code with fourmolu

* remove stack files and configure hie.yaml for better IDE support

Auto-format code with fourmolu

fix and passing tests

Auto-format code with fourmolu

add dashboards spec

Auto-format code with fourmolu

notifications templates

query viz and alert notifications

Auto-format code with fourmolu

alert config stuff

fixes and towards issue detail page

Auto-format code with fourmolu

Reorganize project structure

Move config files to config/ directory (tailwind.config.js, workbox-config.js, weeder.toml). Move documentation to docs/ (DEVELOPMENT.md, DOCKER_COMPOSE_README.md). Update all references in Dockerfile, Makefile, tailwind.css, and documentation.

Fix CI disk space exhaustion by cleaning up unnecessary files and build artifacts

Optimize CI caching strategy to reduce disk usage

Use separate caches per test suite and cache only essential build
artifacts instead of entire dist-newstyle directory. This reduces
disk usage while maintaining fast compilation through effective caching.

Fix CSS build in deployment by using correct Tailwind v4 CLI

The project uses Tailwind CSS v4 syntax (@import, @source, @plugin
directives) but the build commands were using the old v3 CLI which
doesn't process v4 syntax correctly, causing CSS changes to not appear
in deployed builds.

Updated Dockerfile and CI workflows to use @tailwindcss/cli instead of
the legacy tailwindcss command, and removed the obsolete -c config flag
since v4 uses @config directive in the CSS file.

Use npx tailwindcss instead of @tailwindcss/cli for v4 compatibility

The tailwindcss package (v4.1.13) in devDependencies is the correct CLI
for Tailwind v4. Using @tailwindcss/cli was unnecessarily specific and
may have caused issues in the Docker build environment.

This ensures the CSS with all custom utilities (surface-raised, etc.)
builds correctly in production.

Cherry pick files (#232)

* cherry pick files

* Auto-format code with fourmolu

* add more files

* Auto-format code with fourmolu

* finx undefined var

* review changes

* Auto-format code with fourmolu

* discord channel' type rename

* Auto-format code with fourmolu

* claude rec fixes

* Auto-format code with fourmolu

* fix notification typo

* Auto-format code with fourmolu

* discord get channel log error

* fix typo

* rm reswap related code from System.Types.hs

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com>

Teams rebased (#233)

* towards supporting teams in projects.

* Auto-format code with fourmolu

* fix htmx json encoder extension

* improve team list

* team view side page, alerts and dashbaord next

* yeah well

* validation checks and fixes

* tiny details improvments

* prepare endpoints for testing

* Auto-format code with fourmolu

* towards tests

* Auto-format code with fourmolu

* rm monoscope-test

* fix alert creation

* more tests cases

* Auto-format code with fourmolu

* alerts page improvements bug fixes and teams link

* Auto-format code with fourmolu

* feat: alerts section, teams.

* send notifications

* Auto-format code with fourmolu

* fix errs and slack install

* Auto-format code with fourmolu

* add teams column to dashboards table

* towards table component

* Auto-format code with fourmolu

* dashbaord bulk actions delete

* dashboards with teams

* team dashboard

* Auto-format code with fourmolu

* fix table

* feat: teams bulk actions delete

* Auto-format code with fourmolu

* feat: add title field & teams to dashboard modal

* Auto-format code with fourmolu

* remove stack files and configure hie.yaml for better IDE support

* Auto-format code with fourmolu

* fix and passing tests

* Auto-format code with fourmolu

* add more tests

* add dashboards spec

* Auto-format code with fourmolu

* fix pull request workflow

* fix: review change requests

* Auto-format code with fourmolu

* feat: tagify consolidation

* Auto-format code with fourmolu

* updates

* simplifications and other changes

* background changes and fixes

* Auto-format code with fourmolu

* package yaml

* Auto-format code with fourmolu

* fix typo

* towards supporting teams in projects.

* Auto-format code with fourmolu

* improve team list

* team view side page, alerts and dashbaord next

* yeah well

* validation checks and fixes

* tiny details improvments

* prepare endpoints for testing

* Auto-format code with fourmolu

* towards tests

* Auto-format code with fourmolu

* rm monoscope-test

* more tests cases

* Auto-format code with fourmolu

* alerts page improvements bug fixes and teams link

* Auto-format code with fourmolu

* feat: alerts section, teams.

* send notifications

* Auto-format code with fourmolu

* fix errs and slack install

* Auto-format code with fourmolu

* add teams column to dashboards table

* towards table component

* Auto-format code with fourmolu

* dashbaord bulk actions delete

* dashboards with teams

* team dashboard

* Auto-format code with fourmolu

* feat: teams bulk actions delete

* Auto-format code with fourmolu

* feat: add title field & teams to dashboard modal

* Auto-format code with fourmolu

* remove stack files and configure hie.yaml for better IDE support

* Auto-format code with fourmolu

* fix and passing tests

* Auto-format code with fourmolu

* add more tests

* add dashboards spec

* Auto-format code with fourmolu

* fix: review change requests

* Auto-format code with fourmolu

* feat: tagify consolidation

* Auto-format code with fourmolu

* updates

* simplifications and other changes

* background changes and fixes

* Auto-format code with fourmolu

* package yaml

* Auto-format code with fourmolu

* Migrate to master's Table API

  - Update dashboards and teams tables to use new column-based API
  - Replace ItemsList.ItemsRows with Table.TableRows
  - Add missing validateTeamDetails function
  - Fix import conflicts

* Migrate to master's Table API and fix migration idempotency

- Update dashboards and teams tables to use new column-based API
- Replace ItemsList.ItemsRows with Table.TableRows
- Add missing validateTeamDetails function
- Fix import conflicts (Wreq.header ambiguity)
- Add IF NOT EXISTS to index creation in teams migration

* Add frosted glass backdrop to modals

- Add backdrop-filter blur effect to .modal-backdrop class
- Applies 8px blur for frosted glass effect
- Includes webkit prefix for browser compatibility

* Remove padding from table container

- Remove px-6, pt-4, and pb-16 from containerClasses
- Table now renders edge-to-edge without padding

* Add padding to non-settings page content

- Remove padding from Table component's default containerClasses
- Add px-6 pt-4 pb-16 wrapper for non-settings pages in BodyWrapper
- Settings pages (Teams, etc.) remain without extra padding

* Remove duplicate padding from dashboards list page

- Remove pb-2 px-6 pt-8 from itemsListPage div
- Padding now comes from BodyWrapper parent wrapper
- Avoids double padding on dashboards list

* Align dashboard button and table checkbox with page header

* Fix double padding issue with standardized table padding system

- Remove global padding wrapper from BodyWrapper to fix double padding
- Add addPadding config option to Table component
- Update table pages to use addPadding: Dashboards, API Catalog, Issues, Monitors
- Standardize all table padding to px-6 pt-4 pb-2
- Update Monitors page section padding to match standard

* fix tables and compilation

* Auto-format code with fourmolu

* fix dulicate line

* Auto-format code with fourmolu

* fix build

* Refactor FromJSON instances to use deriving strategies

- Use deriving via with DAE.Rename for field name transformations

- Use deriving via with DAE.StripSuffix for simple underscore removal

- Extract SlackEventPayload constructors into separate record types

- Simplify TeamForm to use deriving anyclass for internal API

- Remove unused imports

Code reduction: ~80 lines of manual JSON parsing boilerplate eliminated

* Auto-format code with fourmolu

* Add team validation and permission checks

- Add admin-only restriction for team create/update
- Validate team members are project members
- Add email format validation for notification emails
- Add length limits to team name and handle
- Verify teams exist before adding to dashboards
- Extract dispatchTeamNotifications helper in BackgroundJobs
- Use TeamDetails record to simplify createTeam/updateTeam APIs
- Handle duplicate team handles with ON CONFLICT DO NOTHING

* Auto-format code with fourmolu

* Refactor teams feature with comprehensive improvements

Code Quality & Type Safety:

- Refactor createTeam/updateTeam to use TeamDetails record type

- Add compile-time safety with NonEmpty for softDeleteProjectMembers

- Standardize SQL array syntax (lowercase uuid[], consistent spacing)

- Add phone_numbers support to all team types and queries

Performance Optimizations:

- Optimize getTeamsVM/getTeamByHandle with LEFT JOIN + array_agg

- Use for_ instead of explicit null checks

Error Handling & Observability:

- Add logging for missing/deleted teams in monitor notifications

- Improve error handling for addTeamsToDashboards

- Add graceful fallback when configured teams are deleted

Code Cleanup:

- Extract dispatchTeamNotifications helper function

- Remove redundant project query

- Use idiomatic Haskell patterns

* Auto-format code with fourmolu

* Fix variable shadowing in email validation

* Refactor for code succinctness

- Simplify NonEmpty to Vector conversion (remove redundant toList)

- Extract handleQueryMonitorThreshold into focused helper functions

- Add logMissingTeams for team logging

- Add createAndInsertIssue for issue creation

- Add calculateThreshold for threshold calculation

- Add buildMonitorAlert for alert construction

- Add sendNotifications for notification dispatch

- Add sendFallbackNotifications for fallback handling

* Auto-format code with fourmolu

---------

Co-authored-by: Yussif Mohammed <yousiph77@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

towards supporting teams in projects.

Auto-format code with fourmolu

improve team list

validation checks and fixes

tiny details improvments

Auto-format code with fourmolu

towards tests

Auto-format code with fourmolu

more tests cases

Auto-format code with fourmolu

* alerts page improvements bug fixes and teams link

Auto-format code with fourmolu

feat: alerts section, teams.

send notifications

Auto-format code with fourmolu

fix errs and slack install

Auto-format code with fourmolu

towards table component

Auto-format code with fourmolu

dashbaord bulk actions delete

dashboards with teams

Auto-format code with fourmolu

feat: teams bulk actions delete

Auto-format code with fourmolu

feat: add title field & teams to dashboard modal

Auto-format code with fourmolu

remove stack files and configure hie.yaml for better IDE support

Auto-format code with fourmolu

fix and passing tests

Auto-format code with fourmolu

add dashboards spec

Auto-format code with fourmolu

alert config stuff

fixes and towards issue detail page

rmv duplicate declarations

Auto-format code with fourmolu

fix resizer

Auto-format code with fourmolu

make project compile/fix errors

* Auto-format code with fourmolu

feat: use log-list virtual table for monitor history tab

Auto-format code with fourmolu

fix issue detail tabs

Auto-format code with fourmolu

clean up unused imports

Auto-format code with fourmolu

parameterized trace/span sql queries

fix unkwon stack typo

more unused imports cleanup

Auto-format code with fourmolu

remove commented logs

Rebase onto master, resolve conflicts with master changes

fix tests after recent changes to alerts view

fix tests after changing ManageMembers handlers to return ProjectId

remove monoscope-test

towards fixing tests

Auto-format code with fourmolu

fix: sort starred dashboards first and add chart padding

- Dashboard list now always shows starred/favorited items at the top regardless of the selected sort option (newest, oldest, A-Z, etc.)

- Added p-2 padding to widget chart container to prevent bleeding edges

fix: exclude p-2 padding for timeseries_stat widgets

fix: dashboard variable tagify inputs not initializing correctly

- Update createTagify to accept both selector strings and DOM elements

- Wrap dashboard variable tagify init in DOMContentLoaded event

- Remove overflow-hidden from variable fieldset to allow dropdown display

fix: remove unnecessary border wrapper from table component

Auto-format code with fourmolu

towards fixing integration tests

Auto-format code with fourmolu

* fix more errors

* Auto-format code with fourmolu

* claude req fixes

* Auto-format code with fourmolu

* fix table

* Auto-format code with fourmolu

* bring back removed page due to rebase

* Auto-format code with fourmolu

* rm unused imports

* fix failing delim queries in BackgroundJobs.hs

* Auto-format code with fourmolu

* fix build after rebase

* Auto-format code with fourmolu

* test final fix

* rm log attention

* add index for first_trace_id and recent_trace_id in errors table

* fix index creation in 0019_add_trace_id.sql

* remove concurrently index

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-23 17:54:20 +01:00
Anthony Alaribe
97a1000903 fix: dashboard variable tagify inputs not initializing correctly
- Update createTagify to accept both selector strings and DOM elements

- Wrap dashboard variable tagify init in DOMContentLoaded event

- Remove overflow-hidden from variable fieldset to allow dropdown display
2025-12-20 01:44:16 +01:00
Anthony Alaribe
5cd948697f
Teams improvement v2 (#234)
* Improve dashboards and teams UI with star functionality

- Add star/unstar functionality for dashboards with persistent state
- Update dashboard sorting to prioritize starred items
- Improve table component styling and layout
- Add icons for dashboards and teams in list views
- Streamline table columns and remove unnecessary checkboxes
- Update bulk actions to use new table component features

* Auto-format code with fourmolu

* Fix teams bulk actions to use itemId field

Update TBulkActionForm to use itemId instead of teamId to match
the Table component's standardized field name for bulk actions.

* Improve settings navigation layout and styling

- Reduce navigation width for better space utilization
- Update font sizes and spacing for cleaner appearance
- Improve icon styling with background colors
- Enhance navigation item padding and layout

* Refactor API keys page to use Table component and add client-side tab support

- Enhanced TabFilter component to support both client-side and server-side tabs
- Added clientSide boolean field to TabFilter for tab switching mode
- Added targetId field to TabFilterOpt for custom element targeting
- Refactored API keys page to use reusable Table component
- Updated all existing TabFilter usage to include new fields
- Improved consistency across table implementations

* Auto-format code with fourmolu

* nitpicks on

* add test for starring and unstarring, and dashboard default sorting

* Fix tagify scope issue in dashboard creation modal

The tagify variable was scoped inside DOMContentLoaded event listener,
causing a reference error when getSelectedTeams() tried to access it
during form submission. Moved declaration to outer scope.

* Fix gridStackInstance null error when adding dashboard widgets

* Fix teams badge WCAG contrast by using badge-neutral

* Fix compilation errors

- Fix do-notation errors by adding proper do blocks instead of using >> after $
- Rename local section_ helper to teamSection_ to avoid shadowing
- Remove unused ProjectId parameter from renderMonitorContent

* Use brackets instead of do-blocks for single-line expressions

- Keep code on one line by using parentheses and >> operator
- Applied to card_, notifRow_, lazySection_, teamSection_, field_, fieldIcon_ helpers

* Apply code formatting updates

- Replace font-mono with monospace class
- Minor whitespace adjustments

* Fix duplicate html assignment bug and simplify code

* Auto-format code with fourmolu

* Refactor tables to use standardized Table component with sorting

- Add containerId to Table Config for HTMX targeting
- Add renderAsTable mode for proper table rendering
- Add rowId and rowAttrs to TableRows for load-more consistency
- Fix th elements to include column attrs for alignment
- Fix class concatenation spacing in table headers
- Fix scrolling in BodyWrapper (overflow-y-hidden to overflow-y-auto)
- Add sort parameter to Issues.selectIssues
- Refactor Anomalies and ApiCatalog to use TableHeaderActions
- Remove flex classes from table cells

* Auto-format code with fourmolu

* Fix table load more by moving pagination inside tbody

- Move pagination link inside tbody for table mode (as a <tr>)
- Add renderTablePaginationLink with hx-target='closest tr'
- Add id to tbody for targeting
- Pagination row gets replaced with new rows + new pagination row

* Refactor Anomalies table to use built-in checkbox

- Remove custom checkbox column (use table's rowId feature instead)
- Add status indicator dot to Issue column title row
- Update TableRows to use proper rowId for load more

* Auto-format code with fourmolu

* Fix Anomalies issue column layout structure

- Fix indentation so metadata, stats, actions are separate blocks
- Status indicator dot in title row
- Condense code using single-line patterns where appropriate

* Auto-format code with fourmolu

* Merge renderPaginationLink and renderTablePaginationLink into single function

* Auto-format code with fourmolu

* Align row checkboxes to top and add vertical padding to issue column

* Improve settings sidebar: larger text, neutral icons, stronger selection highlight

* Widen settings sidebar

* Fix hlint warnings

* Fix all hlint warnings across codebase

* Auto-format code with fourmolu

* Fix GHC warnings: dodgy import, name shadowing, unused do-bind

* Use foldMap and zipWithM_ for cleaner iteration patterns

* Extract columnCount helper and add error handling for processVariable

* Auto-format code with fourmolu

* Optimize URL construction and use single-pass fold for change counting

* Extract issueTypeBadge helper to reduce code duplication

* Fix SQL injection vulnerabilities and semantic error in change counting

* Auto-format code with fourmolu

* Simplify SQL validation and remove redundant variable

* Auto-format code with fourmolu

* Rename selectDashboardsSorted to selectDashboardsSortedBy for clarity

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-19 23:44:55 +01:00
Yussif Mohammed
a85be17184
Cherry pick files (#232)
* cherry pick files

* Auto-format code with fourmolu

* add more files

* Auto-format code with fourmolu

* finx undefined var

* review changes

* Auto-format code with fourmolu

* discord channel' type rename

* Auto-format code with fourmolu

* claude rec fixes

* Auto-format code with fourmolu

* fix notification typo

* Auto-format code with fourmolu

* discord get channel log error

* fix typo

* rm reswap related code from System.Types.hs

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com>
2025-12-18 12:13:39 +01:00
Anthony Alaribe
352bd95a31 Fix widget height overflow in nested grid layouts
Adds min-h-0 to flex containers to prevent content from pushing widgets beyond their allocated height. Also restores bottom alignment for stat widgets and includes minor UI improvements.
2025-12-17 20:20:47 +01:00
Anthony Alaribe
b81b257306 add enterprise to the onboarding 2025-12-17 15:43:37 +01:00
Anthony Alaribe
2d893b8520
Fix Platform colors to reduce eye strain (#231)
* Fix badge-neutral contrast for better readability

* Remove unused CSS utilities and variables

* Adjust dark mode to premium blue aesthetic

- Darker backgrounds (15-18% vs 18-22%) for high-quality look
- Maintains visible blue tint with 0.020 chroma
- Improved text contrast ratios (textStrong: 14.58:1)
- All combinations pass WCAG AA standards

* Add surface-raised utility class for elevated surfaces

- Created .surface-raised class with bgRaised, border, and shadow
- Applied to project cards for better contrast against background
- Applied to all tables (API Catalog, Issues, etc.) via Table component
- Fixed monitor alert icons padding for uniform appearance
- Provides consistent raised platform aesthetic across the app

* revert color

* Enhance surface-raised with dimensional lighting effects

Add subtle gradient and inset shadows for 3D depth, update background
to use fillWeaker color, and apply surface-raised utility to widgets.

* Replace card-round with surface-raised for consistency

Apply surface-raised styling to all cards including stat boxes, list items,
and anomalies widget. Remove unused card-round CSS class.
2025-12-17 11:51:37 +01:00
Anthony Alaribe
e212df0b96
Tests in prs. And fix hlint warnings and failing UI tests (#230)
* Enable tests and hlint in pull request workflow

- Add hlint job to run on all PRs

- Make test jobs run even if build fails (using if: always())

- Fix shadowing binding in Table.hs colAttrs function

- Fix LLM.hs type error by using langchain-hs standard pattern

- Fix TypeScript error in log-worker-functions.ts with optional chaining

This ensures CI checks run independently and provide feedback even when some jobs fail.

* Convert PR workflow from stack to cabal

- Replace stack with cabal commands throughout

- Update caching to use dist-newstyle and ~/.cabal/store

- Use awalsh128/cache-apt-pkgs-action for system deps

- Set OpenSSL env vars properly for GitHub Actions

- Add fail-fast: false to test matrix

- Add ::group:: annotations for better log organization

* Revert LLM.hs changes - they were stack-related, not actual bugs

* minor linting error

* run hlint refactor in prs

* Apply hlint fixes across codebase

Fixed 239 hlint warnings: use toText, simplify encoding chains, replace fromMaybe with maybe, use ordNub, convert to guards, use unless, eta reduction, list comprehensions, newtype conversions, and remove unused imports. Updated .hlint.yaml to allow flexible imports for Data.List and Data.Aeson.

* Auto-format code with fourmolu

* Fix UI test failures in GitHub Actions

Update Node.js version from 18 to 20 to satisfy happy-dom requirement

Add CSS.escape mock for Monaco Editor theme initialization

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-17 00:34:01 +01:00
Yussif Mohammed
c6f486b7df fix duplicate log list items 2025-11-28 19:55:31 +00:00
Yussif Mohammed
e76aef2f36 fix chart zoom 2025-11-28 10:12:05 +00:00
Yussif Mohammed
502c46e6d7 fix build and redundant imports 2025-11-28 09:44:32 +00:00
Yussif Mohammed
585f73b005 feat: auto resize flamegraph chart 2025-11-25 21:38:12 +00:00
Anthony Alaribe
6a9ec7dcc8
Support the has_all and has_any operators, then Remove flamegraph widget and increase recent traces height (#209)
* Support the has_all and has_any operators

* Remove flamegraph widget and increase recent traces height in overview dashboard
2025-11-23 14:25:27 +01:00
Yussif Mohammed
009d6e96ad feat: traces widget flame graph 2025-11-22 07:54:00 +00:00
Yussif Mohammed
1d802334df make flamegraph flexible and fix view parent trace 2025-11-22 06:48:44 +00:00
Anthony Alaribe
f6a0ca6ca0 increase virtual list work timeout duration 2025-11-15 05:54:10 +00:00
Yussif Mohammed
343cc3f665 fix flamegraph colors 2025-11-05 18:57:57 +00:00
Anthony Alaribe
6efccdecb3 fix sizing inconsistencies 2025-11-02 14:34:48 +01:00
Anthony Alaribe
ab5bb2b369 fix bug so the visual range is displayed on chart load 2025-11-02 13:17:47 +01:00
Anthony Alaribe
94bfe42f81 more transparent mark area 2025-11-02 12:59:09 +01:00
Anthony Alaribe
16d87ac16b fix the issue of latency widths starting as wider than they actually should be, and resizing on scroll 2025-11-01 18:21:18 +01:00
Anthony Alaribe
7cbc95e917 fix the issue of latency widths starting as wider than they actually should be, and resizing on scroll 2025-11-01 18:20:25 +01:00
Anthony Alaribe
92bd57a47e add the color to new rows as an indicator 2025-11-01 15:34:05 +01:00
Anthony Alaribe
f66ce4e6d5 fix query for streaming in new data. set the from query param, not to 2025-11-01 15:11:13 +01:00
Anthony Alaribe
acb1b658e0 Fix issue where when a query is deleted, the suggestions don't get triggered. 2025-11-01 14:48:48 +01:00
Anthony Alaribe
b97b0e9273 remove some unused code and optimize height calc for query-editor 2025-11-01 14:12:00 +01:00
Anthony Alaribe
0bd66375ac remove some of the perf measures temporarily 2025-11-01 13:57:09 +01:00
Anthony Alaribe
8c4045e001 disable expensive monaco configs 2025-11-01 13:52:30 +01:00
Anthony Alaribe
a125d7f187 more regex optimizations 2025-11-01 13:45:18 +01:00
Anthony Alaribe
011781ae5f remove unused query-editor functions 2025-11-01 13:29:58 +01:00
Anthony Alaribe
81321acb9c only trigger the query event with a 500ms debounce and if the query has changed 2025-11-01 13:18:55 +01:00
Anthony Alaribe
07705b0510 prepare the regexes and reuse them to improve performance on keypress 2025-11-01 13:00:39 +01:00
Anthony Alaribe
42a7a30261 fix the cursor handling logic for query logs. And add performance logic and checks so we can find out whats making the query-editor sluggish 2025-10-31 18:11:11 +01:00
Anthony Alaribe
dc83b7627b remove query editor debounce delays 2025-10-31 18:11:10 +01:00
Anthony Alaribe
aed4a49fda reduce the render times. 2025-10-29 14:57:23 +01:00