Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/usage-stats-connection-password.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperdx/api': patch
---

fix: usage stats job no longer fails ClickHouse auth on password-protected
connections
2 changes: 1 addition & 1 deletion packages/api/src/tasks/usageStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function extractTableNames(source: SourceDocument): string[] {

const getClickhouseTableSize = async () => {
// fetch mongo data
const connections = await Connection.find();
const connections = await Connection.find().select('+password');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — No regression test that the usage stats job sends the connection password to ClickHouse

Add a case to packages/api/src/tasks/__tests__/usageStats.test.ts, which never mentions Connection or password today. It should create a Connection with a password, mock ClickhouseClient, and assert the constructor receives that password. The catch {} at usageStats.ts:220 swallows auth errors, so if someone drops .select('+password') again the job fails silently and nothing catches it.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

const sources = await Source.find();

// build map for each db instance
Expand Down
Loading