⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
feat(api): drop workspace identifiers from Sentry integration breadcrumbs
justin92f67ad846c1
diff --git a/.gitignore b/.gitignoreindex c8c646dc7..68c523f73 100644--- a/.gitignore+++ b/.gitignore@@ -54,3 +54,4 @@ compose.override.yml# TanStack Router generated cacheapps/web/.tanstack/+.pi/diff --git a/apps/api/src/plugins/discord/client.ts b/apps/api/src/plugins/discord/client.tsindex 10a5996ca..9b86cea7c 100644--- a/apps/api/src/plugins/discord/client.ts+++ b/apps/api/src/plugins/discord/client.ts@@ -1,3 +1,5 @@+import * as Sentry from "@sentry/node";+type DiscordEmbedField = {name: string;value: string;@@ -41,6 +43,11 @@ export async function postToDiscord(const timeoutId = setTimeout(() => controller.abort(), DISCORD_TIMEOUT_MS);try {+ Sentry.addBreadcrumb({+ category: "integration",+ level: "info",+ data: { integration: "discord" },+ });const response = await fetch(webhookUrl, {method: "POST",headers: {diff --git a/apps/api/src/plugins/generic-webhook/client.ts b/apps/api/src/plugins/generic-webhook/client.tsindex 464d4c0fb..b39e93ea7 100644--- a/apps/api/src/plugins/generic-webhook/client.ts+++ b/apps/api/src/plugins/generic-webhook/client.ts@@ -1,4 +1,5 @@import { createHmac } from "node:crypto";+import * as Sentry from "@sentry/node";import { assertPublicWebhookDestination } from "./config";type GenericWebhookPayload = Record<string, unknown>;@@ -30,6 +31,11 @@ export async function postToGenericWebhook();try {+ Sentry.addBreadcrumb({+ category: "integration",+ level: "info",+ data: { integration: "generic-webhook" },+ });const response = await fetch(webhookUrl, {method: "POST",headers,diff --git a/apps/api/src/plugins/gitea/utils/gitea-api.ts b/apps/api/src/plugins/gitea/utils/gitea-api.tsindex cefc65117..38c3c99df 100644--- a/apps/api/src/plugins/gitea/utils/gitea-api.ts+++ b/apps/api/src/plugins/gitea/utils/gitea-api.ts@@ -1,3 +1,4 @@+import * as Sentry from "@sentry/node";import { assertPublicDestination } from "../../../utils/assert-public-destination";import type { GiteaConfig } from "../config";import { normalizeGiteaBaseUrl } from "../config";@@ -96,6 +97,11 @@ export async function giteaFetch<T>(}try {+ Sentry.addBreadcrumb({+ category: "integration",+ level: "info",+ data: { integration: "gitea" },+ });const res = await fetch(url, {...init,signal: controller.signal,diff --git a/apps/api/src/plugins/github/utils/github-app.ts b/apps/api/src/plugins/github/utils/github-app.tsindex c8862a3af..4c7e2165f 100644--- a/apps/api/src/plugins/github/utils/github-app.ts+++ b/apps/api/src/plugins/github/utils/github-app.ts@@ -1,3 +1,4 @@+import * as Sentry from "@sentry/node";import { config } from "dotenv-mono";import { App } from "octokit";@@ -57,6 +58,11 @@ export async function getInstallationOctokit(installationId: number) {if (!app) {throw new Error("GitHub App not configured");}+ Sentry.addBreadcrumb({+ category: "integration",+ level: "info",+ data: { integration: "github", op: "installationOctokit" },+ });return app.getInstallationOctokit(installationId);}@@ -69,6 +75,15 @@ export async function getInstallationIdForRepo(throw new Error("GitHub App not configured");}+ Sentry.addBreadcrumb({+ category: "integration",+ level: "info",+ data: {+ integration: "github",+ op: "getInstallationIdForRepo",+ },+ });+const { data: installation } =await app.octokit.rest.apps.getRepoInstallation({owner,diff --git a/apps/api/src/plugins/slack/client.ts b/apps/api/src/plugins/slack/client.tsindex 5d6269d7e..27f7534fe 100644--- a/apps/api/src/plugins/slack/client.ts+++ b/apps/api/src/plugins/slack/client.ts@@ -1,3 +1,5 @@+import * as Sentry from "@sentry/node";+export type SlackTextObject = {type: "mrkdwn" | "plain_text";text: string;@@ -29,6 +31,11 @@ export async function postToSlack(const timeoutId = setTimeout(() => controller.abort(), SLACK_TIMEOUT_MS);try {+ Sentry.addBreadcrumb({+ category: "integration",+ level: "info",+ data: { integration: "slack" },+ });const response = await fetch(webhookUrl, {method: "POST",headers: {diff --git a/apps/api/src/plugins/telegram/client.ts b/apps/api/src/plugins/telegram/client.tsindex 3824f5660..411fca839 100644--- a/apps/api/src/plugins/telegram/client.ts+++ b/apps/api/src/plugins/telegram/client.ts@@ -1,3 +1,5 @@+import * as Sentry from "@sentry/node";+type TelegramMessage = {chat_id: string;text: string;@@ -16,6 +18,11 @@ export async function postToTelegram(const timeoutId = setTimeout(() => controller.abort(), TELEGRAM_TIMEOUT_MS);try {+ Sentry.addBreadcrumb({+ category: "integration",+ level: "info",+ data: { integration: "telegram" },+ });const response = await fetch(`https://api.telegram.org/bot${botToken}/sendMessage`,{diff --git a/apps/api/src/scheduler/index.ts b/apps/api/src/scheduler/index.tsindex 0a25d8c3d..4150a0e3b 100644--- a/apps/api/src/scheduler/index.ts+++ b/apps/api/src/scheduler/index.ts@@ -1,3 +1,4 @@+import * as Sentry from "@sentry/node";import { Cron } from "croner";import { checkDueDateReminders } from "./due-date-reminders";import { checkProjectWebhookReminders } from "./project-webhook-reminders";@@ -6,11 +7,53 @@ import { checkTrialReminders } from "./trial-reminders";const jobs: Cron[] = [];+function withCheckIn<T>(name: string, fn: () => Promise<T>) {+ return async () => {+ const checkInId = Sentry.captureCheckIn({+ monitorSlug: name,+ status: "in_progress",+ });+ try {+ const result = await fn();+ Sentry.captureCheckIn({+ checkInId,+ monitorSlug: name,+ status: "ok",+ });+ return result;+ } catch (error) {+ Sentry.captureCheckIn({+ checkInId,+ monitorSlug: name,+ status: "error",+ });+ throw error;+ }+ };+}+export function initializeScheduler(): void {- jobs.push(new Cron("*/5 * * * *", checkDueDateReminders));- jobs.push(new Cron("*/5 * * * *", checkProjectWebhookReminders));- jobs.push(new Cron("17 * * * *", reconcileWorkspaceSeats));- jobs.push(new Cron("23 * * * *", checkTrialReminders));+ jobs.push(+ new Cron(+ "*/5 * * * *",+ withCheckIn("due-date-reminders", checkDueDateReminders),+ ),+ );+ jobs.push(+ new Cron(+ "*/5 * * * *",+ withCheckIn("project-webhook-reminders", checkProjectWebhookReminders),+ ),+ );+ jobs.push(+ new Cron(+ "17 * * * *",+ withCheckIn("seat-reconciliation", reconcileWorkspaceSeats),+ ),+ );+ jobs.push(+ new Cron("23 * * * *", withCheckIn("trial-reminders", checkTrialReminders)),+ );console.log("⏰ Scheduler started (reminders every 5 minutes, seat reconciliation and trial reminders hourly)",);diff --git a/apps/web/src/query-client/index.ts b/apps/web/src/query-client/index.tsindex cd99d3bf9..208ad5ccd 100644--- a/apps/web/src/query-client/index.ts+++ b/apps/web/src/query-client/index.ts@@ -1,6 +1,29 @@-import { QueryClient } from "@tanstack/react-query";+import * as Sentry from "@sentry/react";+import { MutationCache, QueryCache, QueryClient } from "@tanstack/react-query";++function captureCacheError(error: unknown, context: "query" | "mutation") {+ if (!(error instanceof Error)) return;+ // These are the noisy network-layer errors TanStack raises before any+ // fetcher-level error message exists; we still want them captured, but+ // without drowning the queue in offline-tab reloads.+ if (+ error.message.includes("Failed to fetch") ||+ error.message.includes("NetworkError") ||+ error.message.includes("Load failed")+ ) {+ Sentry.captureException(error, { tags: { area: `network.${context}` } });+ return;+ }+ Sentry.captureException(error, { tags: { area: `api.${context}` } });+}const queryClient = new QueryClient({+ queryCache: new QueryCache({+ onError: (error) => captureCacheError(error, "query"),+ }),+ mutationCache: new MutationCache({+ onError: (error) => captureCacheError(error, "mutation"),+ }),defaultOptions: {queries: {refetchOnWindowFocus: false,