Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix: remove last backend sentry logic (#2981)

Max Deichmanne6a8fb84f05e
diff --git a/packages/shared/src/features/scores/scoreConfigTypes.ts b/packages/shared/src/features/scores/scoreConfigTypes.ts
index c26ad9a6c3..429edd88e1 100644
--- a/packages/shared/src/features/scores/scoreConfigTypes.ts
+++ b/packages/shared/src/features/scores/scoreConfigTypes.ts
@@ -144,7 +144,7 @@ const ValidatedScoreConfigSchema = z
/**
* Use this function when pulling a list of score configs from the database before using in the application to ensure type safety.
- * All score configs are expected to pass the validation. If a score fails validation, it will be logged to Sentry.
+ * All score configs are expected to pass the validation. If a score fails validation, it will be logged to Otel.
* @param scoreConfigs
* @returns list of validated score configs
*/
diff --git a/packages/shared/src/features/scores/scoreTypes.ts b/packages/shared/src/features/scores/scoreTypes.ts
index b5f8d91599..aeb10ed054 100644
--- a/packages/shared/src/features/scores/scoreTypes.ts
+++ b/packages/shared/src/features/scores/scoreTypes.ts
@@ -155,7 +155,7 @@ export const ScorePropsAgainstConfig = z.union([
/**
* Use this function when pulling a list of scores from the database before using in the application to ensure type safety.
- * All scores are expected to pass the validation. If a score fails validation, it will be logged to Sentry.
+ * All scores are expected to pass the validation. If a score fails validation, it will be logged to Otel.
* @param scores
* @returns list of validated scores
*/
diff --git a/web/src/ee/features/multi-tenant-sso/utils.ts b/web/src/ee/features/multi-tenant-sso/utils.ts
index 54289c5035..e9af4c4f74 100644
--- a/web/src/ee/features/multi-tenant-sso/utils.ts
+++ b/web/src/ee/features/multi-tenant-sso/utils.ts
@@ -9,8 +9,7 @@ import { isEeEnabled } from "@/src/ee/utils/isEeEnabled";
import { type SsoConfig, prisma } from "@langfuse/shared/src/db";
import { decrypt } from "@langfuse/shared/encryption";
import { SsoProviderSchema } from "./types";
-import { CustomSSOProvider } from "@langfuse/shared/src/server";
-import * as Sentry from "@sentry/node";
+import { CustomSSOProvider, traceException } from "@langfuse/shared/src/server";
// Local cache for SSO configurations
let cachedSsoConfigs: {
@@ -52,7 +51,7 @@ async function getSsoConfigs(): Promise<SsoProviderSchema[]> {
);
} catch (e) {
console.error("Failed to load SSO configs from the database", e);
- Sentry.captureException(e);
+ traceException(e);
// empty array will be cached to prevent repeated DB queries
failedToFetch = true;
}
@@ -69,7 +68,7 @@ async function getSsoConfigs(): Promise<SsoProviderSchema[]> {
e,
);
- Sentry.captureException(e);
+ traceException(e);
return null;
}
})
@@ -194,7 +193,7 @@ const dbToNextAuthProvider = (provider: SsoProviderSchema): Provider | null => {
console.error(
`Unrecognized SSO provider for domain ${(provider as any).domain}`,
);
- Sentry.captureException(
+ traceException(
new Error(
`Unrecognized SSO provider for domain ${(provider as any).domain}`,
),
diff --git a/web/src/features/datasets/server/dataset-router.ts b/web/src/features/datasets/server/dataset-router.ts
index c8ba0c7de7..1397a3506c 100644
--- a/web/src/features/datasets/server/dataset-router.ts
+++ b/web/src/features/datasets/server/dataset-router.ts
@@ -15,7 +15,7 @@ import { DB } from "@/src/server/db";
import { filterAndValidateDbScoreList, paginationZod } from "@langfuse/shared";
import { aggregateScores } from "@/src/features/scores/lib/aggregateScores";
import { type ScoreSimplified } from "@/src/features/scores/lib/types";
-import * as Sentry from "@sentry/node";
+import { traceException } from "@langfuse/shared/src/server";
export const datasetRouter = createTRPCRouter({
allDatasetMeta: protectedProjectProcedure
@@ -739,11 +739,11 @@ export const datasetRouter = createTRPCRouter({
const validatedTraceScores = filterAndValidateDbScoreList(
traceScores,
- Sentry.captureException,
+ traceException,
);
const validatedObservationScores = filterAndValidateDbScoreList(
observationScores,
- Sentry.captureException,
+ traceException,
);
const items = runItems.map((ri) => {
diff --git a/web/src/pages/api/public/score-configs/index.ts b/web/src/pages/api/public/score-configs/index.ts
index c8ffca6e3c..69956c9b71 100644
--- a/web/src/pages/api/public/score-configs/index.ts
+++ b/web/src/pages/api/public/score-configs/index.ts
@@ -13,7 +13,7 @@ import {
validateDbScoreConfig,
} from "@langfuse/shared";
import { Prisma, prisma } from "@langfuse/shared/src/db";
-import * as Sentry from "@sentry/node";
+import { traceException } from "@langfuse/shared/src/server";
const inflateConfigBody = (body: z.infer<typeof PostScoreConfigBody>) => {
if (isBooleanDataType(body.dataType)) {
@@ -67,7 +67,7 @@ export default withMiddlewares({
const configs = filterAndValidateDbScoreConfigList(
rawConfigs,
- Sentry.captureException,
+ traceException,
);
const totalItemsRes = await prisma.$queryRaw<{ count: bigint }[]>(
diff --git a/web/src/pages/api/public/traces/[traceId].ts b/web/src/pages/api/public/traces/[traceId].ts
index 491cad416b..d2cefc1fc1 100644
--- a/web/src/pages/api/public/traces/[traceId].ts
+++ b/web/src/pages/api/public/traces/[traceId].ts
@@ -10,7 +10,7 @@ import {
LangfuseNotFoundError,
} from "@langfuse/shared";
import { prisma } from "@langfuse/shared/src/db";
-import * as Sentry from "@sentry/node";
+import { traceException } from "@langfuse/shared/src/server";
export default withMiddlewares({
GET: createAuthedAPIRoute({
@@ -53,7 +53,7 @@ export default withMiddlewares({
const outObservations = observations.map(transformDbToApiObservation);
const validatedScores = filterAndValidateDbScoreList(
scores,
- Sentry.captureException,
+ traceException,
);
const { duration, ...restOfTrace } = trace;
diff --git a/web/src/server/api/routers/generations/db/getAllGenerationsSqlQuery.ts b/web/src/server/api/routers/generations/db/getAllGenerationsSqlQuery.ts
index 92a7e36b38..0ecd88d1c5 100644
--- a/web/src/server/api/routers/generations/db/getAllGenerationsSqlQuery.ts
+++ b/web/src/server/api/routers/generations/db/getAllGenerationsSqlQuery.ts
@@ -9,7 +9,7 @@ import {
import { type ObservationView, Prisma, prisma } from "@langfuse/shared/src/db";
import { type GetAllGenerationsInput } from "../getAllQuery";
-import * as Sentry from "@sentry/node";
+import { traceException } from "@langfuse/shared/src/server";
type AdditionalObservationFields = {
traceName: string | null;
@@ -151,10 +151,7 @@ export async function getAllGenerations({
},
},
});
- const validatedScores = filterAndValidateDbScoreList(
- scores,
- Sentry.captureException,
- );
+ const validatedScores = filterAndValidateDbScoreList(scores, traceException);
const fullGenerations = generations.map((generation) => {
const filteredScores = aggregateScores(
diff --git a/web/src/server/api/routers/sessions.ts b/web/src/server/api/routers/sessions.ts
index d8cbad9cc4..7cd685fbcf 100644
--- a/web/src/server/api/routers/sessions.ts
+++ b/web/src/server/api/routers/sessions.ts
@@ -16,10 +16,10 @@ import {
singleFilter,
} from "@langfuse/shared";
import { Prisma } from "@langfuse/shared/src/db";
-import * as Sentry from "@sentry/node";
import { TRPCError } from "@trpc/server";
import type Decimal from "decimal.js";
+import { traceException } from "@langfuse/shared/src/server";
const SessionFilterOptions = z.object({
projectId: z.string(), // Required for protectedProjectProcedure
filter: z.array(singleFilter).nullable(),
@@ -141,7 +141,7 @@ export const sessionRouter = createTRPCRouter({
const validatedScores = filterAndValidateDbScoreList(
scores,
- Sentry.captureException,
+ traceException,
);
const totalCostQuery = Prisma.sql`