hyperdx/packages/api
Brett Adams cbe319c03a
fix: resolve "no query support for metric type" error in external API (#1708)
## Summary

- Fix external API `POST /api/v2/charts/series` returning `"no query support for metric type=gauge"` when `field` is passed without `metricName`
- When querying metric sources, the API now falls back to using `field` as the `metricName` and defaults `valueExpression` to `'Value'` (the ClickHouse column), matching how the dashboard UI builds chart configs
- Backward compatible: when both `metricName` and `field` are provided, behavior is unchanged

## Root Cause

`buildChartConfigFromRequest()` mapped `field` to `valueExpression` but never populated `metricName` from it. Downstream, `translateMetricChartConfig()` requires both `metricType` AND `metricName` to be truthy — when `metricName` was undefined, it fell through to the catch-all error.

## Test plan

- [ ] Added integration tests for gauge, sum, and histogram metrics using `field` without `metricName`
- [ ] Verify existing metric tests still pass (backward compatible — passing both `metricName` and `field` works as before)
- [ ] Verify non-metric source queries are unaffected

Related: https://github.com/hyperdxio/hyperdx/issues/1418, https://github.com/hyperdxio/hyperdx/issues/1214

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <81847+claude@users.noreply.github.com>
2026-02-23 15:05:52 +00:00
..
docs/auto_provision feat: Set up default sources/connections with env var in server mode (#817) 2025-05-16 23:17:37 +00:00
migrations chore: Update to next 16, react 19, add react compiler (#1434) 2025-12-04 23:40:59 +00:00
scripts chore: Add automatic api doc generation (#1397) 2025-11-21 21:14:02 +00:00
src fix: resolve "no query support for metric type" error in external API (#1708) 2026-02-23 15:05:52 +00:00
.Dockerignore first commit 2023-09-12 20:08:05 -07:00
.env.development fix: Avoid using bodyExpression for trace sources (#1722) 2026-02-11 13:01:12 +00:00
.env.e2e chore: Use local clickhouse instance for playwright tests (#1711) 2026-02-13 15:43:12 +00:00
.env.test Clean Up Integration Test Console Output (#1566) 2026-01-07 17:38:01 +00:00
CHANGELOG.md Release HyperDX (#1752) 2026-02-21 07:08:56 +01:00
Dockerfile fix: Set correct github URL as image source in Dockerfiles (#1698) 2026-02-04 16:11:31 +00:00
eslint.config.mjs chore(eslint): add @typescript-eslint/no-unsafe-type-assertion rule (#1534) 2025-12-30 16:01:11 +00:00
jest.config.js ci: port v1 metric tests - Pt1 (#638) 2025-02-27 08:07:47 +00:00
jest.setup.ts Clean Up Integration Test Console Output (#1566) 2026-01-07 17:38:01 +00:00
migrate-mongo-config.ts feat: setup clickhouse migration tool + update metrics schema (add is_delta + is_monotonic fields) (#138) 2023-12-03 14:06:50 -08:00
nodemon.json Improve common-utils build performance and add support for .env.local (#1466) 2025-12-11 23:07:16 +00:00
openapi.json feat: Add config property to external dashboard APIs. Deprecate series. (#1763) 2026-02-20 08:48:25 -05:00
package.json Release HyperDX (#1752) 2026-02-21 07:08:56 +01:00
tsconfig.build.json fix: Update tsconfigs to resolve IDE type errors (#1150) 2025-09-11 08:55:14 -04:00
tsconfig.json Clean Up Integration Test Console Output (#1566) 2026-01-07 17:38:01 +00:00