Skip to content

Commit 2f59b4f

Browse files
Merge branch 'main' into drew/backport-dashboard-reassignment
2 parents 0c16563 + 917c9ca commit 2f59b4f

59 files changed

Lines changed: 2733 additions & 242 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hyperdx/api': patch
3+
---
4+
5+
fix: A grouped alert whose group vanishes from the data now resolves with the group's values in `{{attributes.*}}` (alert title and message) and `{{var.*}}` (webhook body)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@hyperdx/common-utils': patch
3+
'@hyperdx/app': patch
4+
---
5+
6+
fix: count legacy STATUS_CODE_ERROR spans as errors on the service map and trace
7+
waterfall

‎.changeset/mcp-promql-sources.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@hyperdx/api': minor
3+
---
4+
5+
feat: Describe PromQL sources in MCP and hide them when PromQL is disabled
6+
7+
`clickstack_describe_source` now returns the label names and metric names of a PromQL source, from either a ClickHouse TimeSeries table or a Prometheus-compatible endpoint, instead of a column schema. `clickstack_list_sources` and `clickstack_describe_source` show which backend a PromQL source uses, and for TimeSeries tables explain how to read them with `clickstack_sql`. Prometheus endpoint sources no longer show their placeholder table. When `ENABLE_PROMQL` is off, MCP hides PromQL sources from listing, describing and deleting, and `clickstack_save_source` no longer accepts `kind: "promql"`.

‎.changeset/mcp-promql-tiles.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hyperdx/api': patch
3+
---
4+
5+
feat: MCP dashboard tools read and write PromQL tiles and PROMETHEUS_LABEL filters when PromQL is enabled, and hide but keep them when it is disabled
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@hyperdx/app': patch
3+
'@hyperdx/common-utils': patch
4+
---
5+
6+
feat: fall back to server MergeTree settings to detect persisted `_block_number` and `_block_offset` columns when the table's CREATE query omits them
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@hyperdx/api': patch
3+
---
4+
5+
fix: Authenticate to Prometheus connections whose host includes credentials
6+
7+
A Prometheus connection host such as `http://user:pass@prometheus:9090` made every PromQL query fail with "Failed to reach Prometheus", because `fetch` rejects URLs that carry credentials. The credentials are now sent as a Basic auth header.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hyperdx/api': minor
3+
---
4+
5+
feat: filter the v2 list alerts endpoint by tag, search, source and state

‎docs/alert-webhook-template-variables.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ a HyperDX alert without parsing the human-readable message body.
2121
| `{{thresholdMax}}` | number | Upper bound of a `between`/`outside` condition. Always unset for every other comparator, even if the alert was once a range, so guard it (see below). |
2222
| `{{value}}` | number | The value that triggered or resolved the alert. |
2323
| `{{groupKey}}` | string | The breaching group, for a grouped alert. |
24-
| `{{var}}` | object | The breaching group's values by group-by column or SQL alias. Use one value at a time, e.g. `{{var.customer_id}}`, or `{{var.[service.name]}}` for a name with dots. Empty when not grouped, and on the resolve of a group that has no rows left. |
24+
| `{{var}}` | object | The breaching group's values by group-by column or SQL alias. Use one value at a time, e.g. `{{var.customer_id}}`, or `{{var.[service.name]}}` for a name with dots. Empty when not grouped. |
2525
| `{{sourceQuery}}` | string | The condition behind the alert — search expression or SQL (see below). |
2626
| `{{teamId}}` | string | Team the alert belongs to. |
2727
| `{{note}}` | string | The alert's freeform note — commonly a runbook link. |

‎packages/api/openapi.json‎

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6386,7 +6386,7 @@
63866386
"/api/v2/alerts": {
63876387
"get": {
63886388
"summary": "List Alerts",
6389-
"description": "Retrieves alerts for the authenticated team (paginated). Results are capped at `limit` (default and maximum 1000). When more records exist than are returned, `meta.total` exceeds `data.length`; clients with large collections must page with `limit`/`offset` to retrieve them all.",
6389+
"description": "Retrieves alerts for the authenticated team (paginated). Results are capped at `limit` (default and maximum 1000). When more records exist than are returned, `meta.total` exceeds `data.length`; clients with large collections must page with `limit`/`offset` to retrieve them all. Optional filters narrow the result set, and `meta.total` counts only the matching alerts.",
63906390
"operationId": "listAlerts",
63916391
"tags": [
63926392
"Alerts"
@@ -6414,6 +6414,54 @@
64146414
"default": 0
64156415
},
64166416
"description": "Number of alerts to skip before returning results."
6417+
},
6418+
{
6419+
"name": "tag",
6420+
"in": "query",
6421+
"required": false,
6422+
"schema": {
6423+
"type": "array",
6424+
"items": {
6425+
"type": "string",
6426+
"maxLength": 32
6427+
},
6428+
"maxItems": 50
6429+
},
6430+
"description": "Only return alerts that have any of the given tags. Repeat the parameter to pass several tags. Matches the tags stored on the alert, not tags inherited from the linked dashboard or saved search."
6431+
},
6432+
{
6433+
"name": "search",
6434+
"in": "query",
6435+
"required": false,
6436+
"schema": {
6437+
"type": "string",
6438+
"maxLength": 512
6439+
},
6440+
"description": "Only return alerts whose display name contains this text (case-insensitive). Matches the display name stored on the alert, not a name derived from the linked dashboard or saved search."
6441+
},
6442+
{
6443+
"name": "source",
6444+
"in": "query",
6445+
"required": false,
6446+
"schema": {
6447+
"type": "array",
6448+
"items": {
6449+
"$ref": "#/components/schemas/AlertSource"
6450+
}
6451+
},
6452+
"description": "Only return alerts of any of the given sources. Repeat the parameter to pass several sources."
6453+
},
6454+
{
6455+
"name": "state",
6456+
"in": "query",
6457+
"required": false,
6458+
"schema": {
6459+
"type": "array",
6460+
"items": {
6461+
"$ref": "#/components/schemas/AlertState"
6462+
}
6463+
},
6464+
"description": "Only return alerts in any of the given states. Repeat the parameter to pass several states."
64176465
}
64186466
],
64196467
"responses": {
@@ -6463,6 +6511,16 @@
64636511
}
64646512
}
64656513
},
6514+
"400": {
6515+
"description": "Invalid query parameters",
6516+
"content": {
6517+
"application/json": {
6518+
"schema": {
6519+
"$ref": "#/components/schemas/Error"
6520+
}
6521+
}
6522+
}
6523+
},
64666524
"401": {
64676525
"description": "Unauthorized",
64686526
"content": {

‎packages/api/src/controllers/alerts.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from '@hyperdx/common-utils/dist/guards';
1212
import { isRangeThresholdType } from '@hyperdx/common-utils/dist/types';
1313
import { groupBy } from 'lodash';
14-
import { Types } from 'mongoose';
14+
import { type FilterQuery, Types } from 'mongoose';
1515
import { z } from 'zod';
1616

1717
import { recordOnboardingTaskCompletion } from '@/controllers/user';
@@ -389,8 +389,11 @@ export const updateAlert = async (
389389
return alert;
390390
};
391391

392-
export const countAlerts = async (teamId: ObjectId) => {
393-
return Alert.countDocuments({ team: teamId });
392+
export const countAlerts = async (
393+
teamId: ObjectId,
394+
filter: FilterQuery<IAlert> = {},
395+
) => {
396+
return Alert.countDocuments({ ...filter, team: teamId });
394397
};
395398

396399
export const getAlertById = async (
@@ -506,8 +509,9 @@ const DISPLAY_REF_POPULATE = [
506509
export const getAlertsWithDisplayRefs = async (
507510
teamId: ObjectId,
508511
{ limit, offset }: { limit: number; offset: number },
512+
filter: FilterQuery<IAlert> = {},
509513
) => {
510-
return Alert.find({ team: teamId })
514+
return Alert.find({ ...filter, team: teamId })
511515
.sort({ _id: 1 })
512516
.skip(offset)
513517
.limit(limit)

0 commit comments

Comments
 (0)