Skip to content

Commit a61932d

Browse files
committed
docs: fix inline comment
1 parent 1501084 commit a61932d

2 files changed

Lines changed: 10 additions & 15 deletions

File tree

packages/shared-api/db/greptime.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
import { getSecret } from "../utils/secret";
22
import { DEFAULT_DB_IDLE_TIMEOUT_MS, DEFAULT_DB_POOL_MAX } from "./config";
33

4-
const createBunSqlClient = (url: string) => {
5-
const { SQL } = require("bun") as typeof Bun;
6-
return new SQL({
7-
url,
8-
max: DEFAULT_DB_POOL_MAX,
9-
idleTimeout: DEFAULT_DB_IDLE_TIMEOUT_MS / 1_000,
10-
});
11-
};
12-
134
export const GREPTIME_HOST = (await getSecret("GREPTIME_HOST")) ?? "localhost";
145

15-
let _client: ReturnType<typeof createBunSqlClient>;
6+
let _client: Bun.SQL;
167

178
/** Lazily created so BunSqlInstrumentation wraps `bun:sql` before the first `new SQL()` call. */
189
export const getGreptimeSqlClient = () =>
19-
(_client ??= createBunSqlClient(`postgres://${GREPTIME_HOST}:4003/public`));
10+
(_client ??= new (require("bun") as typeof Bun).SQL({
11+
url: `postgres://${GREPTIME_HOST}:4003/public`,
12+
max: DEFAULT_DB_POOL_MAX,
13+
idleTimeout: DEFAULT_DB_IDLE_TIMEOUT_MS / 1_000,
14+
}));
2015

21-
export type BunSqlClient = ReturnType<typeof createBunSqlClient>;
16+
export type BunSqlClient = Bun.SQL;

packages/shared-api/lib/otel.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ export const getOtelConfig = (serviceName: string): ElysiaOpenTelemetryOptions =
8787
enhancedDatabaseReporting: false,
8888
});
8989

90-
// Bun loads all static ESM imports before any module body runs, so RITM hooks
91-
// never fire for pg (https://github.com/oven-sh/bun/issues/3775). Patch it
92-
// directly so the NodeSDK can produce spans and call setMeterProvider() on it.
90+
// In Bun, pg is already loaded via @prisma/adapter-pg before OTel's module-load
91+
// hooks can patch it. Patch pg.Client directly as a workaround, while still
92+
// passing the instrumentation to NodeSDK so providers are configured correctly.
9393
try {
9494
// oxlint-disable no-unsafe-assignment no-unsafe-call no-unsafe-member-access
9595
const { createRequire } = require("module");

0 commit comments

Comments
 (0)