|
1 | 1 | import { auth } from "@databuddy/auth"; |
2 | 2 | import { and, apikeyAccess, db, eq, isNull, websites } from "@databuddy/db"; |
3 | 3 | import { filterOptions } from "@databuddy/shared/lists/filters"; |
4 | | -import { record, setAttributes } from "@elysiajs/opentelemetry"; |
| 4 | +import { record, setAttributes } from "../lib/tracing"; |
5 | 5 | import { Elysia, t } from "elysia"; |
6 | 6 | import { getApiKeyFromHeader, isApiKeyPresent } from "../lib/api-key"; |
7 | 7 | import { getCachedWebsiteDomain, getWebsiteDomain } from "../lib/website-utils"; |
@@ -99,9 +99,9 @@ async function getAccessibleWebsites(request: Request) { |
99 | 99 | ? eq(websites.organizationId, apiKey.organizationId) |
100 | 100 | : apiKey.userId |
101 | 101 | ? and( |
102 | | - eq(websites.userId, apiKey.userId), |
103 | | - isNull(websites.organizationId) |
104 | | - ) |
| 102 | + eq(websites.userId, apiKey.userId), |
| 103 | + isNull(websites.organizationId) |
| 104 | + ) |
105 | 105 | : eq(websites.id, ""); // No matches if no user/org |
106 | 106 |
|
107 | 107 | return db |
@@ -261,7 +261,7 @@ export const query = new Elysia({ prefix: "/v1/query" }) |
261 | 261 | setAttributes({ |
262 | 262 | "query.is_batch": isBatch, |
263 | 263 | "query.count": isBatch ? body.length : 1, |
264 | | - "query.website_id": queryParams.website_id || "unknown", |
| 264 | + "query.website_id": queryParams.website_id || "missing", |
265 | 265 | "query.timezone": timezone, |
266 | 266 | }); |
267 | 267 |
|
@@ -410,12 +410,12 @@ async function executeDynamicQuery( |
410 | 410 | parameterInput: |
411 | 411 | | string |
412 | 412 | | { |
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 | + }, |
419 | 419 | dynamicRequest: DynamicQueryRequestType, |
420 | 420 | params: QueryParams, |
421 | 421 | siteId: string | undefined, |
|
0 commit comments