Skip to content

Commit 27a3ee8

Browse files
committed
fix: api otel
1 parent 7b73fd7 commit 27a3ee8

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

apps/api/src/routes/export.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { auth, websitesApi } from "@databuddy/auth";
22
import { db, eq, websites } from "@databuddy/db";
33
import { cacheable } from "@databuddy/redis";
4-
import { record, setAttributes } from "@elysiajs/opentelemetry";
4+
import { record, setAttributes } from "../lib/tracing";
55
import dayjs from "dayjs";
66
import utc from "dayjs/plugin/utc";
77
import { Elysia, t } from "elysia";
@@ -100,8 +100,8 @@ export const exportRoute = new Elysia({ prefix: "/v1/export" }).post(
100100
"export.request_id": requestId,
101101
"export.website_id": websiteId || "missing",
102102
"export.format": format,
103-
"export.start_date": body.start_date,
104-
"export.end_date": body.end_date,
103+
"export.start_date": body.start_date || "missing",
104+
"export.end_date": body.end_date || "missing",
105105
});
106106

107107
try {

apps/api/src/routes/query.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { auth } from "@databuddy/auth";
22
import { and, apikeyAccess, db, eq, isNull, websites } from "@databuddy/db";
33
import { filterOptions } from "@databuddy/shared/lists/filters";
4-
import { record, setAttributes } from "@elysiajs/opentelemetry";
4+
import { record, setAttributes } from "../lib/tracing";
55
import { Elysia, t } from "elysia";
66
import { getApiKeyFromHeader, isApiKeyPresent } from "../lib/api-key";
77
import { getCachedWebsiteDomain, getWebsiteDomain } from "../lib/website-utils";
@@ -99,9 +99,9 @@ async function getAccessibleWebsites(request: Request) {
9999
? eq(websites.organizationId, apiKey.organizationId)
100100
: apiKey.userId
101101
? and(
102-
eq(websites.userId, apiKey.userId),
103-
isNull(websites.organizationId)
104-
)
102+
eq(websites.userId, apiKey.userId),
103+
isNull(websites.organizationId)
104+
)
105105
: eq(websites.id, ""); // No matches if no user/org
106106

107107
return db
@@ -261,7 +261,7 @@ export const query = new Elysia({ prefix: "/v1/query" })
261261
setAttributes({
262262
"query.is_batch": isBatch,
263263
"query.count": isBatch ? body.length : 1,
264-
"query.website_id": queryParams.website_id || "unknown",
264+
"query.website_id": queryParams.website_id || "missing",
265265
"query.timezone": timezone,
266266
});
267267

@@ -410,12 +410,12 @@ async function executeDynamicQuery(
410410
parameterInput:
411411
| string
412412
| {
413-
name: string;
414-
start_date?: string;
415-
end_date?: string;
416-
granularity?: string;
417-
id?: string;
418-
},
413+
name: string;
414+
start_date?: string;
415+
end_date?: string;
416+
granularity?: string;
417+
id?: string;
418+
},
419419
dynamicRequest: DynamicQueryRequestType,
420420
params: QueryParams,
421421
siteId: string | undefined,

0 commit comments

Comments
 (0)