Skip to content

Commit 764e88b

Browse files
committed
review suggested fixes
1 parent 013da38 commit 764e88b

File tree

2 files changed

+16
-8
lines changed
  • apps/webapp/app

2 files changed

+16
-8
lines changed

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.logs/route.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
141141
defaultPeriod: "1h",
142142
}).catch((error) => {
143143
if (error instanceof ServiceValidationError) {
144-
return { error: error.message };
144+
return { error: "Failed to load logs. Please refresh and try again." };
145145
}
146146
throw error;
147147
});

apps/webapp/app/v3/eventRepository/index.server.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
clickhouseEventRepositoryV2,
66
} from "./clickhouseEventRepositoryInstance.server";
77
import { IEventRepository, TraceEventOptions } from "./eventRepository.types";
8-
import { $replica, prisma } from "~/db.server";
8+
import { prisma } from "~/db.server";
99
import { logger } from "~/services/logger.server";
1010
import { FEATURE_FLAG, flags } from "../featureFlags.server";
1111
import { getTaskEventStore } from "../taskEventStore.server";
@@ -24,9 +24,17 @@ export function resolveEventRepositoryForStore(store: string | undefined): IEven
2424
return eventRepository;
2525
}
2626

27+
export const EVENT_STORE_TYPES = {
28+
POSTGRES: "postgres",
29+
CLICKHOUSE: "clickhouse",
30+
CLICKHOUSE_V2: "clickhouse_v2",
31+
} as const;
32+
33+
export type EventStoreType = typeof EVENT_STORE_TYPES[keyof typeof EVENT_STORE_TYPES];
34+
2735
export async function getConfiguredEventRepository(
2836
organizationId: string
29-
): Promise<{ repository: IEventRepository; store: string }> {
37+
): Promise<{ repository: IEventRepository; store: EventStoreType }> {
3038
const organization = await prisma.organization.findFirst({
3139
select: {
3240
id: true,
@@ -49,15 +57,15 @@ export async function getConfiguredEventRepository(
4957
(organization.featureFlags as Record<string, unknown> | null) ?? undefined
5058
);
5159

52-
if (taskEventStore === "clickhouse_v2") {
53-
return { repository: clickhouseEventRepositoryV2, store: "clickhouse_v2" };
60+
if (taskEventStore === EVENT_STORE_TYPES.CLICKHOUSE_V2) {
61+
return { repository: clickhouseEventRepositoryV2, store: EVENT_STORE_TYPES.CLICKHOUSE_V2 };
5462
}
5563

56-
if (taskEventStore === "clickhouse") {
57-
return { repository: clickhouseEventRepository, store: "clickhouse" };
64+
if (taskEventStore === EVENT_STORE_TYPES.CLICKHOUSE) {
65+
return { repository: clickhouseEventRepository, store: EVENT_STORE_TYPES.CLICKHOUSE };
5866
}
5967

60-
return { repository: eventRepository, store: "postgres" };
68+
return { repository: eventRepository, store: EVENT_STORE_TYPES.POSTGRES };
6169
}
6270

6371
export async function getEventRepository(

0 commit comments

Comments
 (0)