2023-09-13 03:08:05 +00:00
|
|
|
{
|
|
|
|
|
"name": "@hyperdx/api",
|
2026-03-20 21:22:09 +00:00
|
|
|
"version": "2.22.0",
|
2023-09-13 03:08:05 +00:00
|
|
|
"license": "MIT",
|
|
|
|
|
"private": true,
|
|
|
|
|
"engines": {
|
2025-07-29 14:06:57 +00:00
|
|
|
"node": ">=22.16.0"
|
2023-09-13 03:08:05 +00:00
|
|
|
},
|
|
|
|
|
"dependencies": {
|
2026-03-13 14:44:01 +00:00
|
|
|
"@ai-sdk/anthropic": "^3.0.58",
|
2026-03-23 22:27:19 +00:00
|
|
|
"@ai-sdk/openai": "^3.0.47",
|
2025-08-25 19:01:03 +00:00
|
|
|
"@esm2cjs/p-queue": "^7.3.0",
|
2026-03-20 21:22:09 +00:00
|
|
|
"@hyperdx/common-utils": "^0.16.1",
|
migration: migrate to Pino (logger) (#1269)
Summary
Migrates the HyperDX API and related services from Winston to Pino for standardized,
faster, and more structured logging with improved OpenTelemetry integration.
Changes
Core Migration
- Replaced Winston with Pino across all logging infrastructure
- Upgraded @hyperdx/node-opentelemetry from v0.8.2 to v0.9.0 to support Pino
transport
- Removed deprecated dependencies:
- winston and express-winston
- @opentelemetry/host-metrics and @opentelemetry/sdk-metrics (consolidated into
newer OTel SDK)
- Added new dependencies:
- pino and pino-http for core logging
- pino-pretty for development console output
Logger Configuration (packages/api/src/utils/logger.ts)
Production:
- Outputs stringified JSON to stdout via pino/file transport
- Maintains HyperDX transport integration when API key is configured
- Includes full OpenTelemetry trace context (trace_id, span_id, trace_flags)
<img width="830" height="184" alt="Screenshot 2025-10-14 at 4 31 36 PM" src="https://github.com/user-attachments/assets/82e60919-5c4d-4688-a6f5-d54632aef749" />
Development:
- Uses pino-pretty for human-readable, colorized console output
- Hides verbose fields from console: pid, hostname, trace_id, span_id, trace_flags
- HTTP request/response objects excluded from logs via custom serializers
<img width="825" height="350" alt="image" src="https://github.com/user-attachments/assets/64b293d8-bc95-4715-931a-dbf73483d247" />
HTTP Logging:
- Replaced express-winston with pino-http
- Custom log levels based on HTTP status codes (warn for 4xx, error for 5xx+)
- Simplified log messages: HTTP {method} {url}
Error Logging Updates
Updated error logging patterns throughout the codebase to follow Pino's structured
logging conventions:
// Before (Winston)
logger.error('Error message:', error);
// After (Pino)
logger.error({ err: error }, 'Error message');
Ref: HDX-2588
This PR should also address issue: https://github.com/hyperdxio/hyperdx/issues/1035
2025-10-15 17:15:46 +00:00
|
|
|
"@hyperdx/node-opentelemetry": "^0.9.0",
|
2025-07-23 17:55:03 +00:00
|
|
|
"@hyperdx/passport-local-mongoose": "^9.0.1",
|
2024-06-28 22:54:17 +00:00
|
|
|
"@opentelemetry/api": "^1.8.0",
|
2025-03-18 18:07:12 +00:00
|
|
|
"@opentelemetry/host-metrics": "^0.35.5",
|
|
|
|
|
"@opentelemetry/sdk-metrics": "^1.30.1",
|
2026-02-26 02:14:24 +00:00
|
|
|
"@slack/webhook": "^7.0.0",
|
2025-05-23 01:41:35 +00:00
|
|
|
"@types/node": "^22.15.18",
|
2026-03-13 14:44:01 +00:00
|
|
|
"ai": "^6.0.116",
|
2025-11-29 03:30:28 +00:00
|
|
|
"aws4": "^1.13.2",
|
2025-10-07 18:47:10 +00:00
|
|
|
"chrono-node": "^2.9.0",
|
2023-09-13 03:08:05 +00:00
|
|
|
"compression": "^1.7.4",
|
2026-02-26 02:14:24 +00:00
|
|
|
"concurrently": "^9.1.2",
|
2023-09-13 03:08:05 +00:00
|
|
|
"connect-mongo": "^4.6.0",
|
|
|
|
|
"cors": "^2.8.5",
|
2025-10-07 21:39:48 +00:00
|
|
|
"cron": "^4.3.1",
|
2023-09-13 03:08:05 +00:00
|
|
|
"date-fns": "^2.28.0",
|
2024-03-29 01:26:44 +00:00
|
|
|
"express": "^4.19.2",
|
2023-09-13 03:08:05 +00:00
|
|
|
"express-rate-limit": "^6.7.1",
|
|
|
|
|
"express-session": "^1.17.3",
|
2024-02-28 07:45:53 +00:00
|
|
|
"handlebars": "^4.7.8",
|
2024-01-29 18:57:00 +00:00
|
|
|
"http-graceful-shutdown": "^3.1.13",
|
2025-06-09 17:13:29 +00:00
|
|
|
"http-proxy-middleware": "^3.0.5",
|
2023-09-13 03:08:05 +00:00
|
|
|
"jsonwebtoken": "^9.0.0",
|
2026-02-24 18:59:44 +00:00
|
|
|
"lodash": "^4.17.23",
|
2023-09-13 03:08:05 +00:00
|
|
|
"minimist": "^1.2.7",
|
2025-05-30 17:36:41 +00:00
|
|
|
"mongodb": "^6.15.0",
|
|
|
|
|
"mongoose": "^6.13.8",
|
2023-09-13 03:08:05 +00:00
|
|
|
"ms": "^2.1.3",
|
2025-09-08 15:49:09 +00:00
|
|
|
"on-headers": "^1.1.0",
|
2024-03-14 17:38:15 +00:00
|
|
|
"passport": "^0.6.0",
|
2023-09-13 03:08:05 +00:00
|
|
|
"passport-local": "^1.0.0",
|
migration: migrate to Pino (logger) (#1269)
Summary
Migrates the HyperDX API and related services from Winston to Pino for standardized,
faster, and more structured logging with improved OpenTelemetry integration.
Changes
Core Migration
- Replaced Winston with Pino across all logging infrastructure
- Upgraded @hyperdx/node-opentelemetry from v0.8.2 to v0.9.0 to support Pino
transport
- Removed deprecated dependencies:
- winston and express-winston
- @opentelemetry/host-metrics and @opentelemetry/sdk-metrics (consolidated into
newer OTel SDK)
- Added new dependencies:
- pino and pino-http for core logging
- pino-pretty for development console output
Logger Configuration (packages/api/src/utils/logger.ts)
Production:
- Outputs stringified JSON to stdout via pino/file transport
- Maintains HyperDX transport integration when API key is configured
- Includes full OpenTelemetry trace context (trace_id, span_id, trace_flags)
<img width="830" height="184" alt="Screenshot 2025-10-14 at 4 31 36 PM" src="https://github.com/user-attachments/assets/82e60919-5c4d-4688-a6f5-d54632aef749" />
Development:
- Uses pino-pretty for human-readable, colorized console output
- Hides verbose fields from console: pid, hostname, trace_id, span_id, trace_flags
- HTTP request/response objects excluded from logs via custom serializers
<img width="825" height="350" alt="image" src="https://github.com/user-attachments/assets/64b293d8-bc95-4715-931a-dbf73483d247" />
HTTP Logging:
- Replaced express-winston with pino-http
- Custom log levels based on HTTP status codes (warn for 4xx, error for 5xx+)
- Simplified log messages: HTTP {method} {url}
Error Logging Updates
Updated error logging patterns throughout the codebase to follow Pino's structured
logging conventions:
// Before (Winston)
logger.error('Error message:', error);
// After (Pino)
logger.error({ err: error }, 'Error message');
Ref: HDX-2588
This PR should also address issue: https://github.com/hyperdxio/hyperdx/issues/1035
2025-10-15 17:15:46 +00:00
|
|
|
"pino": "^10.0.0",
|
|
|
|
|
"pino-http": "^11.0.0",
|
2024-02-28 07:45:53 +00:00
|
|
|
"promised-handlebars": "^2.0.1",
|
2025-05-23 01:41:35 +00:00
|
|
|
"protobufjs": "^7.5.2",
|
2023-09-13 03:08:05 +00:00
|
|
|
"serialize-error": "^8.1.0",
|
|
|
|
|
"uuid": "^8.3.2",
|
2025-10-07 18:47:10 +00:00
|
|
|
"zod": "3.25",
|
2023-09-13 03:08:05 +00:00
|
|
|
"zod-express-middleware": "^1.4.0"
|
|
|
|
|
},
|
|
|
|
|
"devDependencies": {
|
2026-03-20 15:13:19 +00:00
|
|
|
"@stoplight/spectral-cli": "^6.15.0",
|
2023-09-13 03:08:05 +00:00
|
|
|
"@types/compression": "^1.7.3",
|
|
|
|
|
"@types/cors": "^2.8.14",
|
|
|
|
|
"@types/express": "^4.17.13",
|
|
|
|
|
"@types/express-session": "^1.17.7",
|
|
|
|
|
"@types/jest": "^28.1.1",
|
|
|
|
|
"@types/lodash": "^4.14.198",
|
|
|
|
|
"@types/minimist": "^1.2.2",
|
|
|
|
|
"@types/ms": "^0.7.31",
|
|
|
|
|
"@types/passport-local": "^1.0.34",
|
|
|
|
|
"@types/supertest": "^2.0.12",
|
2025-04-29 17:54:34 +00:00
|
|
|
"@types/swagger-jsdoc": "^6",
|
2023-09-13 03:08:05 +00:00
|
|
|
"@types/uuid": "^8.3.4",
|
2025-02-27 08:07:47 +00:00
|
|
|
"jest": "^28.1.3",
|
2023-11-30 21:55:45 +00:00
|
|
|
"migrate-mongo": "^11.0.0",
|
2023-09-13 03:08:05 +00:00
|
|
|
"nodemon": "^2.0.20",
|
migration: migrate to Pino (logger) (#1269)
Summary
Migrates the HyperDX API and related services from Winston to Pino for standardized,
faster, and more structured logging with improved OpenTelemetry integration.
Changes
Core Migration
- Replaced Winston with Pino across all logging infrastructure
- Upgraded @hyperdx/node-opentelemetry from v0.8.2 to v0.9.0 to support Pino
transport
- Removed deprecated dependencies:
- winston and express-winston
- @opentelemetry/host-metrics and @opentelemetry/sdk-metrics (consolidated into
newer OTel SDK)
- Added new dependencies:
- pino and pino-http for core logging
- pino-pretty for development console output
Logger Configuration (packages/api/src/utils/logger.ts)
Production:
- Outputs stringified JSON to stdout via pino/file transport
- Maintains HyperDX transport integration when API key is configured
- Includes full OpenTelemetry trace context (trace_id, span_id, trace_flags)
<img width="830" height="184" alt="Screenshot 2025-10-14 at 4 31 36 PM" src="https://github.com/user-attachments/assets/82e60919-5c4d-4688-a6f5-d54632aef749" />
Development:
- Uses pino-pretty for human-readable, colorized console output
- Hides verbose fields from console: pid, hostname, trace_id, span_id, trace_flags
- HTTP request/response objects excluded from logs via custom serializers
<img width="825" height="350" alt="image" src="https://github.com/user-attachments/assets/64b293d8-bc95-4715-931a-dbf73483d247" />
HTTP Logging:
- Replaced express-winston with pino-http
- Custom log levels based on HTTP status codes (warn for 4xx, error for 5xx+)
- Simplified log messages: HTTP {method} {url}
Error Logging Updates
Updated error logging patterns throughout the codebase to follow Pino's structured
logging conventions:
// Before (Winston)
logger.error('Error message:', error);
// After (Pino)
logger.error({ err: error }, 'Error message');
Ref: HDX-2588
This PR should also address issue: https://github.com/hyperdxio/hyperdx/issues/1035
2025-10-15 17:15:46 +00:00
|
|
|
"pino-pretty": "^13.1.1",
|
2023-09-13 03:08:05 +00:00
|
|
|
"rimraf": "^4.4.1",
|
|
|
|
|
"supertest": "^6.3.1",
|
2025-05-13 00:19:38 +00:00
|
|
|
"swagger-jsdoc": "^6.2.8",
|
|
|
|
|
"swagger-ui-express": "^5.0.1",
|
2026-01-07 17:38:01 +00:00
|
|
|
"ts-jest": "^29.4.5",
|
2023-09-13 03:08:05 +00:00
|
|
|
"ts-node": "^10.8.1",
|
2023-11-18 02:41:41 +00:00
|
|
|
"tsc-alias": "^1.8.8",
|
2023-11-17 21:31:24 +00:00
|
|
|
"tsconfig-paths": "^4.2.0",
|
2025-11-24 21:19:42 +00:00
|
|
|
"typescript": "^5.9.3"
|
2023-09-13 03:08:05 +00:00
|
|
|
},
|
|
|
|
|
"scripts": {
|
2025-10-21 09:27:47 +00:00
|
|
|
"start": "node ./build/index.js",
|
2025-12-11 23:07:16 +00:00
|
|
|
"dev": "DOTENV_CONFIG_PATH=.env.development nodemon --exec 'ts-node' --transpile-only -r tsconfig-paths/register -r dotenv-expand/config -r '@hyperdx/node-opentelemetry/build/src/tracing' ./src/index.ts",
|
|
|
|
|
"dev-task": "DOTENV_CONFIG_PATH=.env.development nodemon --exec 'ts-node' --transpile-only -r tsconfig-paths/register -r dotenv-expand/config -r '@hyperdx/node-opentelemetry/build/src/tracing' ./src/tasks/index.ts",
|
2025-10-21 09:27:47 +00:00
|
|
|
"build": "rimraf ./build && tsc && tsc-alias && cp -r ./src/opamp/proto ./build/opamp/",
|
2025-08-18 17:16:05 +00:00
|
|
|
"lint": "npx eslint --quiet . --ext .ts",
|
|
|
|
|
"lint:fix": "npx eslint . --ext .ts --fix",
|
2026-03-20 15:13:19 +00:00
|
|
|
"ci:lint": "yarn lint && yarn tsc --noEmit && yarn lint:openapi",
|
2026-03-11 20:32:02 +00:00
|
|
|
"ci:int": "DOTENV_CONFIG_PATH=.env.test DOTENV_CONFIG_OVERRIDE=true jest --runInBand --ci --forceExit --coverage",
|
|
|
|
|
"dev:int": "DOTENV_CONFIG_PATH=.env.test DOTENV_CONFIG_OVERRIDE=true jest --runInBand --forceExit --coverage",
|
2023-11-30 21:55:45 +00:00
|
|
|
"dev:migrate-db-create": "ts-node node_modules/.bin/migrate-mongo create -f migrate-mongo-config.ts",
|
2023-12-03 22:06:50 +00:00
|
|
|
"dev:migrate-db": "ts-node node_modules/.bin/migrate-mongo up -f migrate-mongo-config.ts",
|
|
|
|
|
"dev:migrate-ch-create": "migrate create -ext sql -dir ./migrations/ch -seq",
|
2025-04-29 17:54:34 +00:00
|
|
|
"dev:migrate-ch": "migrate -database 'clickhouse://localhost:9000?database=default&x-multi-statement=true' -path ./migrations/ch up",
|
2026-03-20 15:13:19 +00:00
|
|
|
"docgen": "ts-node scripts/generate-api-docs.ts",
|
|
|
|
|
"lint:openapi": "yarn docgen && spectral lint openapi.json"
|
2023-09-13 03:08:05 +00:00
|
|
|
}
|
[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
|
|
|
}
|