Commit graph

120 commits

Author SHA1 Message Date
Warren Lee
53a4b67262
chore: update otel collector base image to 0.147.0 (#1845)
## Summary
- Bump OpenTelemetry Collector base images (`opentelemetry-collector-contrib` and `opentelemetry-collector-opampsupervisor`) from **0.145.0** to **0.147.0**
- Updated in both `docker/otel-collector/Dockerfile` and `docker/hyperdx/Dockerfile`
2026-03-04 20:18:16 +00:00
Rahul
ef66cba8cd
build(deps): add security resolutions for vulnerable npm packages (#1740)
## Summary

Addresses npm security vulnerabilities in transitive dependencies. Prefer direct dependency upgrades over broad resolutions where possible.

## Changes

**Direct upgrade:**
- **`@slack/webhook`**: `^6.1.0` → `^7.0.0` — v7 natively uses axios v1, eliminating the axios@0.21.4 SSRF/redirect vulnerabilities. Only breaking change in v7 is dropping Node <18 (we're on Node 22).

**Resolutions for transitive deps with no direct upgrade path:**
- **`fast-xml-parser`**: `^4.4.0` — fixes prototype pollution (High)
- **`systeminformation`**: `^5.24.0` — fixes command injection (High)

## Removed/Not Done

- `axios` resolution removed — covered by the `@slack/webhook` upgrade instead
- `tar` resolution removed — was a v6→v7 major jump on build-only tools (`cacache`, `node-gyp`); not present in the production image
- `glob` resolution removed — was breaking test coverage tooling (`test-exclude@6` depends on glob@^7)

## Related

Follow-up to #1731 which addressed base image vulnerabilities (Node, Go, ClickHouse).
2026-02-26 02:14:24 +00:00
Aaron Knudtson
8772f5e294
chore: update clickhouse version for compose files to 26.1 (#1791) 2026-02-24 15:24:43 -05:00
Warren Lee
36da6ff4d8
chore: resolve collector CVE-2025-15467 (#1761) 2026-02-19 11:45:50 -08:00
Warren Lee
4c42fdc3a4
fix(otel-collector): improve log level extraction with word boundaries in regex (#1747)
For a log line like 
```
x-amz-id-2: WxwS/N175wqLyRlzCXLpGZGszCEbQA0f63uFgdQN1qfcPr2IAmwE/P7HF2b1NdZLg18pNLF3ecTw5CrItXJid/uLe+fxh3jMBiJ7UlUxidw=
```
The level will be inferred as fatal because it contains `CrIt`, which is incorrect.

To fix this, we need to add a word boundary at the start

Ref: HDX-3439


CLAUDE: made a mistake.
```
 Test expects "ALERTING" to match "alert" keyword → "ALERTING" won't match with word boundary because "alert" is a substring, not at a word boundary. Expected should be "info",9,"ALERTING system engaged" not "fatal",21.
``` 
-> incorrect statement
2026-02-18 22:16:07 +00:00
Warren Lee
18c2b37599
fix: Fallback to legacy schema when CH JSON feature gate is on (#1748)
Currently users will need to add an extra flag to enable it `HYPERDX_OTEL_EXPORTER_CREATE_LEGACY_SCHEMA`=true. Ideally the JSON schema should be created if feature gate is enable `OTEL_AGENT_FEATURE_GATE_ARG='--feature-gates=clickhouse.json'`

Ref: HDX-3428
2026-02-18 16:42:44 +00:00
Rahul
b991e7bd37
fix: improve Docker Scout scores for clickstack images (#1731)
Updates base images and patches vulnerable dependencies:
- Node.js 22.16.0 -> 22.22-alpine
- Go 1.25 -> 1.26-alpine
- Express 4.19.2 -> 4.22.1
- Cookie, send, serve-static, and other npm packages
- Fix ENV format warnings in Dockerfile

Reduces vulnerabilities from 178 to 168 (9C, 52H, 98M, 9L). Tested: all services start correctly, health checks pass.
2026-02-13 18:21:19 +00:00
Tom Alexander
75ff28dd68
chore: Use local clickhouse instance for playwright tests (#1711)
TLDR: This PR changes playwright full-stack tests to run against a local clickhouse instance (with seeded data) instead of relying on the clickhouse demo server, which can be unpredictable at times. This workflow allows us to fully control the data to make tests more predictable.

This PR: 
* Adds local CH instance to the e2e dockerfile
* Adds a schema creation script
* Adds a data seeding script
* Updates playwright config 
* Updates various tests to change hardcoded fields, metrics, or areas relying on play demo data
* Updates github workflow to use the dockerfile instead of separate services
* Runs against a local clickhouse instead of the demo server

Fixes: HDX-3193
2026-02-13 15:43:12 +00:00
Rahul
ebbfa2410e
fix: improve Docker Scout score for otel-collector image (#1727)
- Upgrade OTel collector-contrib and opampsupervisor from 0.136.0 to 0.145.0 to resolve Go stdlib CVEs from outdated binaries
- Pin Alpine base to 3.21 with fresh digest replacing stale alpine:latest pin
- Add HEALTHCHECK to both dev and prod stages using the health_check extension on port 13133
- Fix Makefile otel-collector build targets to use repo-root context with -f flag, matching the repo-root relative COPY paths

Followup from #1697 #1698
2026-02-11 20:50:22 +00:00
Drew Davis
c3bc43add1
fix: Avoid using bodyExpression for trace sources (#1722)
Closes HDX-3361

# Summary

This PR prevents various query errors caused by references to `bodyExpression` on trace sources. The `bodyExpression` should not exist on trace sources, and cannot be edited in the source form. Despite that, the `bodyExpression` would be set on trace sources during source inference.

- The `getEventBody` helper function will now correctly use the `spanNameExpression` field instead for trace sources. A few direct references to `bodyExpression` have been updated to `getEventBody` calls.
- Source configuration inference will no longer populate the `bodyExpression` for trace sources, and the default trace source will not be created with a `bodyExpression`.
2026-02-11 13:01:12 +00:00
Warren Lee
629fb52edc
feat: introduce HYPERDX_OTEL_EXPORTER_TABLES_TTL (ClickStack OTel collector) (#1720)
- Users can configure table TTLs via `HYPERDX_OTEL_EXPORTER_TABLES_TTL`, which defaults to 720h.
- Add TTL to metric tables

Ref: HDX-3365
2026-02-10 16:00:38 +00:00
Adrian Philipp
5c895ff34a
fix: allow overriding default connections (#1710)
Co-authored-by: Aaron Knudtson <87577305+knudtty@users.noreply.github.com>
Co-authored-by: Warren Lee <5959690+wrn14897@users.noreply.github.com>
2026-02-10 07:56:28 +01:00
Warren Lee
baf18da4c0
feat: add TLS support for OTel collector migration script (#1714)
Moved the inline goose CLI script to its own go script.
For the seed DDLs, we don’t create the version tables, and they should all be idempotent.
2026-02-10 02:40:28 +00:00
Warren Lee
3dae0e012f
fix: copy otel-collector schema directory to AIO image (#1700) 2026-02-04 12:27:23 -08:00
Hannes Leutloff
8f1026089d
fix: Set correct github URL as image source in Dockerfiles (#1698)
I went ahead and looked for more occurences of the issue i raised #1697 and fixed them. I hope that's alright with you.
2026-02-04 16:11:31 +00:00
Warren Lee
683ec1a80e
fix: add TLS parameters for https ClickHouse endpoints in goose DB string (#1689)
Need to add `secure=true&skip_verify=false` TLS params for https (CHC)

Ref: https://github.com/pressly/goose/pull/796/changes
2026-02-02 23:13:56 +00:00
Warren Lee
c2a6193393
feat: add OTLP auth token support for standalone mode (#1684)
Ref: HDX-3317
2026-02-02 17:25:38 +00:00
Warren Lee
6f4c8efba0
feat: Enforce ClickStack schemas by default (#1682)
- Introduce a new flag `HYPERDX_OTEL_EXPORTER_CREATE_LEGACY_SCHEMA` (default to false) to otel collector
- Custom ClickStack schemas should be enforced by default
- ClickHouse tables migration logs should be stored in `clickstack_db_version_xxx` tables
- The collector will run the migration at startup and retry if it fails to connect to the database (using exponential backoff).
- Fully backward compatible

Ref: HDX-3301
2026-02-02 16:39:20 +00:00
Rahul
0d321ea15f
update Docker images for Docker Scout Score improvements (#1680)
Co-authored-by: Himanshu Kapoor <himanshu.kapoor@clickhouse.com>
2026-01-29 16:37:22 -06:00
Warren Lee
43de467864
feat: allow otel-collector to run without OpAMP server (#1672)
Today, users have to set up an OpAMP server to run with our clickstack OTel collector. Instead, we should allow users to disable OpAMP when they're using ClickHouse Cloud with the clickstack integration.

This can be determined by `OPAMP_SERVER_URL` not being defined by the user.

The end result is that a user can do

```
docker run \
  -e CLICKHOUSE_ENDPOINT=${CLICKHOUSE_ENDPOINT} \
  -e CLICKHOUSE_USER=default \
  -e CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD} \
  -p 8080:8080 -p 4317:4317 -p 4318:4318 \
  clickhouse/clickstack-otel-collector:latest
```

Ref: HDX-3300
2026-01-29 17:50:24 +00:00
Dan Hable
d07e30d5fb
feat: associate logged in user to clickhouse query (#1636)
Allows setting a custom setting prefix on a connection. When set in HyperDX and the ClickHouse settings, the HyperDX app will set a custom setting for each query. These are recorded in the query log and can be used to identify which user issues the query.

## Testing

The commit also updates the local dev ClickHouse instance to support a custom setting prefix of `hyeprdx`. After running `make dev-up`, you should be able to edit the connection and set the the prefix to `hyperdx`. 

<img width="955" height="197" alt="Screenshot 2026-01-21 at 1 23 14 PM" src="https://github.com/user-attachments/assets/607fc945-d93f-4976-9862-3118b420c077" />

After saving, just allow the app to live tail a source like logs. If you connect to the ClickHouse database, you should then be able to run

```
SELECT query, Settings
FROM system.query_log
WHERE has(mapKeys(Settings), 'hyperdx_user')
FORMAT Vertical
```

and then see a bunch of queries with the user set to your logged in user.

```
Row 46:
───────
query:    SELECT Timestamp, ServiceName, SeverityText, Body, TimestampTime FROM default.otel_logs WHERE (TimestampTime >= fromUnixTimestamp64Milli(_CAST(1769022372269, 'Int64'))) AND (TimestampTime <= fromUnixTimestamp64Milli(_CAST(1769023272269, 'Int64'))) ORDER BY (TimestampTime, Timestamp) DESC LIMIT _CAST(0, 'Int32'), _CAST(200, 'Int32') FORMAT JSONCompactEachRowWithNamesAndTypes
Settings: {'use_uncompressed_cache':'0','load_balancing':'in_order','log_queries':'1','max_memory_usage':'10000000000','cancel_http_readonly_queries_on_client_close':'1','parallel_replicas_for_cluster_engines':'0','date_time_output_format':'iso','hyperdx_user':'\'dan@hyperdx.io\''}
```
2026-01-28 14:58:05 +00:00
Dale McDiarmid
66f56cb1d0
chore: Move schema configs to file (#1635)
Co-authored-by: Tom Alexander <tom.alexander@clickhouse.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-28 14:52:54 +01:00
Drew Davis
1cf8cebb4b
feat: Support JSON Sessions (#1628) 2026-01-21 19:25:39 -05:00
Dan Hable
6537884825
build: remove lingering references to log-rotator.sh (#1520)
We removed the rotator script when we used the named pipe approach to the otel collector logging. There were some references left over that caused the docker build to fail.
2025-12-23 16:22:46 +00:00
Dan Hable
0bb7407747
fix: support otel collector logging with minimal storage (#1509)
This commit sets up a FIFO named pipe with the same name/path that the otel collector and supervisor are expecting. By starting to tail that pipe before starting the collector, we can send log files to stdio without the memory required by the `passthrough_logs` feature or and storage on the volume.

---
Running locally in orbstack, we're still seeing logs on stdout

<img width="2316" height="1452" alt="image" src="https://github.com/user-attachments/assets/f86961cf-6ea4-4faa-82f8-54f9596b5f16" />

but the file size for `agent.log` remains at 0

<img width="1606" height="838" alt="image" src="https://github.com/user-attachments/assets/6feb9470-e220-4d8a-b5b3-10a221926158" />

disk usage stats also remain stable

<img width="1728" height="860" alt="image" src="https://github.com/user-attachments/assets/ff5fe593-4936-446e-9396-606fb495d60d" />
2025-12-19 19:18:33 +00:00
Daniel Lockyer
99ea6395cf
chore: drop npx prefix from concurrently commands (#1505)
Co-authored-by: Drew Davis <drew.davis@clickhouse.com>
2025-12-19 11:55:02 -05:00
Dan Hable
7a53880356
Revert "fix(otel-collector): fix log rotation script (#1479)" (#1495)
This reverts commit 0b19f915e8.
2025-12-17 17:27:51 +00:00
Dan Hable
0b19f915e8
fix(otel-collector): fix log rotation script (#1479)
There were two issues with the log rotation script:

1. Logs could be lost since copying and then truncating the file might not finish before logs arrive.

2. The otel collector application will keeps the file handle and offset cached. After truncating, it will write starting at the last offset leaving the unallocated garbage in the beginning of the file. This garbage uses space.

This commit moves the file instead of copying. That allows the collector to continue writing to the rolled file until a SIGHUP is sent. This causes a config refresh, which also opens a new log file. After, the rolled file and the new log file have correct sizes.

--
**ADDITIONAL NOTES**: 

Claude's code review is not accurate here.

* The alpine image is based on busybox and fuser is a command implemented by busybox. This can be verified by just running the collector and watching the log rotate behavior.
* The mv command updates the name of the file in the file system but doesn't change the inode number. A process only uses the file path the first time the file is open to resolve it into a inode number. Moving the file changes the name but doesn't change the inode number so the process will continue to write to that file.
2025-12-15 16:08:11 +00:00
Tom Alexander
52d2798582
chore: Update to next 16, react 19, add react compiler (#1434)
fixes: HDX-2956

Co-authored-by: Brandon Pereira <7552738+brandon-pereira@users.noreply.github.com>
2025-12-04 23:40:59 +00:00
Jarrad
7cf4ba4d70
allow configuring the app's listen address with HYPERDX_APP_LISTEN_HOSTNAME (#1344) 2025-11-25 16:22:07 +01:00
Aaron Knudtson
19c5085cde
chore: split json otel collector to enable both during dev (#1247)
Gets us closer to a staging instance of json

<img width="216" height="174" alt="image" src="https://github.com/user-attachments/assets/b5cc3cf8-aef0-4ba4-9e9a-8c1d4fad5451" />


Co-authored-by: Warren <5959690+wrn14897@users.noreply.github.com>
2025-11-04 21:16:41 +00:00
Ruud Kamphuis
c6ad250f3d
Enable auto-provisioning for no-auth mode (#1297)
Co-authored-by: Aaron Knudtson <87577305+knudtty@users.noreply.github.com>
2025-10-29 09:42:39 -04:00
Warren
131a1c1edb
revert: api esbuild (#1280)
This PR reverts https://github.com/hyperdxio/hyperdx/pull/937

Ref: HDX-2620
2025-10-21 09:27:47 +00:00
Brandon Pereira
e032af5509
attempt to ensure otel collector logs go to stdout (#1228) 2025-10-01 11:51:24 -06:00
Drew Davis
45e8e1b62d
fix: Update tsconfigs to resolve IDE type errors (#1150) 2025-09-11 08:55:14 -04:00
Aaron Knudtson
8568580127
feat: add custom ingestion key via INGESTION_API_KEY (#1112)
Closes HDX-2283

This adds an environment variable `INGESTION_API_KEY` that can be set by the user. This apiKey will be valid and accepted by the Otel collector. It is in addition to the autogenerated apiKey and will not show in the team settings apiKey section.
2025-08-29 20:10:46 +00:00
Warren
3636fc570d
style: update otelcol config file volume mount from dev stage (#1091) 2025-08-21 14:03:45 +00:00
Warren
56fd856d7a
fix: otelcol process in aio build (#1085) 2025-08-20 19:17:39 +00:00
Warren
d29e2bcb67
fix: handle the case when CUSTOM_OTELCOL_CONFIG_FILE is not specified (#1080)
plus fixing startup issue when the team isn't created yet
2025-08-19 17:08:49 +00:00
Warren
ab50b12a6b
feat: support custom otel collector config (BETA) (#1074)
plus the fix to reduce bloat in opamp agent logs

Users should be able to mount the custom otel collector config file and add/overrider receivers, processors and exporters
For example:
```
receivers:
  hostmetrics:
    collection_interval: 5s
    scrapers:
      cpu:
      load:
      memory:
      disk:
      filesystem:
      network:
# override the default processors
processors:
  batch:
    send_batch_size: 10000
    timeout: 10s
  memory_limiter:
    limit_mib: 2000
service:
  pipelines:
    metrics/hostmetrics:
      receivers: [hostmetrics]
      # attach existing processors
      processors: [memory_limiter, batch]
      # attach existing exporters
      exporters: [clickhouse]
```
This will add a new `hostmetrics` receiver + `metrics/hostmetrics` pipeline and update existing `batch` + `memory_limiter` processors 

WARNING: This feature is still in beta, and future updates may change how it works, potentially affecting compatibility

Ref: HDX-1865
2025-08-18 21:22:43 +00:00
Warren
6c134035c4
fix: use '--kill-others-on-fail' to prevent processes from terminating when RUN_SCHEDULED_TASKS_EXTERNALLY is enabled (#1015)
Ref: HDX-2044

Co-authored-by: Dan Hable <418679+dhable@users.noreply.github.com>
2025-07-24 21:56:38 +00:00
Mike Shi
ecb0f2c889
feat: Add JSON support to all in one build (#972) 2025-07-03 22:54:59 +00:00
Mike Shi
52ca1823a4
feat: Add ClickHouse JSON Type Support (#969)
- Upgrades ClickHouse to 25.6, fixes breaking config change, needed for latest JSON type
- Upgrades OTel Collector to 0.129.1, fixes breaking config change, needed for latest JSON support in exporter
- Upgrades OTel OpAMP Supervisor to 0.128.0
- Fixes features to support JSON type columns in OTel in HyperDX (filtering, searching, graphing, opening rows, etc.)

Requires users to set `BETA_CH_OTEL_JSON_SCHEMA_ENABLED=true` in `ch-server` and `OTEL_AGENT_FEATURE_GATE_ARG='--feature-gates=clickhouse.json'` in `otel-collector` to enable JSON schema. Users must start a new ClickHouse DB or migrate their own table manually to enable as it is not schema compatible and migration is not automatic.

Closes HDX-1849, HDX-1969, HDX-1849, HDX-1966, HDX-1964

Co-authored-by: Tom Alexander <3245235+teeohhem@users.noreply.github.com>
2025-07-03 17:11:03 +00:00
Aaron Knudtson
93e36b5581
fix: connection creation revamp (#947)
Fixes HDX-1926
2025-06-26 15:08:47 +00:00
Aaron Knudtson
9191c11323
fix: disable nx daemon (#942) 2025-06-24 16:51:59 +00:00
Aaron Knudtson
ad6887796f
feat: bundle api for image size reduction (#937)
all-in-one image: 1.51 gb -> 1.21 gb
app image: 573 mb -> 271 mb

Ref HDX-1803
2025-06-24 15:51:34 +00:00
Tom Alexander
661a1ec915
chore: Make passthrough_logs an envvar controlled setting in collector (#922)
Adds environment variable to allow for passthrough_logs to be enabled in the supervisor config

Test locally with:
Edit docker-compose.dev.yaml
Add `OTEL_SUPERVISOR_PASSTHROUGH_LOGS: 'true'` under the otel environment variables

```
make dev-up
```

Ref: HDX-1859
2025-06-10 23:16:52 +00:00
Warren
2063774866
perf: build next app in standalone mode to cut down images size (#916)
App image: 1.29GB -> 561MB
Local image: 2.23GB -> 1.5GB

Ref: HDX-1803
2025-06-09 23:40:02 +00:00
Warren
31e22dcff4
feat: introduce clickhouse db init script (#843)
Ref: HDX-1777

This shouldn't have any impact on users
2025-06-09 16:45:23 +00:00
Warren
ab387e1168
fix: missing types in app build (#905)
bonus adjust logging (otel config + exception)
2025-06-03 20:20:56 +00:00