Commit graph

1439 commits

Author SHA1 Message Date
github-actions[bot]
af86da601e
Release HyperDX (#1955)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-27 13:26:45 -07:00
Brandon Pereira
c72d7baa7f
chore: resolve remaining knip issues (#1991)
## Summary

Resolve all remaining knip issues — removes unused exports/types, adds missing direct dependencies, deletes dead code, and updates knip config.

**Dependency fixes:**
- Root: swapped unused `eslint-config-next`/`eslint-plugin-react-hooks` for actually-imported `@eslint/js`, `typescript-eslint`, `tslib`
- App: added directly-used transitive deps (`@codemirror/*`, `react-resizable`, `postcss-simple-vars`, `rimraf`, `serve`, `@next/eslint-plugin-next`, `eslint-plugin-react`); removed unused `@storybook/react`

**Dead code removal:**
- Removed ~100 unused exports/types across api and app packages (removed `export` keyword where used locally, deleted entirely where not)
- Fixed duplicate `DBRowTableIconButton` default+named export; updated consumers to use named import

**knip.json updates:**
- Added `fixtures.ts` entry point and `opamp/**` ignore for api package
- Excluded `enumMembers` and `duplicates` issue types
- Enabled `ignoreExportsUsedInFile`

### How to test locally or on Vercel

1. `yarn install && yarn knip` — should produce zero output
2. `make ci-lint` — all packages pass
3. `make ci-unit` — all unit tests pass
2026-03-27 20:17:47 +00:00
Warren Lee
acd117abcf
[HDX-3840] Optimize alerthistories aggregation queries to reduce DocDB CPU load (#1997)
## Summary

- Replace chunked `$in` aggregations with per-alert queries to leverage compound indexes for index-backed sorting in DocumentDB
- Eliminate N+1 query pattern from the alerts API endpoint by adding a concurrency-controlled batch function

Linear: https://linear.app/clickhouse/issue/HDX-3840/docdb-ro-instances-high-cpu

## Problem

Two aggregation queries on the `alerthistories` collection were causing sustained high CPU on DocDB read-only instances:

1. **`getPreviousAlertHistories`** (runs every minute via check-alerts cron) — used `$match: {alert: {$in: [50 ids]}}` which breaks index-backed sort optimization on the compound index `{alert: 1, group: 1, createdAt: -1}`. With a 7-day lookback, each chunk scanned ~500K documents and required an in-memory sort. Additionally, `$first: '$$ROOT'` prevented projection pushdown, forcing full document fetches.

2. **`getRecentAlertHistories`** (called from `GET /alerts` API) — fired one aggregation query per alert (N+1 pattern), multiplying load on every page view.

## Changes

### `getPreviousAlertHistories` (`packages/api/src/tasks/checkAlerts/index.ts`)
- Replaced chunked `$in` batches (50 IDs per chunk) with **per-alert queries** using `PQueue({ concurrency: 20 })`
- Each query matches on a single `alert` value, so the compound index `{alert: 1, group: 1, createdAt: -1}` delivers results already sorted — no in-memory sort needed
- Replaced `$first: '$$ROOT'` with `$first: '$createdAt'` / `$first: '$state'` to allow projection pushdown (DocumentDB can avoid full document fetches)

### `getRecentAlertHistories` (`packages/api/src/controllers/alertHistory.ts`)
- Added `getRecentAlertHistoriesBatch()` — runs per-alert queries with `PQueue({ concurrency: 20 })` to control parallelism
- Each per-alert query uses the `{alert: 1, createdAt: -1}` index for a single-range scan

### Alerts API route (`packages/api/src/routers/api/alerts.ts`)
- Replaced N individual `getRecentAlertHistories` calls with a single `getRecentAlertHistoriesBatch` call

## Why per-alert queries instead of `$in`?

The `$in` operator on the leading field of a compound index produces multiple index range scans. The merged results are **not** globally sorted, forcing DocumentDB to perform an expensive in-memory sort. With per-alert queries, each query walks a single contiguous range in the index — sort is free, and `$group` + `$first` can short-circuit immediately per group.

## Testing

- All 14 integration tests pass (`make dev-int FILE=alertHistory.test`)
- Updated the batching test in `checkAlerts.test.ts` to verify per-alert query behavior
- Added 5 new tests for `getRecentAlertHistoriesBatch` covering batch results, empty histories, per-alert limits, and ALERT state detection
2026-03-27 14:47:20 +00:00
Warren Lee
56e60ef8c8
[HDX-3796] Isolate E2E test environment with slot-based port assignment (#1983)
## Summary

- Adds worktree-aware port isolation for E2E tests, mirroring the existing `dev-int` slot mechanism so multiple agents/developers can run E2E tests in parallel without port conflicts
- Fixes the navigation E2E test that was broken by Live Tail URL updates swallowing client-side navigation
- Adds `dev-e2e` Makefile target for running specific tests with `FILE=` and `GREP=` filters, plus `REPORT=1` to open the HTML report after tests finish

## Port Isolation

Each worktree gets a deterministic slot (0–99) computed from its directory name. All E2E service ports are offset by that slot in the **44000–50100** range, avoiding collisions with `dev` (4317–27017) and `dev-int` (14320–40098).

| Service | Base + slot | Variable |
|---|---|---|
| ClickHouse HTTP | 48123 + slot | `HDX_E2E_CH_PORT` |
| ClickHouse Native | 49000 + slot | `HDX_E2E_CH_NATIVE_PORT` |
| MongoDB | 49998 + slot | `HDX_E2E_MONGO_PORT` |
| API server | 49100 + slot | `HDX_E2E_API_PORT` |
| App (fullstack) | 48081 + slot | `HDX_E2E_APP_PORT` |
| App (local) | 48001 + slot | `HDX_E2E_APP_LOCAL_PORT` |
| OpAMP | 44320 + slot | `HDX_E2E_OPAMP_PORT` |

## New Make Targets

```bash
make dev-e2e FILE=navigation                    # Run specific test file
make dev-e2e FILE=navigation GREP="help menu"   # Filter by test name
make dev-e2e GREP="should navigate"             # Grep across all files
make dev-e2e FILE=navigation REPORT=1           # Open HTML report after run
make dev-e2e-clean                              # Remove test artifacts
```

## Linear

https://linear.app/hyperdx/issue/HDX-3796
2026-03-26 18:19:14 +00:00
Karl Power
7ab7f6de1d
feat: allow collapsing child spans in trace timeline (#1885) 2026-03-26 15:01:58 +01:00
Karl Power
e16d3cd9f4
fix: timeline chart scrolling on firefox (#1976)
## Summary



- Fix slow and jumpy vertical scrolling in Firefox on the timeline chart's onWheel handler
- Firefox reports small non-zero `deltaX` values during vertical trackpad scrolling (trackpad gestures are rarely perfectly vertical), while Chrome silently zeroes these out. The previous `if (deltaX !== 0)` check was calling `preventDefault()` on nearly every vertical scroll in Firefox, blocking native scroll behavior.
- Replace the `deltaX !== 0` check with `Math.abs(deltaX) > Math.abs(deltaY)` so horizontal panning only activates when the gesture is predominantly horizontal, and skip unnecessary `setOffset` calls and re-renders on vertical scrolls

### How to test locally or on Vercel



1. In Firefox, verify vertical scrolling on the timeline chart is smooth and not blocked

2. In Chrome, verify vertical scrolling still works as before

3. Verify horizontal trackpad panning still works in both browsers

4. Verify Ctrl/Cmd + scroll zoom still works in both browsers
2026-03-26 08:32:38 +00:00
Drew Davis
e21811cc47
feat: Add dashboard listing page (#1971)
## Summary

This PR introduces a new dashboards listing page, which lists the available dashboards. Each individual dashboard is no longer listed in the sidebar. The new listing page supports searching by name and filtering by tag. This PR is a continuation of @elizabetdev's #1805, with some changes, additional tests, and refactorings.

This page does client-side sort and filter. There is no server-side pagination, filtering, or sorting. That is left as a future improvement, should it become necessary.

### Screenshots or video

<img width="2556" height="794" alt="Screenshot 2026-03-24 at 7 45 54 AM" src="https://github.com/user-attachments/assets/e4c5dba0-6cdf-4f2a-a5f3-2e4e00979729" />
<img width="2553" height="842" alt="Screenshot 2026-03-24 at 7 45 43 AM" src="https://github.com/user-attachments/assets/fc0f5270-d6d3-47ff-be03-762abd82a7d1" />
<img width="2544" height="862" alt="Screenshot 2026-03-24 at 7 45 34 AM" src="https://github.com/user-attachments/assets/4b1957c3-0e6e-4910-ac66-830734604759" />

### How to test locally or on Vercel

The listing page can be tested in vercel preview.

### References



- Linear Issue: Closes HDX-3565
- Related PRs:
2026-03-26 02:30:52 +00:00
dependabot[bot]
c9ab6dd0f8
chore(deps): bump flatted from 3.3.3 to 3.4.2 (#1949)
Bumps [flatted](https://github.com/WebReflection/flatted) from 3.3.3 to 3.4.2.
<details>
<summary>Commits</summary>
<ul>
<li><a href="3bf09091c3"><code>3bf0909</code></a> 3.4.2</li>
<li><a href="885ddcc33c"><code>885ddcc</code></a> fix CWE-1321</li>
<li><a href="0bdba705d1"><code>0bdba70</code></a> added flatted-view to the benchmark</li>
<li><a href="2a02dce7c6"><code>2a02dce</code></a> 3.4.1</li>
<li><a href="fba4e8f2e1"><code>fba4e8f</code></a> Merge pull request <a href="https://redirect.github.com/WebReflection/flatted/issues/89">#89</a> from WebReflection/python-fix</li>
<li><a href="5fe86485e6"><code>5fe8648</code></a> added &quot;when in Rome&quot; also a test for PHP</li>
<li><a href="53517adbef"><code>53517ad</code></a> some minor improvement</li>
<li><a href="b3e2a0c387"><code>b3e2a0c</code></a> Fixing recursion issue in Python too</li>
<li><a href="c4b46dbcbf"><code>c4b46db</code></a> Add SECURITY.md for security policy and reporting</li>
<li><a href="f86d071e0f"><code>f86d071</code></a> Create dependabot.yml for version updates</li>
<li>Additional commits viewable in <a href="https://github.com/WebReflection/flatted/compare/v3.3.3...v3.4.2">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=flatted&package-manager=npm_and_yarn&previous-version=3.3.3&new-version=3.4.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/hyperdxio/hyperdx/network/alerts).

</details>
2026-03-26 02:25:06 +00:00
Mike Shi
fb8a7e990d
Limit log pattern examples to 100 in side panel (#1990)
## Problem

When a log pattern has thousands of sample events with large payloads, the `PatternSidePanel` renders all of them at once via `RawLogTable`, causing the page to freeze (HDX-3838).

The root cause: up to 10,000 samples are fetched and grouped by pattern. A single pattern can accumulate thousands of rows, and passing all of them to `RawLogTable` at once causes excessive DOM rendering.

## Solution

Limit the initial display in `PatternSidePanel` to **100 sample events**. If a pattern has more than 100 samples, a "Show all N samples" button is rendered below the table to let users load the full set on demand.

### Changes in `packages/app/src/components/PatternSidePanel.tsx`:
- Added `INITIAL_LIMIT = 100` constant and `showAll` state
- `displayedSamples` memo slices `pattern.samples` to the first 100 unless the user clicks "Show all"
- Reset `showAll` to `false` when the `pattern` prop changes (user selects a different pattern)
- Added a subtle Mantine `Button` below the table when there are more than 100 samples


Linear Issue: [HDX-3838](https://linear.app/clickhouse/issue/HDX-3838/investigate-issues-with-large-log-payloads-causing-problems)

<div><a href="https://cursor.com/agents/bc-b7a128cb-a5af-465d-862e-97359077eeaa"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/background-agent?bcId=bc-b7a128cb-a5af-465d-862e-97359077eeaa"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>



Co-authored-by: Cursor Agent <199161495+cursoragent@users.noreply.github.com>
2026-03-26 02:20:55 +00:00
Brandon Pereira
4318d0a3c3
chore: remove unused files, dependencies, and exports flagged by knip (#1982)
## Summary

Cleans up dead code and unused dependencies identified by [knip](https://knip.dev/). All removals were individually verified to have zero imports or references across the codebase. No functional changes.

**Deleted 9 unused files:**
- `packages/api/src/clickhouse/__tests__/clickhouse.V1_DEPRECATED_test.ts` — skipped deprecated test
- `packages/api/src/utils/email.ts` — empty stub functions, never imported
- `packages/api/src/utils/queue.ts` — unused utility class
- `packages/app/src/Checkbox.tsx` — replaced by Mantine Checkbox, never imported
- `packages/app/src/components/DBSearchPageFilters/index.ts` — dead barrel file (shadowed by sibling `.tsx`)
- `packages/app/src/components/Sources/index.ts` — dead barrel file (all consumers import submodules directly)
- `packages/app/src/components/WhereLanguageControlled.tsx` — unused component
- `packages/app/src/TabBarWithContent.tsx` — unused component
- `packages/app/src/vsc-dark-plus.ts` — unused Prism theme

**Removed 14 unused dependencies** from `packages/api`, `packages/app`, and `packages/common-utils` (e.g. `semver`, `react-query`, `react-sortable-hoc`, `@microsoft/fetch-event-source`, `store2`, `uuid`, etc.)

**Removed 17 unused devDependencies** across root, api, app, and common-utils (e.g. `@nx/workspace`, `@typescript-eslint/eslint-plugin`, `@typescript-eslint/parser`, `@types/semver`, `@types/react-table`, `rimraf`, `supertest`, `ts-node`, `tsc-alias`, `tsconfig-paths`, etc.)

**Replaced `react-papaparse` with `papaparse`** — code imports `papaparse` directly, not the React wrapper. Added `@types/papaparse` since the package doesn't bundle its own types.

**Cleaned up unused exports:**
- Trimmed barrel files (`AppNav/index.ts`, `SearchInput/index.ts`) to only re-export what's actually consumed
- Removed duplicate named exports where only the default export is used (`DBRowTableFieldWithPopover`, `DBRowTableRowButtons`)
- Un-exported interfaces and constants that are only used locally (`DBRowTableFieldWithPopoverProps`, `DBRowTableIconButtonProps`, `DBRowTableRowButtonsProps`, `BASE_URL`, `makeHandler`)
- Removed stale `supertest` from `allowModules` in `common-utils/eslint.config.mjs`

### How to test locally or on Vercel

1. `yarn install` — lockfile should resolve cleanly
2. `yarn workspace @hyperdx/common-utils ci:lint` — should pass (the only package where lint+tsc fully passes on this branch)
3. `npx knip` — should show reduced issue counts vs. main

### References

- Related PRs: #1973 (knip CI workflow)
2026-03-25 20:32:03 +00:00
Elizabet Oliveira
6c347a52c8
fix: ClickStack and HyperDX color token improvements (#1988)
## Summary

- **Link colors**: Override `--mantine-color-anchor` in ClickStack so links use blue in light mode and yellow in dark mode instead of Mantine's default primary color derivation.
- **Checkbox & Radio**: Use `vars` overrides to apply ClickStack accent color to active checkboxes and radios, with contrasting icon colors for readability in both themes.
- **Slider styling**: Replace inline `styles` with semantic tokens (`--color-slider-bar`, `--color-slider-thumb`, `--color-slider-dot`, etc.) and CSS modules for consistent 6px solid dot marks and token-based thumb/mark colors across both ClickStack and HyperDX themes.
- **Subtle Button variant**: Add `variant="subtle"` support to `Button` in both themes (transparent background, hover highlight, standard text color).
- **Docs**: Update `code_style.md` to document `variant="subtle"` as accepted for both `Button` and `ActionIcon`.

### Before

<img width="3896" height="1296" alt="image" src="https://github.com/user-attachments/assets/5a2f109a-88e3-46a1-8e38-95d51dfd5a6b" />

<img width="1806" height="2570" alt="image" src="https://github.com/user-attachments/assets/70cf6786-a487-477b-868f-7f2a18746053" />



### After

<img width="3596" height="1358" alt="image" src="https://github.com/user-attachments/assets/0ad3b885-e6b8-4edd-aade-97516740ed6b" />

<img width="1874" height="2684" alt="image" src="https://github.com/user-attachments/assets/fa00f2cc-49f8-4bd3-8379-3665b760bd4e" />


## Test plan

- [ ] Verify links are blue in ClickStack light mode and yellow in dark mode
- [ ] Verify checkboxes and radio buttons use the accent color when active in both themes
- [ ] Verify checkbox icon is dark in dark mode for contrast
- [ ] Verify slider marks are solid 6px dots, with correct colors in both modes
- [ ] Verify slider thumb uses theme-appropriate colors
- [ ] Verify `<Button variant="subtle">` renders correctly in both themes
- [ ] Verify no visual regressions in HyperDX theme slider styling
2026-03-25 19:46:59 +00:00
Drew Davis
1fb8e35501
fix: Improve auto-complete behavior for aliases and maps (#1987)
## Summary

This PR improves auto-complete in the following ways

1. Auto-complete suggestions will not appear after `AS`, since it is assumed that a user will not want to type an existing column or function name as a column alias
2. Accepting an auto-complete suggestion will replace characters after the cursor if they match the accepted suggestion. This is nice when, for example, I have typed `ResourceAttributes[]` and my cursor is before the `]` - accepting a suggestion will now replace the trailing `]` instead of leaving it be (in which case it would be duplicated after inserting the suggestion).

### Screenshots or video

https://github.com/user-attachments/assets/9577393c-6bfa-410b-b5ba-2ba6b00bc26b

### How to test locally or on Vercel

This can be tested in the preview environment.

### References



- Linear Issue: Closes HDX-2612
- Related PRs:
2026-03-25 17:41:16 +00:00
Elizabet Oliveira
a6a83d59d4
feat: Add collapsible filter sidebar toggle to search page (#1975)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2026-03-25 15:44:56 +00:00
Drew Davis
8b629385f2
fix: Preserve default select when saving search (#1986)
## Summary

This PR fixes a bug which caused searches with the defaultSelectExpression to be saved with an empty `select` value, resulting in no select value appearing when loading the saved search.

The fix is to save the default select expression when there is no select value in the `searchedConfig` value (from the URL params), which corresponds to the case in which the default select expression is shown on the (non-saved) search page.

### Screenshots or video

Before:

https://github.com/user-attachments/assets/2b578dab-2085-4e64-a79c-c2e6e8f085fa

After:

https://github.com/user-attachments/assets/bf713b86-a454-4fc8-9ed7-5370e2e665e0

### How to test locally or on Vercel

You can reproduce the behavior in the preview environment following the video demo above.

### References



- Linear Issue: Closes HDX-3298
- Related PRs:
2026-03-25 14:42:44 +00:00
Drew Davis
4f7dd9ef63
fix: Correctly detect text index with quoted tokenizer argument (#1985)
## Summary

This PR fixes text index detection for indexes with quoted tokenizer arguments:

```
TYPE text(tokenizer = 'splitByNonAlpha')
```

### Screenshots or video

### How to test locally or on Vercel

The unit tests demonstrate the fix.

### References



- Linear Issue: Closes HDX-3812
- Related PRs:
2026-03-25 13:51:05 +00:00
Vineet Ahirkar
629009da9e
Switch to OpenAI Responses API (#1981)
## Summary

#1960 added support for OpenAI's chat completions api.

This change switches to using [OpenAI's new Responses API](https://developers.openai.com/api/docs/guides/migrate-to-responses) instead.

### How to test locally or on Vercel

### How to test locally
1. Set env vars:
`AI_PROVIDER=openai AI_API_KEY= AI_BASE_URL=<> AI_MODEL_NAME=<> AI_REQUEST_HEADERS={"X-Client-Id":"","X-Username":"", AI_ADDITIONAL_OPTIONS = {API_TYPE: "responses"}}`
3. Open Hyperdx's chart explorer and use the AI assistant chart builder
   - e.g. "show me error count by service in the last hour"
4. Confirm the assistant returns a valid chart config.

### References



- Linear Issue:
- Related PRs:
2026-03-25 01:46:43 +00:00
Drew Davis
275dc94161
feat: Add conditions to Dashboard filters; Support filter multi-select (#1969)
## Summary

This PR improves dashboard filters

1. Dashboard filters can now have an associated WHERE condition which filters the rows from which filter values will be queried.
2. Multiple values can now be selected for a single dashboard filter

### Screenshots or video

Multiple values can now be selected for a single filters:

<img width="544" height="77" alt="Screenshot 2026-03-23 at 12 31 02 PM" src="https://github.com/user-attachments/assets/2390a2d7-8514-4eb8-ac3c-db102a5df99b" />

Filters now have an optional condition, which filters the values which show up in the dropdown:

<img width="451" height="476" alt="Screenshot 2026-03-23 at 12 30 44 PM" src="https://github.com/user-attachments/assets/eed7f69e-466e-42fd-93f1-c27bfbc06204" />

<img width="265" height="94" alt="Screenshot 2026-03-23 at 12 30 54 PM" src="https://github.com/user-attachments/assets/2ba46e33-a44a-45ea-a6bf-fb71f5373e46" />

This also applies to Preset Dashboard Filters

<img width="726" height="908" alt="Screenshot 2026-03-23 at 12 33 34 PM" src="https://github.com/user-attachments/assets/df648feb-32e2-4f5e-80e5-409e0443b38e" />

### How to test locally or on Vercel

This can be partially tested in the preview environment, but testing the following requires running locally

1. Preset dashboard filters
2. External API support

### References



- Linear Issue: Closes HDX-3631 Closes HDX-2987
- Related PRs:
2026-03-24 18:05:41 +00:00
Drew Davis
dd313f7754
fix: Fix intermittently-missing SQL autocomplete suggestions (#1980) 2026-03-24 13:45:34 -04:00
Drew Davis
cdc29d5a88
fix: Fix query error on ClickHouse Query latency chart (#1978)
## Summary

This PR fixes the heatmap Query Latency chart on the ClickHouse page, by casting the value expression to Float64 so that it matches the type of other `greatest()` args.

### Screenshots or video

Before

<img width="2301" height="341" alt="Screenshot 2026-03-24 at 10 29 44 AM" src="https://github.com/user-attachments/assets/4c3c2562-e2c8-4bc8-8739-adb7768d7cf6" />
<img width="1945" height="304" alt="Screenshot 2026-03-24 at 10 29 35 AM" src="https://github.com/user-attachments/assets/5d8d3dd0-bf56-4af8-bfe9-7672723c255b" />

After

<img width="2290" height="367" alt="Screenshot 2026-03-24 at 10 33 29 AM" src="https://github.com/user-attachments/assets/af034dbd-d983-416b-9b47-927db818bd02" />
<img width="2296" height="299" alt="Screenshot 2026-03-24 at 10 33 38 AM" src="https://github.com/user-attachments/assets/e5910d8d-e799-444d-b38d-8fa574beae87" />


### How to test locally or on Vercel

This can be validated in the preview environment

### References



- Linear Issue: Closes HDX-3794
- Related PRs:
2026-03-24 14:42:28 +00:00
Aaron Knudtson
45755260d0
fix: Prevent duplicate demo sources in Play Environment source select (#1977)
## Summary

The cleanup logic only removed demo sources where connection === 'local', or the db != 'otel_v2'. Now removes all Demo/ClickPy sources by name before recreating them, and reuses an existing demo connection instead of creating duplicates.

### References

- Linear Issue: HDX-3800
2026-03-24 14:29:07 +00:00
Brandon Pereira
89868d2670
feat: Enhance Knip workflow for unused code analysis (#1973)
## Summary

This update improves the Knip GitHub Action by adding detailed reporting of unused code issues. The changes include:

- Enhanced issue counting to include a breakdown of items per category.
- Added a detailed summary section in the PR comment that lists added and removed items for each category when there are changes.
- Improved error handling to ensure consistent return values even when parsing fails.

These enhancements provide clearer insights into unused code changes between branches, aiding in code maintenance and quality.


| Before | After | 
| --- | --- | 
| <img width="569" height="451" alt="Screenshot 2026-03-23 at 4 44 43 PM" src="https://github.com/user-attachments/assets/01c2fdcc-802f-4046-8ab3-f3e92ec46ae0" /> | <img width="981" height="706" alt="Screenshot 2026-03-23 at 4 42 47 PM" src="https://github.com/user-attachments/assets/8fefeb74-1606-4a26-b307-3aa5ff76265f" /> | 


Note the additional details at bottom explaining the Function/Files causing diffs

Also, if no changes are detected, output is minimal:
<img width="1050" height="271" alt="Screenshot 2026-03-23 at 4 45 37 PM" src="https://github.com/user-attachments/assets/e075a5cd-4170-4999-a2c3-752447ac2f8a" />
2026-03-24 14:10:00 +00:00
Brandon Pereira
96371cdc6a
small tweaks to opencode do-linear command (#1974)
Based on usage, opens a draft PR first. If multiple tickets, does not include in title.
2026-03-24 14:05:34 +00:00
Alex Fedotyev
105a2f8970
Move section collapse state to URL query params (#1958)
## Summary
- Section expand/collapse is now tracked in URL query params (`collapsed`/`expanded`) instead of persisting to the DB on every chevron click
- The DB-stored `collapsed` field on `DashboardContainer` becomes the default fallback — what viewers see when opening a dashboard fresh (no URL state)
- Chevron click updates URL state only (per-viewer, shareable via link)
- "Collapse by Default" / "Expand by Default" menu action in the section header saves to the DB (via `setDashboard`), setting the default for all viewers
- `SectionHeader` now accepts separate `collapsed`/`defaultCollapsed` props and `onToggle`/`onToggleDefaultCollapsed` handlers
- Adds 7 unit tests for `SectionHeader`

Implements Drew's [review feedback on PR #1926](https://github.com/hyperdxio/hyperdx/pull/1926#discussion_r2966166505):
> IMO, expanding/collapsing should not be persisted to the dashboard UNLESS this option is used. [...] I think it would be nice to persist normal expand collapse states in the URL, and then fallback to the default state (saved in the DB based on this option here) if there is no URL state.

## Demo

![Section collapse via URL params demo](https://raw.githubusercontent.com/hyperdxio/hyperdx/feat/url-based-collapse-state/docs/assets/collapse-url-state-demo.gif)

Shows: expanded sections → chevron click collapses first section (URL updates to `?collapsed=...`) → menu shows "Collapse by Default" (DB action, separate from view state)

## Test plan
- [x] Open a dashboard with sections — collapse/expand via chevron click, verify URL updates (`?collapsed=...` / `?expanded=...`) without saving to DB
- [x] Copy the URL with collapse state and open in a new tab — verify sections reflect the URL state
- [x] Open the section menu and click "Collapse by Default" — verify this saves to DB (persists after page refresh without URL params)
- [x] Verify "Expand by Default" / "Collapse by Default" label reflects the DB default, not current view state
- [x] Run `yarn ci:unit --testPathPatterns='SectionHeader'` — all 7 tests pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-03-24 13:58:30 +00:00
Vineet Ahirkar
47e1f565ee
feat: Add OpenAI provider support for AI assistance (#1960) 2026-03-23 16:27:19 -06:00
Drew Davis
2207edbfd1
docs: Link to the SQL-based visualization docs (#1965)
## Summary

This PR updates the link for macros documentation in the SQL-based chart instructions component to target the new ClickStack [SQL-based Charts docs](https://clickhouse.com/docs/use-cases/observability/clickstack/dashboards/sql-visualizations).

### Screenshots or video

<img width="1453" height="552" alt="Screenshot 2026-03-23 at 8 34 59 AM" src="https://github.com/user-attachments/assets/8706c751-6703-4180-a6ae-39422319637c" />

### How to test locally or on Vercel

This link can be tested in vercel preview.

### References



- Linear Issue:
- Related PRs:
2026-03-23 16:17:30 +00:00
Mike Shi
c9d1dda358
feat: Add Column toggle button to filter panel in DBSearchPage (#1947)
## Summary

Adds a column toggle button (+ / - icon) next to the "Show Distribution" button in each filter group header on the search page. Clicking the button adds or removes the filter's field from the `SELECT` statement, and the table reflects the change immediately.

### Changes

- **`FilterGroup`** (`DBSearchPageFilters.tsx`): Added `onColumnToggle` and `isColumnDisplayed` props. Renders an `ActionIcon` with `IconPlus` (add) or `IconMinus` (remove) between the distribution toggle and the pin field button.
- **`NestedFilterGroup`**: Passes the new column toggle props through to child `FilterGroup` components.
- **`DBSearchPage.tsx`**: Passes `toggleColumn` and `displayedColumns` to `DBSearchPageFilters`, reusing the existing `toggleColumn` callback that manages the `SELECT` form field.

### Screenshots or video

| Before | After |
| :----- | :---- |
| Only distribution and pin buttons in filter header | New +/- column button appears between distribution and pin buttons |

### How to test locally or on Vercel

1. Navigate to the Search page
2. Open the filter panel on the left side
3. Find any filter group and hover over the header area — a `+` icon should appear next to the distribution chart icon
4. Click the `+` icon — the field should be added to the `SELECT` input and appear as a column in the results table
5. Click the `-` icon (now shown since the column is displayed) — the field should be removed from `SELECT` and the column disappears

### References

- Linear Issue: HDX-3770



Linear Issue: [HDX-3770](https://linear.app/clickhouse/issue/HDX-3770/telstra-add-column-from-filter-panel-in-dbsearchpage)

<div><a href="https://cursor.com/agents/bc-11d702b5-a58e-485c-982f-61d990e45091"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/background-agent?bcId=bc-11d702b5-a58e-485c-982f-61d990e45091"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>



Co-authored-by: Cursor Agent <199161495+cursoragent@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-23 15:21:57 +00:00
Brandon Pereira
b642ce43d3
feat: Add Knip for unused code analysis with CI reporting (#1954)
## Summary

Adds [Knip](https://knip.dev) to the monorepo to detect unused files, dependencies, and exports. The goal is to reduce dead code over time and prevent new unused code from accumulating.

**What's included:**
- Root-level `knip.json` configured for all three workspaces (`packages/app`, `packages/api`, `packages/common-utils`)
- `yarn knip` and `yarn knip:ci` scripts for local and CI usage
- GitHub Action (`.github/workflows/knip.yml`) that runs on every PR to `main`, compares results against the base branch, and posts a summary comment showing any increase or decrease in unused code
- Removed the previous app-only `packages/app/knip.json` in favor of the monorepo-wide config

**How the CI workflow works:**
1. Runs Knip on the PR branch
2. Checks out `main` and runs Knip there
3. Compares issue counts per category and posts/updates a PR comment with a diff table

This is additive — Knip runs as an informational check and does not block PRs.
2026-03-23 14:41:44 +00:00
Alex Fedotyev
c70429e6f5
Replace Add New Tile button with unified Add dropdown (#1956)
## Summary
- Replace the "Add New Tile" button and overflow "Add Section" menu item with a unified "Add" dropdown at the bottom of the dashboard
- Dropdown contains "New Tile" and "New Section" — creative actions only
- "Import Dashboard" stays in the overflow menu alongside Export, Delete, and other management actions
- Follows the Grafana/Datadog pattern of a single entry point for adding content, which scales to future container types (tabs, groups)

## Test plan
- [x] Click "Add" button at bottom of dashboard → dropdown opens upward with "New Tile" and "New Section"
- [x] Click "New Tile" → tile editor opens (same as before)
- [x] Click "New Section" → new section appears on dashboard
- [x] Overflow menu still contains "Import Dashboard" with contextual label
- [x] E2E tests pass (updated page object for two-click dropdown flow)

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-03-23 12:11:34 +00:00
Vineet Ahirkar
6936ef8e29
Optimize materialized column lookup for expression aliases (#1959)
## Summary
Improve the materialized column optimization by allowing it to be applied when `WITH` clauses are expression aliases (i.e., `isSubquery: false`). Previously, any `WITH` clause would disable this optimization. This change ensures that materialized columns are still considered for performance benefits when the `WITH` clause does not represent a subquery.

### Screenshots or video



| Before | After |
| :----- | :---- |
|        |       |

### How to test locally or on Vercel


1. Create a ClickHouse table with a materialized column, e.g.:
   ```sql
   ALTER TABLE otel_logs ADD COLUMN awesome_attribute String MATERIALIZED LogAttributes['awesome_attribute']
   ```
2. Open the Explore view for logs (`/search`)
3. Add a filter for `awesome_attribute` (or `LogAttributes['awesome_attribute']`)
4. Inspect the POST body of `/clickhouse-proxy` requests in the network tab:
    - Before fix: The histogram (time chart) query contains `LogAttributes['awesome_attribute']` (full map scan), while the search results query correctly uses `awesome_attribute`.
    - After fix: Both the histogram and search results queries use `awesome_attribute` (the materialized column).


### References



- Linear Issue: #1957
- Related PRs:
2026-03-22 22:54:18 +00:00
Warren Lee
470b2c2992
ci: Replace QEMU with native ARM64 runners for release builds (#1952)
## Summary

- **Replace QEMU-emulated multi-platform builds with native ARM64 runners** for both `release.yml` and `release-nightly.yml`, significantly speeding up CI build times
- Each architecture (amd64/arm64) now builds in parallel on native hardware, then a manifest-merge job combines them into a multi-arch Docker tag using `docker buildx imagetools create`
- Migrate from raw Makefile `docker buildx build` commands to `docker/build-push-action@v6` for better GHA integration

## Changes

### `.github/workflows/release.yml`
- Removed QEMU setup entirely
- Replaced single `release` matrix job with per-image build+publish job pairs:
  - `build-otel-collector` / `publish-otel-collector` (runners: `ubuntu-latest` / `ubuntu-latest-arm64`)
  - `build-app` / `publish-app` (runners: `Large-Runner-x64-32` / `Large-Runner-ARM64-32`)
  - `build-local` / `publish-local` (runners: `Large-Runner-x64-32` / `Large-Runner-ARM64-32`)
  - `build-all-in-one` / `publish-all-in-one` (runners: `Large-Runner-x64-32` / `Large-Runner-ARM64-32`)
- Added `check_version` job to centralize skip-if-exists logic (replaces per-image `docker manifest inspect` in Makefile)
- Removed `check_release_app_pushed` artifact upload/download — `publish-app` now outputs `app_was_pushed` directly
- Scoped GHA build cache per image+arch (e.g. `scope=app-amd64`) to avoid collisions
- All 4 images build in parallel (8 build jobs total), then 4 manifest-merge jobs, then downstream notifications

### `.github/workflows/release-nightly.yml`
- Same native runner pattern (no skip logic since nightly always rebuilds)
- 8 build + 4 publish jobs running in parallel
- Slack failure notification and OTel trace export now depend on publish jobs

### `Makefile`
- Removed `release-*` and `release-*-nightly` targets (lines 203-361) — build logic moved into workflow YAML
- Local `build-*` targets preserved for developer use

## Architecture

Follows the same pattern as `release-ee.yml` in the EE repo:

```
check_changesets → check_version
                        │
    ┌───────────────────┼───────────────────┬───────────────────┐
    v                   v                   v                   v
build-app(x2)   build-otel(x2)    build-local(x2)    build-aio(x2)
    │                   │                   │                   │
publish-app      publish-otel       publish-local      publish-aio
    │                   │                   │                   │
    └─────────┬─────────┴───────────────────┴───────────────────┘
              v
     notify_helm_charts / notify_clickhouse_clickstack
              │
     otel-cicd-action
```

## Notes

- `--squash` flag dropped — it's an experimental Docker feature incompatible with `build-push-action` in multi-platform mode. `sbom` and `provenance` are preserved via action params.
- Per-arch intermediate tags (e.g. `hyperdx/hyperdx:2.21.0-amd64`) remain visible on DockerHub — this is standard practice.
- Dual DockerHub namespace tagging (`hyperdx/*` + `clickhouse/clickstack-*`) preserved.


## Sample Run
https://github.com/hyperdxio/hyperdx/actions/runs/23362835749
2026-03-20 23:04:49 +00:00
github-actions[bot]
5d2ebc46ee
Release HyperDX (#1884)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-20 14:22:09 -07:00
Brandon Pereira
b58bb5d5f4
chore: git ignore worktrees directory (#1953)
If you use `.worktrees` subfolder for agent worktrees, it needs to be gitignored.
2026-03-20 19:52:23 +00:00
Elizabet Oliveira
3d15b3de93
feat: Enhance data source select with context-aware icons and inline actions (#1948)
## Summary

Closes [HDX-3784](https://linear.app/clickhouse/issue/HDX-3784/increase-discoverability-of-trace-sources)

- **Context-aware icons for all source kinds**: The data source dropdown now shows icons for every source type — `IconLogs` for logs, `IconConnection` for traces, `IconDeviceLaptop` for sessions, and `IconChartLine` for metrics. Falls back to `IconStack` when no source is selected.
- **Inline source actions**: "Create New Source" and "Edit Sources" actions are now part of the dropdown itself under an "Actions" group with a labeled separator, replacing the separate gear icon menu (`SourceEditMenu`).
- **Dependency update**: Updated `@tabler/icons-react` from v3.5.0 to v3.40.0 to get `IconConnection`.
- **Fix: source management regression when `HDX_LOCAL_DEFAULT_SOURCES` is set**: Before this PR, there were two ways to create/edit sources: (1) options inside the dropdown, which were hidden when `HDX_LOCAL_DEFAULT_SOURCES` is set, and (2) a gear icon button next to the dropdown, which was always visible. This PR removed the gear icon and kept only the dropdown options, but they were still configured to hide when `HDX_LOCAL_DEFAULT_SOURCES` is set — leaving users with no way to manage sources. Fixed by removing that guard so the dropdown options always appear.

<img width="1236" height="492" alt="image" src="https://github.com/user-attachments/assets/6999626b-685b-4037-a003-b09018cfbadf" />

<img width="426" height="240" alt="Screenshot 2026-03-20 at 17 49 30" src="https://github.com/user-attachments/assets/28aaef44-7574-4c54-b721-b2a3a79b3507" />

## Changes

- `packages/app/src/components/SourceSelect.tsx` -- Dynamic left icon based on selected source kind (all 4 kinds: log, trace, session, metric), `onEdit` prop, grouped action items with icons, `renderOption` for source kind and action item icons. Removed `hasLocalDefaultSources` guard so source management actions are always available.
- `packages/app/src/components/SelectControlled.tsx` -- Added `onEdit` callback support, fixed `selected` check to handle grouped data.
- `packages/app/src/DBSearchPage.tsx` -- Removed `SourceEditMenu` component, added `onEditSources` callback, wired `onEdit` to `SourceSelectControlled`.
- `packages/app/styles/SourceSelectControlled.module.scss` -- Group label separator styling with semantic `--color-border` token.
- `packages/app/package.json` -- Updated `@tabler/icons-react` to `^3.39.0`.

## Test plan

- [ ] Select a log source and verify `IconLogs` appears as the left icon
- [ ] Select a trace source and verify `IconConnection` appears as the left icon
- [ ] Select a session source and verify `IconDeviceLaptop` appears as the left icon
- [ ] Select a metric source and verify `IconChartLine` appears as the left icon
- [ ] Verify each source in the dropdown shows its corresponding kind icon
- [ ] Open the dropdown and verify "Create New Source" and "Edit Sources" appear under the "Actions" group with icons
- [ ] Click "Create New Source" and verify the modal opens
- [ ] Click "Edit Sources" and verify navigation to edit (local mode: modal, cloud mode: /team)
- [ ] Verify the gear icon menu is no longer present next to the select
- [ ] **With `NEXT_PUBLIC_HDX_LOCAL_DEFAULT_SOURCES` set**: verify "Create New Source" and "Edit Sources" still appear in the dropdown and work correctly
2026-03-20 19:21:51 +00:00
Elizabet Oliveira
e1cf4bca56
fix: Override --mantine-color-text with semantic --color-text token (#1950)
## Summary

- Override Mantine's `--mantine-color-text` CSS variable to use our semantic `--color-text` token in both themes (hyperdx and clickstack), for both dark and light modes.
- Ensures all Mantine components that rely on `--mantine-color-text` use the correct theme-aware text color.
- Overrides are placed in the `/* Mantine Overrides */` section at the end of each theme mixin, consistent with the existing `--mantine-color-body` override.

## Test plan

- [ ] Verify text color in Mantine components matches the theme's `--color-text` in dark mode (both themes)
- [ ] Verify text color in Mantine components matches the theme's `--color-text` in light mode (both themes)


Made with [Cursor](https://cursor.com)
2026-03-20 18:58:21 +00:00
Dan Hable
a0b3361a85
[HDX-2712] Unified hyperdx entrypoint script for API and tasks (#1951)
## Summary

The node commands to start the API server and alert task are duplicated across 4+ files, each hardcoding the build output path and node require flags. When the build process changed (esbuild introduction/revert per HDX-2690), the downstream operator and helm chart broke because their entrypoint commands were stale.

This PR introduces `packages/api/bin/hyperdx`, a single shell script that is the **sole source of truth** for how to launch API and task processes. It resolves the build directory relative to its own location, applies the correct node flags (`-r @hyperdx/node-opentelemetry/build/src/tracing`), and exposes two subcommands:

- `hyperdx api` -- starts the API server
- `hyperdx task <name>` -- runs a named task (e.g., `check-alerts`)

All Dockerfiles and entry scripts now delegate to this script instead of inlining the node command. Future build changes only need updating in one place.

### How to test locally or on Vercel

1. **Build the standalone API image** and confirm the entrypoint works:
   ```bash
   docker build . -f packages/api/Dockerfile -t hyperdx-api-test:latest --target prod
   docker run -d --name hdx-api-test -p 18000:8000 hyperdx-api-test:latest
   sleep 5
   docker logs hdx-api-test 2>&1 | head -30
   # Should show OpenTelemetry init + MongoStore error (expected without Mongo)
   # No "file not found" or "permission denied" errors
   docker stop hdx-api-test && docker rm hdx-api-test
   ```
2. **Build and run the all-in-one image** for a full integration test:
   ```bash
   make build-local
   docker run -d --name hdx-aio-test -p 18080:8080 -p 18000:8000 hyperdx/hyperdx-local:2.21.0
   # Wait up to 90s for startup, then:
   curl -sf http://localhost:18080/api/health  # should return {"data":"OK",...}
   curl -sf http://localhost:18000/health       # should return {"data":"OK",...}
   docker exec hdx-aio-test sh -c "ps aux"
   # Confirm API, APP, and ALERT-TASK processes are running via the hyperdx script
   docker stop hdx-aio-test && docker rm hdx-aio-test
   ```
3. **Build the prod image** to confirm the entry script changes are valid:
   ```bash
   make build-app
   ```

**Testing performed:** All three Docker image targets were built and verified locally. The standalone API image started node via `hyperdx api` correctly (crashed on missing MongoDB as expected). The all-in-one image passed health checks on both `localhost:18080/api/health` and `localhost:18000/health`, with all three processes (API, APP, ALERT-TASK) confirmed running inside the container using the new entry point script.

### References

- Linear Issue: [HDX-2712](https://linear.app/clickhouse/issue/HDX-2712/use-a-single-entry-point-script-for-both-hyperdx-api-and-alert-job)
- Related PRs: HDX-2690 (root cause), HDX-2815 (downstream helm chart follow-up)
- **Follow-up needed:** Update helm chart cron job template and operator template in `ClickHouse/ClickStack-helm-charts` to use `./packages/api/bin/hyperdx task check-alerts`

Made with [Cursor](https://cursor.com)
2026-03-20 18:27:40 +00:00
Alex Fedotyev
b6cd088f18
feat: Collapsible sections — authoring UX + DashboardContainer abstraction (#1926)
## Summary

Adds the authoring experience for dashboard sections (create, rename, delete, manage tiles) and introduces a polymorphic `DashboardContainer` abstraction that future-proofs the schema for tabs and groups.

Builds on #1900 (core collapsible sections mechanics). Closes #1897.

### Schema: `DashboardSection` → `DashboardContainer`

- Renamed `DashboardSectionSchema` → `DashboardContainerSchema` with a new `type` field (`'section'` for now, extensible to `'group'` / `'tab'` later)
- `sectionId` → `containerId` on tiles
- `sections` → `containers` on dashboards
- Updated across all packages: common-utils types, API Mongoose model, app types, import/export utils

### Authoring UX

| Action | How |
|---|---|
| **Create section** | Dashboard `...` overflow menu → "Add Section" |
| **Rename section** | Click the title text directly (Kibana-style inline editing) |
| **Delete section** | Hover section header → `...` → Delete Section (tiles become ungrouped, not deleted) |
| **Collapse/expand** | Click section header chevron |
| **Toggle default state** | Hover header → `...` → Collapse/Expand by Default |
| **Add tile to section** | Hover section header → `+` button opens tile editor pre-assigned to that section |
| **Move tile to section** | Hover tile → grid icon → pick target section from dropdown |
| **Move tile out** | Same dropdown → "(Ungrouped)" |

![Mar-18-2026 16-37-58](https://github.com/user-attachments/assets/79e23773-db49-401d-8453-40e0461f6147)


### UX polish (informed by best practices research)

- **Click-to-rename** — click section title text to edit inline (no menu navigation needed)
- **Hover-only controls** — `...` menu and `+` button only appear on section header hover, keeping view mode clean
- **"Add Section" demoted** — moved from equal-sized button to dashboard overflow menu (section creation is less frequent than tile creation)
- **"Move to Section" reordered** — placed before delete button for discoverability, uses `IconLayoutList` instead of `IconFolders`

### What's NOT in this PR (follow-up work)

- **Drag tiles between sections** — needs `react-dnd` custom drag layer; data model already supports it (`containerId` update)
- **Reorder sections** — needs sortable list library; data model supports it (array order)
- **Tabs / Groups** — new container types; just add to the `type` enum and build UIs

## Test plan

- [x] 30 unit tests pass (16 existing schema/grouping + 14 new authoring operations)
- [x] All 110 dashboard tests pass unchanged
- [x] ESLint clean
- [x] No TypeScript errors in changed files
- [x] Backward compatible — dashboards without containers render exactly as before

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-03-20 16:04:05 +00:00
James
2fab76bfcd
fix: keep toStartOf* time filters inclusive regardless of dateRangeEndInclusive (#1915)
== Motivation ==

Time histograms on the search page silently drop data past an hour/minute boundary when the source `timestampValueExpression` includes a `toStartOf*` expression for primary key optimization.

== Details ==

When `convertToTimeChartConfig` aligns the date range to granularity it sets `dateRangeEndInclusive: false`, which is correct for the raw timestamp column (end was rounded up, so `<` gives equivalent coverage). But `timeFilterExpr` applies that same `<` uniformly to every expression in a compound `timestampValueExpression`. With a range ending at `04:08`, this yields `toStartOfHour(ts) < toStartOfHour(04:08)` = `< 04:00` — excluding the entire `04:xx` hour.

The coarse filter exists only for index pruning; the raw column already enforces exact bounds. Making it wider by one interval is harmless, making it narrower drops real rows.

== Testing ==

- `yarn jest renderChartConfig.test.ts` — 54 passed, 29 snapshots passed
- Added cases for `toStartOfHour` with exclusive end, compound expr with exclusive end, and exclusive start
2026-03-20 15:21:16 +00:00
Drew Davis
f5ce232976
ci: Add linting for openapi specs (#1945)
## Summary

This PR adds the Spectral linter for linting our OpenAPI spec, with rules preventing fields with missing examples or descriptions, which are often enforced in the Control Plane repo.

This PR also resolves lint errors that were already present.

### Screenshots or video

### How to test locally or on Vercel

Run `make ci-lint` to lint the openapi specs 

### References



- Linear Issue: Closes HDX-3768
- Related PRs:
2026-03-20 15:13:19 +00:00
Aaron Knudtson
33622dba35
fix: backport type changes (#1935)
## Summary

Backports type changes from downstream that were improved upon from https://github.com/hyperdxio/hyperdx/pull/1892/changes

### References

- Linear Issue:
- Related PRs: https://github.com/hyperdxio/hyperdx/pull/1892/changes#top
2026-03-20 14:19:03 +00:00
Drew Davis
e18f88c8b0
feat: Set enable_full_text_index=1 when available (#1946) 2026-03-20 10:14:21 -04:00
Drew Davis
243e3baa26
feat: Support fetching distributed table metadata with cluster() (#1944)
## Summary

Some Distributed tables refer to "local" tables which are not available on the local node. To read metadata (primary key, skip indexes) for such distributed tables, we can read from `cluster(<cluster with local tables>, system, <metadata table>)` instead of the local system tables.

### Screenshots or video

After adding the distributed table as a source, we can see that the order by optimization and the skip index detection are working as intended, indicating that the cluster() queries are working and fetching the required metadata:

<img width="2099" height="624" alt="Screenshot 2026-03-19 at 8 39 48 AM" src="https://github.com/user-attachments/assets/1f8384fb-8ae1-4549-9432-e4359ac72e02" />

### How to test locally or on Vercel

<details>
<summary>First, setup two clusters</summary>

- docker compose: https://pastila.clickhouse.com/?003644f9/c65444330e3601726c00b7cc9e095e71#7W62EjQox6MnTj0vCGL0AA==GCM
- config.xml: https://pastila.clickhouse.com/?002ee55c/d82248e8db633b3fbaf14cee2ee51b0e#royNZZ4snbBpZUd8xulw5w==GCM
- config-2.xml: https://pastila.clickhouse.com/?009f57b4/cf1d51fa36eee025f17beda4da6621fa#KBbHphEhcS+1m7mBqNfY4A==GCM
- config-3.xml: https://pastila.clickhouse.com/?003115c7/e984fc157de834095bedea86bc698dca#1rEmfXnq6H0tiT4qNgayNg==GCM
- keeper.xml: https://pastila.clickhouse.com/?005dc0a8/1599254d15dbac2868f04f5ab33125c2#R90W3HfA3J0yeTNf9hrDNQ==GCM

</details>

<details>
<summary>Then setup the local and distributed tables</summary>

```sql
CREATE TABLE default.otel_logs_toStartOf on cluster hdx_cluster_2
(
    `Timestamp` DateTime64(9) CODEC(Delta(8), ZSTD(1)),
    `TimestampTime` DateTime DEFAULT toDateTime(Timestamp),
    `TraceId` String CODEC(ZSTD(1)),
    `SpanId` String CODEC(ZSTD(1)),
    `TraceFlags` UInt8,
    `SeverityText` LowCardinality(String) CODEC(ZSTD(1)),
    `SeverityNumber` UInt8,
    `ServiceName` LowCardinality(String) CODEC(ZSTD(1)),
    `Body` String CODEC(ZSTD(1)),
    `ResourceSchemaUrl` LowCardinality(String) CODEC(ZSTD(1)),
    `ResourceAttributes` Map(LowCardinality(String), String) CODEC(ZSTD(1)),
    `ScopeSchemaUrl` LowCardinality(String) CODEC(ZSTD(1)),
    `ScopeName` String CODEC(ZSTD(1)),
    `ScopeVersion` LowCardinality(String) CODEC(ZSTD(1)),
    `ScopeAttributes` Map(LowCardinality(String), String) CODEC(ZSTD(1)),
    `LogAttributes` Map(LowCardinality(String), String) CODEC(ZSTD(1)),
    INDEX idx_trace_id TraceId TYPE bloom_filter(0.001) GRANULARITY 1,
    INDEX idx_res_attr_key mapKeys(ResourceAttributes) TYPE bloom_filter(0.01) GRANULARITY 1,
    INDEX idx_res_attr_value mapValues(ResourceAttributes) TYPE bloom_filter(0.01) GRANULARITY 1,
    INDEX idx_scope_attr_key mapKeys(ScopeAttributes) TYPE bloom_filter(0.01) GRANULARITY 1,
    INDEX idx_scope_attr_value mapValues(ScopeAttributes) TYPE bloom_filter(0.01) GRANULARITY 1,
    INDEX idx_log_attr_key mapKeys(LogAttributes) TYPE bloom_filter(0.01) GRANULARITY 1,
    INDEX idx_log_attr_value mapValues(LogAttributes) TYPE bloom_filter(0.01) GRANULARITY 1,
    INDEX idx_body Body TYPE tokenbf_v1(32768, 3, 0) GRANULARITY 8
)
ENGINE = MergeTree
PARTITION BY toDate(TimestampTime)
PRIMARY KEY (toStartOfMinute(TimestampTime), ServiceName, TimestampTime)
ORDER BY (toStartOfMinute(TimestampTime), ServiceName, TimestampTime, Timestamp)
TTL TimestampTime + toIntervalDay(30)
SETTINGS index_granularity = 8192, ttl_only_drop_parts = 1;

CREATE TABLE default.otel_logs_toStartOf_distributed on cluster hdx_cluster
(
    `Timestamp` DateTime64(9) CODEC(Delta(8), ZSTD(1)),
    `TimestampTime` DateTime DEFAULT toDateTime(Timestamp),
    `TraceId` String CODEC(ZSTD(1)),
    `SpanId` String CODEC(ZSTD(1)),
    `TraceFlags` UInt8,
    `SeverityText` LowCardinality(String) CODEC(ZSTD(1)),
    `SeverityNumber` UInt8,
    `ServiceName` LowCardinality(String) CODEC(ZSTD(1)),
    `Body` String CODEC(ZSTD(1)),
    `ResourceSchemaUrl` LowCardinality(String) CODEC(ZSTD(1)),
    `ResourceAttributes` Map(LowCardinality(String), String) CODEC(ZSTD(1)),
    `ScopeSchemaUrl` LowCardinality(String) CODEC(ZSTD(1)),
    `ScopeName` String CODEC(ZSTD(1)),
    `ScopeVersion` LowCardinality(String) CODEC(ZSTD(1)),
    `ScopeAttributes` Map(LowCardinality(String), String) CODEC(ZSTD(1)),
    `LogAttributes` Map(LowCardinality(String), String) CODEC(ZSTD(1))
)
ENGINE = Distributed('hdx_cluster_2', 'default', 'otel_logs_toStartOf', rand());

ALTER TABLE otel_logs_toStartOf ON CLUSTER hdx_cluster_2 ADD INDEX text_idx(Body) 
	TYPE text(tokenizer=splitByNonAlpha, preprocessor=lower(Body))
	SETTINGS enable_full_text_index=1;

ALTER TABLE otel_logs_toStartOf ON CLUSTER hdx_cluster_2 MATERIALIZE INDEX text_idx;
```
</details>

<details>
<summary>To test text index detection, first enable full text indexes locally in your users.xml file</summary>

```xml
<clickhouse>
    <profiles>
        <default>
            ...
            <enable_full_text_index>1</enable_full_text_index>
        </default>
    </profiles>
    ...
<clickhouse>
```
</details>

### References



- Linear Issue:
- Related PRs:
2026-03-19 19:41:33 +00:00
Tom Alexander
66445af1fa
refactor: Organize team page with tabs and refactor into separate components (#1878)
## Summary
Refactors team page into various components. Adds tabbed interface to keep things organized.

### Screenshots or video
<img width="1540" height="994" alt="image" src="https://github.com/user-attachments/assets/7103726d-ce95-4622-b51c-c47a98289b01" />
<img width="1424" height="672" alt="image" src="https://github.com/user-attachments/assets/7c2f28be-b87d-4754-bb3d-bcf196051562" />
<img width="1516" height="591" alt="image" src="https://github.com/user-attachments/assets/55b74fc2-32fa-4b3d-8df0-310f5420a53a" />
<img width="1262" height="800" alt="image" src="https://github.com/user-attachments/assets/93ed5b60-3166-4c3c-869f-6c7548759887" />

### How to test locally or on Vercel

Needs to be tested locally. Navigate to the team page.

### References

N/A
2026-03-19 14:16:17 +00:00
Aaron Knudtson
ce8506478d
fix: better source validation and refine required source fields (#1895)
## Summary

Large refactor changing the TSource type to a true discriminated union. This means that the expected fields for `kind: 'log'` will differ from those for `'trace', 'session', 'metrics'`.  This avoids the current laissez faire source type that currently exists, and required extensive changes across the api and app packages. Also includes a nice addition to `useSource` - you can now specify a `kind` field, which will properly infer the type of the returned source. 

This also makes use of discriminators in mongoose. This does change a bit of the way that we create and update sources. Obvious changes to sources have also been made, namely making `timeValueExpression` required on sources. Care has been taken to avoid requiring a migration.

### How to test locally or on Vercel

1. `yarn dev`
2. Play around with the app, especially around source creation, source edits, and loading existing sources from a previous version

### References

- Linear Issue: References HDX-3352
- Related PRs:

Ref: HDX-3352
2026-03-19 12:56:08 +00:00
Warren Lee
a36b350df8
[HDX-3732] Fix AppNav crash for blank user names (#1934)
## Summary

Fixes an AppNav crash caused by blank or whitespace-only user names. The user menu now normalizes the display name before generating avatar initials and includes a regression test for both whitespace-heavy and blank inputs.

### How to test locally or on Vercel

1. Open the app with a user whose name is blank or contains only whitespace and confirm the AppNav renders instead of crashing.
2. Run `cd packages/app && yarn ci:unit src/components/__tests__/AppNavUserMenu.test.tsx`.
3. Optionally run `make ci-lint` and `make ci-unit` to compare against current repo-wide CI status.

### References

- Linear Issue: https://linear.app/clickhouse/issue/HDX-3732/bug-app-crashed-at-the-appnav-component
- Related PRs: None
2026-03-18 23:01:46 +00:00
Tom Alexander
a03cecc850
chore: Add instructions for handling merge conflicts (#1941)
Should help agents be a bit more careful with merge conflict resolution.
2026-03-18 21:33:41 +00:00
Warren Lee
134f1dca47
[HDX-3277] Fix service filter quote escaping on Services page (#1931)
## Summary
- escape service name values when generating the Services page SQL filter to prevent malformed queries when names contain quotes
- switch from string interpolation to `SqlString.format` with a raw left-hand expression and escaped right-hand value

## Why
- service names containing apostrophes/single quotes broke ClickHouse query parsing, causing the Services page to error

Linear: https://linear.app/clickhouse/issue/HDX-3277/service-page-quote-escape-bug
2026-03-18 21:24:07 +00:00
Drew Davis
2b53b8e9ab
chore: Prevent Date.now() and new Date() via eslint (#1937)
## Summary

This PR adds lint rules disallowing Date.now() and new Date(), which can cause unnecessary re-renders.

### Screenshots or video

No behavior changes are expected.

### How to test locally or on Vercel

This can be tested in the preview environment - it is an app-only change

### References



- Linear Issue: Closes HDX-2187
- Related PRs:
2026-03-18 21:19:58 +00:00
dependabot[bot]
50aa44bd39
chore(deps): bump next from 16.1.5 to 16.1.7 (#1932)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-18 17:15:20 -04:00
Tom Alexander
730fcbe6e3
chore: Add dependabot vulnerability notifications (#1942) 2026-03-18 17:02:22 -04:00
Tom Alexander
de914816f7
deps: bump fast-xml-parser to fix CVE-2026-25896 (#1940)
Fixes: CVE-2026-25896
Fixes: HDX-3758
2026-03-18 20:01:45 +00:00