Commit graph

26 commits

Author SHA1 Message Date
Karl Power
bc8c4eec9a
feat: allow applying session settings to queries (#1609)
Closes HDX-3154

This PR adds a feature that allows the user to add settings to a source. These settings are then added to the end of every query that is rendered through the `renderChartConfig` function, along with any other chart specific settings. 

See: https://clickhouse.com/docs/sql-reference/statements/select#settings-in-select-query

Most of the work was to pass the `source` or `source.querySettings` value through the code to the `renderChartConfig` calls and to update the related tests. There are also some UI changes in the `SourceForm` components.

`SQLParser.Parser` from the `node-sql-parser` throws an error when it encounters a SETTINGS clause in a sql string, so a function was added to remove that clause from any sql that is passed to the parser. It assumes that the SETTINGS clause will always be at the end of the sql string, it removes any part of the string including and after the SETTINGS clause.


https://github.com/user-attachments/assets/7ac3b852-2c86-4431-88bc-106f982343bb
2026-01-21 16:07:30 +00:00
Drew Davis
f98fc51946
perf: Query filter values from MVs (#1591)
Closes HDX-3066

# Summary

This PR improves the performance of Search and Dashboard filters by querying available filter values from materialized views, when possible. The existing `useMultipleGetKeyValues` has been updated to make use of `getKeyValuesWithMVs`, which works as follows:

1. Identify which materialized views support each of the requested keys. Keys must be `dimensionColumns` in the materialized view, the materialized view must support the provided date range, and the materialized view must support the provided filters (determined by running an EXPLAIN query).
2. Split the keys into groups based on which Materialized view can provide their values. Query values for each group using the existing `getKeyValues` function. Sampling is disabled because it is assumed that MVs are small enough to be queried without sampling.
3. Query any keys which are not supported by any materialized view from the base table.

To reduce the number of EXPLAIN queries required to support this, and to generally decrease the number of concurrent requests for filters, Dashboard filter value queries are now batched by source. Values for each batch are then queried using `getKeyValuesWithMVs` (described above).

Other fixes:
1. I've also updated the various filter functions and hooks to support abort signals, so that filter queries are canceled when a query value is no longer needed.
2. The getKeyValues cache key now includes `where` and `filters`, so that the filter values correctly update when new filters or where conditions are added on the search page.
2026-01-14 18:05:11 +00:00
Drew Davis
f39fcdac6a
fix: Refresh metadata after creating new connection in local mode (#1582) 2026-01-13 07:55:12 -05:00
Brandon Pereira
43dfb3aaff
chore to move critical path files (#1314)
moves them into a core folder, this allows us to easily track when core files are modified via path

no changeset because no version bump required

fixes HDX-2589
2025-10-30 15:16:33 +00:00
Drew Davis
daffcf3594
feat: Add percentages to filter values (#1250)
# Summary

Closes HDX-1960

This PR adds a button to our search filters component which can be used to show the _approximate_ percentage of rows which have each filter value.

https://github.com/user-attachments/assets/2dba1b28-d2b9-4414-986c-0c515d252c89

Notes:
- The percentages are based on a sample of 100k rows. The sampling is done similarly to how EE version samples logs for patterns.
- We only fetch the most common 100 values in the sample. All other values are assumed to represent <1% of the data.
- The percentages represent the distribution within the dataset after it has been filtered by the selected filters and the where clause.
- This is a potentially expensive query, even with sampling, so the percentages are only queried if they're toggled on for a particular filter, and do not refresh in live mode. They do refresh if the search or date ranges changes (outside of live mode).
2025-10-09 19:26:39 +00:00
Aaron Knudtson
5210bb86a4
refactor: table connections standardized and single by default. Special case for dashboard (#1195)
Closes HDX-2469
2025-10-02 21:33:53 +00:00
Warren
8f06ce7b33
perf: add prelimit CTE to getMapKeys query + store clickhouse settings in shared cache (#1201)
Optimize the query performance of the getMapKeys method to prevent excessive resource usage in ClickHouse, even when max_rows_to_read is specified.

Ref: HDX-2411
Ref: HDX-2431
2025-09-24 00:42:26 +00:00
Aaron Knudtson
8673f967c5
Revert "Revert "fix: json getKeyValues (useful for autocomplete) (#1186)"" (#1199)
Reverts hyperdxio/hyperdx#1190
2025-09-23 19:02:18 +00:00
Tom Alexander
68f46e0a72
Revert "fix: json getKeyValues (useful for autocomplete) (#1186)" (#1190)
This reverts commit d60d92030d.

Commit breaks dashboards with: 
<img width="1179" height="779" alt="image" src="https://github.com/user-attachments/assets/bcb05f7a-6787-4a39-859f-92e6f6ffbe9e" />
2025-09-20 02:17:50 +00:00
Aaron Knudtson
d60d92030d
fix: json getKeyValues (useful for autocomplete) (#1186)
Ref HDX-2034
2025-09-19 16:49:12 +00:00
Anirudh
82a31194e4
fix(json-type): add support for JSON columns in the service dashboard (#1024)
Co-authored-by: Aaron Knudtson <87577305+knudtty@users.noreply.github.com>
2025-08-08 17:02:24 +05:30
Warren
b568b0016a
feat: introduce team 'clickhouse-settings' endpoint + metadataMaxRowsToRead setting (#1054)
1. Merge all clickhouse client setting related endpoints into one `/clickhouse-settings` plus controllers
2. Add tooltips to the setting UIs
3. Introduce `metadataMaxRowsToRead` setting for tweaking metadata query perf

Ref: HDX-2075
Related: HDX-2023

<img width="871" height="374" alt="image" src="https://github.com/user-attachments/assets/1824452f-8045-430d-9e26-5d31bcf38dcf" />
2025-08-07 23:54:35 +00:00
Aaron Knudtson
1dc1c82d5d
feat: team setting to disable fetching field metadata (#1034)
Closes HDX-2068

Allows a team to disable fetching field metadata across the app. Fetching is enabled by default. Here's the setting:
<img width="1115" height="346" alt="image" src="https://github.com/user-attachments/assets/100e5ae9-6946-4215-a418-295294154452" />

And here's what it looks like when the setting is disabled:
<img width="1627" height="829" alt="image" src="https://github.com/user-attachments/assets/0d020901-4b68-4239-baf3-f1c040074400" />

Notice that autocomplete is doing nothing and filters are not loaded
2025-07-29 18:01:26 +00:00
Mike Shi
3bb11afbd5
fix: Allow users to disable field fetching (#1031) 2025-07-29 13:59:47 +00:00
Aaron Knudtson
4581a68a0b
fix: queries firing before having a table or connection id (#1003) 2025-07-16 11:30:25 -05:00
Aaron Knudtson
05fde2ea8f
Fix filter loading issues by searching over more rows and caching (#786)
Fixes: HDX-1562
Fixes: HDX-1575
2025-05-19 13:43:19 +00:00
Aaron Knudtson
092a292b60
fix: autocomplete for lucene column values (#720)
![image](https://github.com/user-attachments/assets/14048d5c-a88b-46ef-b15b-1412791923de)

Added autocomplete for potential search values for lucene where clauses.
Added testing for useAutoCompleteOptions and useGetKeyValues.

Ref: HDX-1509
2025-04-08 21:36:42 +00:00
Tom Alexander
fe5c6ea56f
fix: Fix issue with selecting existing connection (#725)
After #713 was merged, a bug was introduced which manifests when a user clicks an existing connection while editing a source.

The issue is that a helper function (`isSingleTableConnection`) was introduced to check to see if a single connection was passed or an array of connections was passed. In this function, it also checks the schema if a single object is passed, which can cause the function to return `false` if the schema isn't exact. This poses a problem because the downstream code will think that it is an array of connections and error out.

In this particular scenario, there was another bug where if a user clicks on a selected value in the source dropdown, it unselects that value and returns null, which is what triggered this error to begin with.

Therefore there are two fixes here:
1) Add an option to disable un-selection of dropdowns and set that to true for the source dropdown.
2) Remove the helper code `isSingleTableConnection` as its behavior is confusing to downstream consumers.

Ref: HDX-1557
2025-04-01 12:16:06 +00:00
Warren
decd622fdf
feat: introduce k8s preset dashboard - Pt2 (#719)
Ref: HDX-1543 + HDX-1545

- fix: k8s dashboard uptime metrics 
- fix: warning k8s event body
- feat: add side panel to warning events table
- perf: opt pods/nodes/namespaces logs table performance

<img width="1227" alt="Screenshot 2025-03-27 at 6 28 15 PM" src="https://github.com/user-attachments/assets/f222ca14-68f4-413c-9867-6f5a98aad025" />

<img width="488" alt="image" src="https://github.com/user-attachments/assets/e3076ec7-95c6-4e4b-a961-e7779d0a88ea" />
2025-03-28 20:44:38 +00:00
Aaron Knudtson
b99236d774
Fix autocomplete for (#713)
Added an override to provide fields as an input to SearchInputV2 (for lucene) and SqlInlineEditorControlled (for sql), instead of fetching in those respective components. This fixes autocomplete for fields on DBDashboardPage, which was not working previously. I have a fix for field values coming in a future PR.

![image](https://github.com/user-attachments/assets/93de4345-7e8d-4157-aaa1-d223ec49fc72)

![image](https://github.com/user-attachments/assets/c73eb00d-da0e-4fc3-adb4-3f9d2c600a70)

Ref: HDX-1471
2025-03-27 19:17:29 +00:00
Tom Alexander
ef34f97b6f
fix: Ensure we read more rows in order to get all metric names (#668)
The default max_rows_to_read clickhouse query setting was too low for the metrics table. Therefore, not enough rows were being scanned in order to fetch all possible metric names.

Ref: HDX-1451
2025-03-11 19:13:44 +00:00
Warren
5b2cba019e
feat: scrape local otelcol + clickhouse metrics (#633)
<img width="1329" alt="Screenshot 2025-02-25 at 5 26 06 PM" src="https://github.com/user-attachments/assets/ae54c3de-3e4c-4452-84ef-dda05d23c39e" />


<img width="1321" alt="Screenshot 2025-02-25 at 5 28 06 PM" src="https://github.com/user-attachments/assets/b3eab865-d6da-44da-a2fe-79a3797790f9" />
2025-02-26 03:13:05 +00:00
Warren
a483780ef6
style: move types from renderChartConfig + add exceptions types (#568) 2025-01-24 01:52:54 +00:00
Warren
a70080e533
style: use common utils package (api and app) (#555) 2025-01-21 18:44:14 +00:00
Mike Shi
990e62ce04
Use partition key in selecting search results (#525)
We now use the `partition_key` in helping narrow down a given row that's selected in the UI, which is necessary for large datasets where the `partition_key` is not already part of the `primary_key`

Fixes HDX-1281
2024-12-10 07:30:40 +00:00
Warren
b16456fc39 feat: move v2 codes 2024-11-12 05:53:15 -07:00