monoscope/docs
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>
History 2026-01-09 23:38:28 +01:00
..
plans Kql update (#276) 2026-01-09 23:38:28 +01:00
alerts.md Refactor documentation structure for better organization and clarity 2025-11-23 22:41:44 +01:00
anomaly-detection-system.md rename project to monoscope 2025-09-14 19:55:26 +02:00
anomaly-detection-testing-guide.md rename project to monoscope 2025-09-14 19:55:26 +02:00
anomaly-detection-triggers.sql document more of the anomaly detection process 2025-09-08 20:47:05 +02:00
architecture.md Refactor documentation structure for better organization and clarity 2025-11-23 22:41:44 +01:00
configuration.md Refactor documentation structure for better organization and clarity 2025-11-23 22:41:44 +01:00
DEVELOPMENT.md Reorganize project structure 2025-12-17 00:49:42 +01:00
DOCKER_COMPOSE_README.md Reorganize project structure 2025-12-17 00:49:42 +01:00
email-sequence.md Swap gRPC and HTTP order in example 2025-11-26 17:54:52 +01:00
getting-started.md Refactor documentation structure for better organization and clarity 2025-11-23 22:41:44 +01:00
kql-reference.md Add KQL operators: extend, project, round, tofloat, toint, tostring (#275) 2026-01-08 15:26:32 +01:00
kubernetes.md Refactor documentation structure for better organization and clarity 2025-11-23 22:41:44 +01:00
monoscope.png Add Monoscope logo assets for email sequence 2025-11-26 00:36:21 +01:00
monoscope.svg Add Monoscope logo assets for email sequence 2025-11-26 00:36:21 +01:00