Skip to content

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

refactor(alerts): rename the Monitors product surface to Alerts (#15949)

Mark Salpeteraf0ee68a8ce9
diff --git a/packages/shared/src/features/monitors/processor/buildPermalink.test.ts b/packages/shared/src/features/monitors/processor/buildPermalink.test.ts
index 049249df24..b281e23008 100644
--- a/packages/shared/src/features/monitors/processor/buildPermalink.test.ts
+++ b/packages/shared/src/features/monitors/processor/buildPermalink.test.ts
@@ -23,7 +23,7 @@ describe("buildPermalink", () => {
it("returns an absolute URL when NEXTAUTH_URL is set", () => {
envMock.env.NEXTAUTH_URL = "https://cloud.langfuse.com";
expect(buildPermalink("proj_01", "mon_01")).toBe(
- "https://cloud.langfuse.com/project/proj_01/monitors/mon_01",
+ "https://cloud.langfuse.com/project/proj_01/alerts/mon_01",
);
});
});
diff --git a/packages/shared/src/features/monitors/processor/processor.ts b/packages/shared/src/features/monitors/processor/processor.ts
index f4653f9310..a3ea69b44c 100644
--- a/packages/shared/src/features/monitors/processor/processor.ts
+++ b/packages/shared/src/features/monitors/processor/processor.ts
@@ -409,7 +409,7 @@ export function buildPermalink(
): string | undefined {
if (!env.NEXTAUTH_URL) return undefined;
const base = env.NEXTAUTH_URL.replace(/\/$/, "");
- return `${base}/project/${projectId}/monitors/${monitorId}`;
+ return `${base}/project/${projectId}/alerts/${monitorId}`;
}
/** isBreaching returns true for the threshold-cross severities (ALERT/WARNING) whose alert should deep-link to the breaching data window; OK (recovery) and the lifecycle states (NO_DATA/UNKNOWN/PAUSED) return false. */
diff --git a/packages/shared/src/features/rbac/projectAccessRights.ts b/packages/shared/src/features/rbac/projectAccessRights.ts
index 5c8721c0a7..838f25633a 100644
--- a/packages/shared/src/features/rbac/projectAccessRights.ts
+++ b/packages/shared/src/features/rbac/projectAccessRights.ts
@@ -81,8 +81,8 @@ export const projectScopes = [
"automations:CUD",
"automations:read",
- "monitors:read",
- "monitors:CUD",
+ "alerts:read",
+ "alerts:CUD",
] as const;
// type string of all Resource:Action, e.g. "members:read"
@@ -144,8 +144,8 @@ export const projectRoleAccessRights: Record<Role, ProjectScope[]> = {
"TableViewPresets:read",
"automations:CUD",
"automations:read",
- "monitors:read",
- "monitors:CUD",
+ "alerts:read",
+ "alerts:CUD",
],
ADMIN: [
"project:read",
@@ -201,8 +201,8 @@ export const projectRoleAccessRights: Record<Role, ProjectScope[]> = {
"TableViewPresets:read",
"automations:CUD",
"automations:read",
- "monitors:read",
- "monitors:CUD",
+ "alerts:read",
+ "alerts:CUD",
],
MEMBER: [
"project:read",
@@ -245,8 +245,8 @@ export const projectRoleAccessRights: Record<Role, ProjectScope[]> = {
"TableViewPresets:CUD",
"TableViewPresets:read",
"automations:read",
- "monitors:read",
- "monitors:CUD",
+ "alerts:read",
+ "alerts:CUD",
],
VIEWER: [
"project:read",
@@ -266,7 +266,7 @@ export const projectRoleAccessRights: Record<Role, ProjectScope[]> = {
"dashboards:read",
"TableViewPresets:read",
"automations:read",
- "monitors:read",
+ "alerts:read",
],
NONE: [],
};
diff --git a/packages/shared/src/in-app-agent/server/tools.ts b/packages/shared/src/in-app-agent/server/tools.ts
index c866b8b2c6..855f76e399 100644
--- a/packages/shared/src/in-app-agent/server/tools.ts
+++ b/packages/shared/src/in-app-agent/server/tools.ts
@@ -267,13 +267,13 @@ export const IN_APP_AGENT_LANGFUSE_MCP_TOOL_POLICIES = {
approval: "auto",
availability: { scope: "prompts:read" },
},
- listMonitors: {
+ listAlerts: {
approval: "auto",
- availability: { scope: "monitors:read" },
+ availability: { scope: "alerts:read" },
},
- getMonitor: {
+ getAlert: {
approval: "auto",
- availability: { scope: "monitors:read" },
+ availability: { scope: "alerts:read" },
},
listPrompts: {
approval: "auto",
@@ -713,13 +713,13 @@ function isSilentMcpToolOutput(value: unknown): value is SilentMcpToolOutput {
}
const InAppAgentRedirectDestinationSchema = z.enum([
+ "alerts",
"dashboardWidget",
"dashboards",
"datasets",
"evals",
"experiments",
"models",
- "monitors",
"playground",
"projectMembers",
"projectSettings",
@@ -818,6 +818,7 @@ const InAppAgentProjectSettingsPageSchema = z.enum([
const InAppAgentRedirectToolInputStrictSchema = z.discriminatedUnion(
"destination",
[
+ InAppAgentRedirectBaseSchema.extend({ destination: z.literal("alerts") }),
InAppAgentRedirectBaseSchema.extend({
destination: z.literal("dashboardWidget"),
params: z.object({ widgetId: z.string().min(1).max(200) }),
@@ -836,7 +837,6 @@ const InAppAgentRedirectToolInputStrictSchema = z.discriminatedUnion(
destination: z.literal("experiments"),
}),
InAppAgentRedirectBaseSchema.extend({ destination: z.literal("models") }),
- InAppAgentRedirectBaseSchema.extend({ destination: z.literal("monitors") }),
InAppAgentRedirectBaseSchema.extend({
destination: z.literal("playground"),
}),
@@ -952,6 +952,10 @@ function getRedirectHref(
projectId: string,
isV4Enabled: boolean,
): string {
+ if (input.destination === "alerts") {
+ return buildMonitorsPath({ projectId });
+ }
+
if (input.destination === "dashboardWidget") {
return buildDashboardWidgetPath({
projectId,
@@ -982,10 +986,6 @@ function getRedirectHref(
return buildModelsPath({ projectId });
}
- if (input.destination === "monitors") {
- return buildMonitorsPath({ projectId });
- }
-
if (input.destination === "playground") {
return buildPlaygroundPath({ projectId });
}
diff --git a/packages/shared/src/server/utils/productUrl.ts b/packages/shared/src/server/utils/productUrl.ts
index 7601b314bc..50557405cf 100644
--- a/packages/shared/src/server/utils/productUrl.ts
+++ b/packages/shared/src/server/utils/productUrl.ts
@@ -202,7 +202,7 @@ export const buildModelsPath = (params: { projectId: string }) =>
`${buildProjectPath(params)}/models`;
export const buildMonitorsPath = (params: { projectId: string }) =>
- `${buildProjectPath(params)}/monitors`;
+ `${buildProjectPath(params)}/alerts`;
export const buildPlaygroundPath = (params: { projectId: string }) =>
`${buildProjectPath(params)}/playground`;
diff --git a/web/next.config.mjs b/web/next.config.mjs
index 9ca0da3d72..ee37622275 100644
--- a/web/next.config.mjs
+++ b/web/next.config.mjs
@@ -5,6 +5,7 @@
await import("./src/env.mjs");
import { withSentryConfig } from "@sentry/nextjs";
import { env } from "./src/env.mjs";
+import { renamedRouteRedirects } from "./redirects.mjs";
/**
* CSP headers
@@ -132,6 +133,10 @@ const nextConfig = {
},
output: "standalone",
+ async redirects() {
+ return renamedRouteRedirects;
+ },
+
async rewrites() {
return [
{
diff --git a/web/redirects.mjs b/web/redirects.mjs
new file mode 100644
index 0000000000..fb434e5b7c
--- /dev/null
+++ b/web/redirects.mjs
@@ -0,0 +1,8 @@
+/** renamedRouteRedirects forwards the URLs of renamed product surfaces to their current paths. */
+export const renamedRouteRedirects = [
+ {
+ source: "/project/:projectId/monitors/:path*",
+ destination: "/project/:projectId/alerts/:path*",
+ permanent: true,
+ },
+];
diff --git a/web/src/__tests__/server/mcp-public-api-tools.servertest.ts b/web/src/__tests__/server/mcp-public-api-tools.servertest.ts
index a8a59b1037..9a264825f5 100644
--- a/web/src/__tests__/server/mcp-public-api-tools.servertest.ts
+++ b/web/src/__tests__/server/mcp-public-api-tools.servertest.ts
@@ -163,8 +163,8 @@ describe("MCP public API tools", () => {
"getHealth",
"listScores",
"getScore",
- "listMonitors",
- "getMonitor",
+ "listAlerts",
+ "getAlert",
"createModel",
"createScoreConfig",
]),
diff --git a/web/src/__tests__/server/monitors.servertest.ts b/web/src/__tests__/server/monitors.servertest.ts
index c135336777..76745c1e36 100644
--- a/web/src/__tests__/server/monitors.servertest.ts
+++ b/web/src/__tests__/server/monitors.servertest.ts
@@ -199,7 +199,7 @@ describe("monitors trpc", () => {
).rejects.toThrow(/access/i);
});
- it("allows monitors.create from MEMBER role (monitors:CUD)", async () => {
+ it("allows monitors.create from MEMBER role (alerts:CUD)", async () => {
const { project, caller } = await prepare({ projectRole: "MEMBER" });
const created = await caller.monitors.create(
diff --git a/web/src/components/deleteButton.tsx b/web/src/components/deleteButton.tsx
index bd9655e701..bf1491e981 100644
--- a/web/src/components/deleteButton.tsx
+++ b/web/src/components/deleteButton.tsx
@@ -361,14 +361,14 @@ export function DeleteMonitorButton(props: DeleteButtonProps) {
const {
itemId,
projectId,
- scope = "monitors:CUD",
+ scope = "alerts:CUD",
invalidateFunc = () => utils.monitors.invalidate(),
} = props;
const monitorMutation = api.monitors.delete.useMutation({
onSuccess: () => {
showSuccessToast({
- title: "Monitor deleted",
- description: "The monitor has been deleted successfully",
+ title: "Alert deleted",
+ description: "The alert has been deleted successfully",
});
utils.monitors.invalidate();
},
@@ -398,8 +398,8 @@ export function DeleteMonitorButton(props: DeleteButtonProps) {
source: isTableAction ? "table-single-row" : "monitor",
})
}
- entityToDeleteName="monitor"
- customDeletePrompt="This action cannot be undone. It stops all evaluations and removes the monitor's alert history."
+ entityToDeleteName="alert"
+ customDeletePrompt="This action cannot be undone. It stops all evaluations and removes its alert history."
executeDeleteMutation={executeDeleteMutation}
isDeleteMutationLoading={monitorMutation.isPending}
/>
diff --git a/web/src/components/layouts/routes.tsx b/web/src/components/layouts/routes.tsx
index daa4661a76..5667437fad 100644
--- a/web/src/components/layouts/routes.tsx
+++ b/web/src/components/layouts/routes.tsx
@@ -131,10 +131,10 @@ export const ROUTES: Route[] = [
section: RouteSection.Main,
},
{
- title: "Monitors",
- pathname: "/project/[projectId]/monitors",
+ title: "Alerts",
+ pathname: "/project/[projectId]/alerts",
icon: BellRing,
- projectRbacScopes: ["monitors:read"],
+ projectRbacScopes: ["alerts:read"],
show: ({ v4WriteMode }) => Boolean(v4WriteMode) && v4WriteMode !== "legacy",
group: RouteGroup.Observability,
section: RouteSection.Main,
diff --git a/web/src/features/automations/components/AutomationSidebar.tsx b/web/src/features/automations/components/AutomationSidebar.tsx
index 266514b6e1..ade6d82418 100644
--- a/web/src/features/automations/components/AutomationSidebar.tsx
+++ b/web/src/features/automations/components/AutomationSidebar.tsx
@@ -1,6 +1,10 @@
import React from "react";
import { api } from "@/src/utils/api";
-import { JobConfigState, type AutomationDomain } from "@langfuse/shared";
+import {
+ JobConfigState,
+ TriggerEventSource,
+ type AutomationDomain,
+} from "@langfuse/shared";
import { cn } from "@/src/utils/tailwind";
import { StatusBadge } from "@/src/components/ui/StatusBadge/StatusBadge";
@@ -102,7 +106,10 @@ export const AutomationSidebar: React.FC<AutomationSidebarProps> = ({
{/* Bottom row: eventSource -> automation type */}
<p className="text-muted-foreground text-xs">
<span className="font-mono">
- {automation.trigger.eventSource}
+ {automation.trigger.eventSource ===
+ TriggerEventSource.Monitor
+ ? "alert"
+ : automation.trigger.eventSource}
</span>
{" → "}
{automation.action.type === "WEBHOOK"
diff --git a/web/src/features/automations/components/automationForm.clienttest.tsx b/web/src/features/automations/components/automationForm.clienttest.tsx
index cce5aaf0c3..dff3b80317 100644
--- a/web/src/features/automations/components/automationForm.clienttest.tsx
+++ b/web/src/features/automations/components/automationForm.clienttest.tsx
@@ -54,7 +54,7 @@ vi.mock("@/src/features/feature-flags/hooks/useIsFeatureEnabled", () => ({
default: () => true,
}));
-// Cloud-only: the Monitor option in the event-source picker is gated on this.
+// Cloud-only: the Alert option in the event-source picker is gated on this.
vi.mock("@/src/features/organizations/hooks", () => ({
useLangfuseCloudRegion: () => ({ isLangfuseCloud: true, region: "US" }),
}));
@@ -127,7 +127,7 @@ describe("AutomationForm handleActionTypeChange", () => {
// comboboxes: [0] eventSource, [1] actionType.
fireEvent.click(screen.getAllByRole("combobox")[0]);
- fireEvent.click(await screen.findByRole("option", { name: "Monitor" }));
+ fireEvent.click(await screen.findByRole("option", { name: "Alert" }));
fireEvent.change(screen.getByPlaceholderText(/automation name/i), {
target: { value: "My automation" },
diff --git a/web/src/features/automations/components/automationForm.tsx b/web/src/features/automations/components/automationForm.tsx
index fa572bb9a0..38fc30db4f 100644
--- a/web/src/features/automations/components/automationForm.tsx
+++ b/web/src/features/automations/components/automationForm.tsx
@@ -247,7 +247,7 @@ const EventSourceField = ({
{(isLangfuseCloud ||
field.value === TriggerEventSource.Monitor) && (
<SelectItem value={TriggerEventSource.Monitor}>
- Monitor
+ Alert
</SelectItem>
)}
<SelectItem disabled={true} value="planned">
@@ -341,14 +341,14 @@ const PromptTriggerFields = ({
const MonitorTriggerFields = ({ projectId }: { projectId: string }) => (
<Alert>
<Info className="h-4 w-4" />
- <AlertTitle>How Monitors Connect</AlertTitle>
+ <AlertTitle>How Alerts Connect</AlertTitle>
<AlertDescription>
- Add this automation to a monitor from the{" "}
+ Add this automation to an alert from the{" "}
<Link
- href={`/project/${projectId}/monitors/new`}
+ href={`/project/${projectId}/alerts/new`}
className="text-primary underline underline-offset-2"
>
- create monitors page
+ create alerts page
</Link>
.
</AlertDescription>
diff --git a/web/src/features/in-app-agent/components/utils/side-effects.ts b/web/src/features/in-app-agent/components/utils/side-effects.ts
index 8aba0dbe21..307b517584 100644
--- a/web/src/features/in-app-agent/components/utils/side-effects.ts
+++ b/web/src/features/in-app-agent/components/utils/side-effects.ts
@@ -92,8 +92,8 @@ const IN_APP_AGENT_TOOL_TRPC_INVALIDATION_TARGETS = {
langfuse_getObservationFilterValues: [],
langfuse_getPrompt: [],
langfuse_getPromptUnresolved: [],
- langfuse_listMonitors: [],
- langfuse_getMonitor: [],
+ langfuse_listAlerts: [],
+ langfuse_getAlert: [],
langfuse_listPrompts: [],
langfuse_createTextPrompt: ["prompts"],
langfuse_createChatPrompt: ["prompts"],
diff --git a/web/src/features/in-app-agent/quickActions.ts b/web/src/features/in-app-agent/quickActions.ts
index 385f470eb0..2fa11ffc99 100644
--- a/web/src/features/in-app-agent/quickActions.ts
+++ b/web/src/features/in-app-agent/quickActions.ts
@@ -362,7 +362,7 @@ const QUICK_ACTION_CONTEXT_BY_PROJECT_SECTION: Record<
observations: "observability",
sessions: "observability",
users: "observability",
- monitors: "observability",
+ alerts: "observability",
dashboards: "dashboards",
widgets: "dashboards",
prompts: "prompts",
diff --git a/web/src/features/mcp/features/monitors/index.ts b/web/src/features/mcp/features/monitors/index.ts
index 501e1cef11..ed8d1541c2 100644
--- a/web/src/features/mcp/features/monitors/index.ts
+++ b/web/src/features/mcp/features/monitors/index.ts
@@ -5,8 +5,8 @@ import { getMonitorTool, handleGetMonitor } from "./tools/getMonitor";
import { listMonitorsTool, handleListMonitors } from "./tools/listMonitors";
export const monitorsFeature = {
- name: "monitors",
- description: "Inspect monitors in the current Langfuse project",
+ name: "alerts",
+ description: "Inspect alerts in the current Langfuse project",
tools: [
{ definition: listMonitorsTool, handler: handleListMonitors },
{ definition: getMonitorTool, handler: handleGetMonitor },
diff --git a/web/src/features/mcp/features/monitors/tools/getMonitor.ts b/web/src/features/mcp/features/monitors/tools/getMonitor.ts
index 7efb3572d6..fbae073919 100644
--- a/web/src/features/mcp/features/monitors/tools/getMonitor.ts
+++ b/web/src/features/mcp/features/monitors/tools/getMonitor.ts
@@ -7,12 +7,12 @@ import { defineTool } from "../../../core/define-tool";
import { runMcpTool } from "../../../core/run-mcp-tool";
const GetMonitorInputSchema = z.object({
- monitorId: z.string().describe("ID of the monitor to retrieve."),
+ monitorId: z.string().describe("ID of the alert to retrieve."),
});
export const [getMonitorTool, handleGetMonitor] = defineTool({
- name: "getMonitor",
- description: "Get a monitor by ID.",
+ name: "getAlert",
+ description: "Get an alert by ID.",
baseSchema: GetMonitorInputSchema,
inputSchema: GetMonitorInputSchema,
handler: async (input, context) =>
diff --git a/web/src/features/mcp/features/monitors/tools/listMonitors.ts b/web/src/features/mcp/features/monitors/tools/listMonitors.ts
index 6673d2e50c..6a782894a6 100644
--- a/web/src/features/mcp/features/monitors/tools/listMonitors.ts
+++ b/web/src/features/mcp/features/monitors/tools/listMonitors.ts
@@ -22,7 +22,7 @@ const ListMonitorsBaseSchema = z.object({
filter: z
.array(McpAdvancedFilterBaseSchema)
.optional()
- .describe("Filter monitors by severity or tags."),
+ .describe("Filter alerts by severity or tags."),
});
const ListMonitorsInputSchema = ListMonitorsSchema.omit({
@@ -32,9 +32,9 @@ const ListMonitorsInputSchema = ListMonitorsSchema.omit({
});
export const [listMonitorsTool, handleListMonitors] = defineTool({
- name: "listMonitors",
+ name: "listAlerts",
description:
- "List monitors, optionally filtered by severity or tags and ordered by monitor properties.",
+ "List alerts, optionally filtered by severity or tags and ordered by alert properties.",
baseSchema: ListMonitorsBaseSchema,
inputSchema: ListMonitorsInputSchema,
handler: async (input, context) =>
diff --git a/web/src/features/monitors/components/MonitorAutomationsPanel.tsx b/web/src/features/monitors/components/MonitorAutomationsPanel.tsx
index ddea8910b6..6734591a5f 100644
--- a/web/src/features/monitors/components/MonitorAutomationsPanel.tsx
+++ b/web/src/features/monitors/components/MonitorAutomationsPanel.tsx
@@ -346,8 +346,7 @@ const AddAutomationDropdown = ({
<DialogHeader>
<DialogTitle>New automation</DialogTitle>
<DialogDescription>
- This automation stays available to every monitor in the
- project.
+ This automation stays available to every alert in the project.
</DialogDescription>
</DialogHeader>
<DialogBody>
diff --git a/web/src/features/monitors/components/MonitorForm.tsx b/web/src/features/monitors/components/MonitorForm.tsx
index fa51093a15..a54df7b71e 100644
--- a/web/src/features/monitors/components/MonitorForm.tsx
+++ b/web/src/features/monitors/components/MonitorForm.tsx
@@ -215,8 +215,8 @@ export const MonitorForm = ({
const router = useRouter();
/** isEdit is true when the form is bound to an existing monitor. */
const isEdit = Boolean(monitor);
- /** hasAccess gates write controls behind the monitors:CUD RBAC scope. */
- const hasAccess = useHasProjectAccess({ projectId, scope: "monitors:CUD" });
+ /** hasAccess gates write controls behind the alerts:CUD RBAC scope. */
+ const hasAccess = useHasProjectAccess({ projectId, scope: "alerts:CUD" });
/** utils is the tRPC utils handle used to invalidate caches after mutations. */
const utils = api.useUtils();
@@ -260,12 +260,12 @@ export const MonitorForm = ({
onSuccess: async (_data, variables) => {
await utils.monitors.invalidate();
showSuccessToast({
- title: "Monitor created",
+ title: "Alert created",
description: `"${variables.name}" is now active.`,
});
- router.replace(`/project/${projectId}/monitors`);
+ router.replace(`/project/${projectId}/alerts`);
},
- onError: (e) => showErrorToast("Failed to create monitor", e.message),
+ onError: (e) => showErrorToast("Failed to create alert", e.message),
});
/** updateMutation saves edits to an existing monitor and returns to the monitors list on success. */
@@ -273,12 +273,12 @@ export const MonitorForm = ({
onSuccess: async (_data, variables) => {
await utils.monitors.invalidate();
showSuccessToast({
- title: "Monitor saved",
+ title: "Alert saved",
description: `Your changes to "${variables.name}" have been applied.`,
});
- router.replace(`/project/${projectId}/monitors`);
+ router.replace(`/project/${projectId}/alerts`);
},
- onError: (e) => showErrorToast("Failed to save monitor", e.message),
+ onError: (e) => showErrorToast("Failed to save alert", e.message),
});
/** onSubmit normalizes filter columns into view-space and dispatches the create or update mutation. */
@@ -447,7 +447,7 @@ export const MonitorForm = ({
<div className="h-full min-h-0 w-full min-w-107.5 md:w-1/3">
<Card className="flex h-full flex-col">
<CardHeader>
- <CardTitle>Monitor Configuration</CardTitle>
+ <CardTitle>Alert Configuration</CardTitle>
<CardDescription>
Receive notifications when a metric crosses a threshold. (eg.
&ldquo;sudden cost increase&rdquo;, &ldquo;accuracy has
@@ -858,7 +858,7 @@ export const MonitorForm = ({
<FormItem>
<FormControl>
<TagManager
- itemName="monitor"
+ itemName="alert"
tags={(field.value ?? []) as string[]}
allTags={
monitorFilterOptions.data?.tags.map(
@@ -916,7 +916,7 @@ export const MonitorForm = ({
className="w-full"
disabled={!hasAccess || submitting}
>
- {isEdit ? "Save Monitor" : "Create Monitor"}
+ {isEdit ? "Save Alert" : "Create Alert"}
</Button>
</div>
</CardFooter>
diff --git a/web/src/features/monitors/components/MonitorPagePermissions.tsx b/web/src/features/monitors/components/MonitorPagePermissions.tsx
index c223fd6e43..0973eb0bba 100644
--- a/web/src/features/monitors/components/MonitorPagePermissions.tsx
+++ b/web/src/features/monitors/components/MonitorPagePermissions.tsx
@@ -7,7 +7,7 @@ import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAcces
import useProjectIdFromURL from "@/src/hooks/useProjectIdFromURL";
/** MonitorScope is the RBAC scope a monitor page can require for entry. */
-type MonitorScope = "monitors:read" | "monitors:CUD";
+type MonitorScope = "alerts:read" | "alerts:CUD";
/** MonitorPagePermissions gates a monitor page on Langfuse Cloud and a project RBAC scope. */
export function MonitorPagePermissions({
diff --git a/web/src/features/monitors/components/MonitorRowActions.clienttest.tsx b/web/src/features/monitors/components/MonitorRowActions.clienttest.tsx
index a2a41ab3ca..d24c5687b8 100644
--- a/web/src/features/monitors/components/MonitorRowActions.clienttest.tsx
+++ b/web/src/features/monitors/components/MonitorRowActions.clienttest.tsx
@@ -21,7 +21,7 @@ const monitorRow = (status: Monitor["status"]): Monitor =>
({ id: "mon-1", status }) as Monitor;
describe("MonitorRowActions", () => {
- it("write access: edit links to monitors/<id> and pause click toggles status", () => {
+ it("write access: edit links to alerts/<id> and pause click toggles status", () => {
const onToggleStatus = vi.fn();
render(
<MonitorRowActions
@@ -36,14 +36,14 @@ describe("MonitorRowActions", () => {
const editLink = screen.getByRole("link");
expect(editLink.getAttribute("href")).toBe(
- `/project/${PROJECT_ID}/monitors/mon-1`,
+ `/project/${PROJECT_ID}/alerts/mon-1`,
);
fireEvent.click(screen.getByRole("button", { name: /pause/i }));
expect(onToggleStatus).toHaveBeenCalledTimes(1);
});
- it("paused monitor: shows a Resume control", () => {
+ it("paused alert: shows a Resume control", () => {
render(
<MonitorRowActions
monitor={monitorRow("PAUSED")}
@@ -87,7 +87,7 @@ describe("MonitorRowActions", () => {
);
expect(
- screen.getByRole("button", { name: /monitor actions/i }),
+ screen.getByRole("button", { name: /alert actions/i }),
).toBeInTheDocument();
expect(screen.queryByRole("link")).not.toBeInTheDocument();
});
diff --git a/web/src/features/monitors/components/MonitorsOnboarding.clienttest.tsx b/web/src/features/monitors/components/MonitorsOnboarding.clienttest.tsx
index 5417540492..98ef54eb2e 100644
--- a/web/src/features/monitors/components/MonitorsOnboarding.clienttest.tsx
+++ b/web/src/features/monitors/components/MonitorsOnboarding.clienttest.tsx
@@ -40,7 +40,7 @@ describe("MonitorsOnboarding", () => {
screen.getByRole("link", { name: /Connect Github Actions/i }),
).toBeInTheDocument();
expect(
- screen.getByRole("link", { name: /Create Monitor/i }),
+ screen.getByRole("link", { name: /Create Alert/i }),
).toBeInTheDocument();
});
@@ -62,16 +62,14 @@ describe("MonitorsOnboarding", () => {
const decoded = parsePrefill(href);
expect(decoded.eventSource).toBe("monitor");
expect(decoded.actionType).toBe(expected);
- expect(decoded.redirectUrl).toBe(`/project/${PROJECT_ID}/monitors`);
+ expect(decoded.redirectUrl).toBe(`/project/${PROJECT_ID}/alerts`);
}
});
- it("links the Create Monitor CTA to the project's new-monitor route", () => {
+ it("links the Create Alert CTA to the project's new-alert route", () => {
render(<MonitorsOnboarding projectId={PROJECT_ID} hasCUDAccess={true} />);
- const link = screen.getByRole("link", { name: /Create Monitor/i });
- expect(link.getAttribute("href")).toBe(
- `/project/${PROJECT_ID}/monitors/new`,
- );
+ const link = screen.getByRole("link", { name: /Create Alert/i });
+ expect(link.getAttribute("href")).toBe(`/project/${PROJECT_ID}/alerts/new`);
});
});
diff --git a/web/src/features/monitors/components/MonitorsOnboarding.tsx b/web/src/features/monitors/components/MonitorsOnboarding.tsx
index 492ccc80e6..59b02af2d5 100644
--- a/web/src/features/monitors/components/MonitorsOnboarding.tsx
+++ b/web/src/features/monitors/components/MonitorsOnboarding.tsx
@@ -67,7 +67,7 @@ export function MonitorsOnboarding({
href={automationCreateHref(
projectId,
channel.actionType,
- `/project/${projectId}/monitors`,
+ `/project/${projectId}/alerts`,
)}
>
<span className="flex items-center gap-2">
@@ -84,16 +84,16 @@ export function MonitorsOnboarding({
{
title: "Decide what to monitor",
description:
- "Create monitors for sudden cost spikes, quality drops, latency changes, or other important changes.",
+ "Create alerts for sudden cost spikes, quality drops, latency changes, or other important changes.",
content: (
<ActionButton
hasAccess={hasCUDAccess}
icon={<Plus className="h-4 w-4" aria-hidden="true" />}
- href={`/project/${projectId}/monitors/new`}
+ href={`/project/${projectId}/alerts/new`}
variant="default"
size="lg"
>
- Create Monitor
+ Create Alert
</ActionButton>
),
},
diff --git a/web/src/features/monitors/components/MonitorsTable.tsx b/web/src/features/monitors/components/MonitorsTable.tsx
index f477f557a3..4bdd7bf072 100644
--- a/web/src/features/monitors/components/MonitorsTable.tsx
+++ b/web/src/features/monitors/components/MonitorsTable.tsx
@@ -58,10 +58,10 @@ export function MonitorsTable() {
const router = useRouter();
const projectId = useProjectIdFromURL() ?? "";
const utils = api.useUtils();
- /** hasCUDAccess gates the edit, pause/resume, and delete row actions behind the monitors:CUD RBAC scope. */
+ /** hasCUDAccess gates the edit, pause/resume, and delete row actions behind the alerts:CUD RBAC scope. */
const hasCUDAccess = useHasProjectAccess({
projectId,
- scope: "monitors:CUD",
+ scope: "alerts:CUD",
});
/** isWiderThanPhone is true at viewports wider than the main nav's drawer breakpoint (768px / Tailwind `md`), the threshold at which the Tags column appears. */
const isWiderThanPhone = useMediaQuery({ query: "(min-width: 768px)" });
@@ -71,16 +71,14 @@ export function MonitorsTable() {
onSuccess: async (_data, variables) => {
await utils.monitors.invalidate();
showSuccessToast({
- title:
- variables.status === "PAUSED" ? "Monitor paused" : "Monitor resumed",
+ title: variables.status === "PAUSED" ? "Alert paused" : "Alert resumed",
description:
variables.status === "PAUSED"
? "Evaluations are halted until you resume."
: "Evaluations have resumed.",
});
},
- onError: (e) =>
- showErrorToast("Failed to update monitor status", e.message),
+ onError: (e) => showErrorToast("Failed to update alert status", e.message),
});
/** paginationState is the bound page index + size, defaulting to 50 per page and synced to the `pageIndex`/`pageSize` URL params. */
@@ -311,7 +309,7 @@ function MonitorRowActions({
variant="ghost"
size={collapsed ? "default" : "icon"}
disabled={!hasCUDAccess}
- aria-label="Edit monitor"
+ aria-label="Edit alert"
title="Edit"
className={cn(!collapsed && rowActionIconColors)}
>
@@ -330,7 +328,7 @@ function MonitorRowActions({
variant="ghost"
size={collapsed ? "default" : "icon"}
disabled={!hasCUDAccess || isStatusPending}
- aria-label={isPaused ? "Resume monitor" : "Pause monitor"}
+ aria-label={isPaused ? "Resume alert" : "Pause alert"}
title={isPaused ? "Resume" : "Pause"}
className={cn(!collapsed && rowActionIconColors)}
onClick={(e) => {
@@ -366,7 +364,7 @@ function MonitorRowActions({
<div onClick={(e) => e.stopPropagation()}>
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <Button size="xs" variant="ghost" aria-label="Monitor actions">
+ <Button size="xs" variant="ghost" aria-label="Alert actions">
<MoreVertical className="h-4 w-4" />
</Button>
</DropdownMenuTrigger>
@@ -412,7 +410,7 @@ const filterStateToListMonitorFilter = (
/** monitorHref is the project-scoped path to a monitor's page, the row-click and edit-action target. */
const monitorHref = (projectId: string, monitorId: string): string =>
- `/project/${projectId}/monitors/${encodeURIComponent(monitorId)}`;
+ `/project/${projectId}/alerts/${encodeURIComponent(monitorId)}`;
/** buildStatusToggleUpdate returns a full update payload with only the status flipped between ACTIVE and PAUSED. */
const buildStatusToggleUpdate = (monitor: Monitor): UpdateMonitor => ({
diff --git a/web/src/features/monitors/monitorRoutes.clienttest.ts b/web/src/features/monitors/monitorRoutes.clienttest.ts
index f1755d995c..2b9ca23325 100644
--- a/web/src/features/monitors/monitorRoutes.clienttest.ts
+++ b/web/src/features/monitors/monitorRoutes.clienttest.ts
@@ -1,15 +1,26 @@
import { describe, expect, it } from "vitest";
+import { renamedRouteRedirects } from "@/redirects.mjs";
import EditMonitorPage from "@/src/features/monitors/pages/EditMonitorPage";
-describe("monitors/<id> route", () => {
+describe("alerts/<id> route", () => {
it("index route renders the same component as the edit route", async () => {
const indexRoute =
- await import("@/src/pages/project/[projectId]/monitors/[monitorId]/index");
+ await import("@/src/pages/project/[projectId]/alerts/[monitorId]/index");
const editRoute =
- await import("@/src/pages/project/[projectId]/monitors/[monitorId]/edit");
+ await import("@/src/pages/project/[projectId]/alerts/[monitorId]/edit");
expect(indexRoute.default).toBe(EditMonitorPage);
expect(indexRoute.default).toBe(editRoute.default);
});
});
+
+describe("renamedRouteRedirects", () => {
+ it("permanently forwards the pre-rename /monitors URLs to /alerts", () => {
+ expect(renamedRouteRedirects).toContainEqual({
+ source: "/project/:projectId/monitors/:path*",
+ destination: "/project/:projectId/alerts/:path*",
+ permanent: true,
+ });
+ });
+});
diff --git a/web/src/features/monitors/pages/EditMonitorPage.tsx b/web/src/features/monitors/pages/EditMonitorPage.tsx
index 7cdab2a1e2..1df94c7e00 100644
--- a/web/src/features/monitors/pages/EditMonitorPage.tsx
+++ b/web/src/features/monitors/pages/EditMonitorPage.tsx
@@ -11,7 +11,7 @@ import { type Monitor } from "@langfuse/shared/monitors";
/** EditMonitorPage gates the edit-monitor route and defers all data fetching to EditMonitorPageContent so blocked users never trigger the monitor query. */
export default function EditMonitorPage() {
return (
- <MonitorPagePermissions scope="monitors:read">
+ <MonitorPagePermissions scope="alerts:read">
<EditMonitorPageRouter />
</MonitorPagePermissions>
);
@@ -59,14 +59,14 @@ const GetMonitorErrorPage = ({ error }: { error: APIError }) => {
if (error?.data?.code == "NOT_FOUND") {
return (
<ErrorPage
- title="Monitor not found"
- message="This monitor doesn't exist or has been deleted."
+ title="Alert not found"
+ message="This alert doesn't exist or has been deleted."
/>
);
}
return (
- <ErrorPage title="Monitor could not be edited" message={error.message} />
+ <ErrorPage title="Alert could not be edited" message={error.message} />
);
};
@@ -79,6 +79,6 @@ const EditMonitorLoadingPage = ({ projectId }: { projectId: string }) => (
/** getHeaderProps returns the page header properties for the EditMonitors page */
const getHeaderProps = (projectId: string, monitorName?: string) => ({
- title: `Edit Monitor${monitorName ? " - " + monitorName : ""}`,
- breadcrumb: [{ name: "Monitors", href: `/project/${projectId}/monitors` }],
+ title: `Edit Alert${monitorName ? " - " + monitorName : ""}`,
+ breadcrumb: [{ name: "Alerts", href: `/project/${projectId}/alerts` }],
});
diff --git a/web/src/features/monitors/pages/ListMonitorsPage.tsx b/web/src/features/monitors/pages/ListMonitorsPage.tsx
index e964bc808e..b99913399f 100644
--- a/web/src/features/monitors/pages/ListMonitorsPage.tsx
+++ b/web/src/features/monitors/pages/ListMonitorsPage.tsx
@@ -16,10 +16,10 @@ import { api } from "@/src/utils/api";
/** headerProps are shared by all of the ListMonitorPage headers */
const headerProps = {
- title: "Monitors",
+ title: "Alerts",
help: {
description:
- "Monitors notify your team and automated workflows of sudden cost spikes, quality drops, latency changes, and other important changes on the system.",
+ "Alerts notify your team and automated workflows of sudden cost spikes, quality drops, latency changes, and other important changes on the system.",
},
};
@@ -37,7 +37,7 @@ export default function ListMonitorsPage() {
);
return (
- <MonitorPagePermissions scope="monitors:read">
+ <MonitorPagePermissions scope="alerts:read">
{!projectId || isLoading ? (
<EmptyPage />
) : isSuccess && hasMonitors ? (
@@ -57,7 +57,7 @@ const OnboardingPage = ({ projectId }: { projectId: string }) => {
/** hasCUDAccess is true if the user has permission to create monitors */
const hasCUDAccess = useHasProjectAccess({
projectId,
- scope: "monitors:CUD",
+ scope: "alerts:CUD",
});
return (
@@ -72,7 +72,7 @@ const MainPage = ({ projectId }: { projectId: string }) => {
/** hasCUDAccess is true if the user has permission to create monitors */
const hasCUDAccess = useHasProjectAccess({
projectId,
- scope: "monitors:CUD",
+ scope: "alerts:CUD",
});
/** monitorEntitlementLimit is the limit of the number of monitors that can be created for this org */
@@ -110,10 +110,10 @@ const MainPage = ({ projectId }: { projectId: string }) => {
}
: undefined
}
- href={`/project/${projectId}/monitors/new`}
+ href={`/project/${projectId}/alerts/new`}
variant="default"
>
- New Monitor
+ New Alert
</ActionButton>
</>
),
diff --git a/web/src/features/monitors/pages/NewMonitorPage.tsx b/web/src/features/monitors/pages/NewMonitorPage.tsx
index f5407c1b80..fb255ede59 100644
--- a/web/src/features/monitors/pages/NewMonitorPage.tsx
+++ b/web/src/features/monitors/pages/NewMonitorPage.tsx
@@ -10,13 +10,13 @@ export default function NewMonitorPage() {
const projectId = router.query.projectId as string;
return (
- <MonitorPagePermissions scope="monitors:CUD">
+ <MonitorPagePermissions scope="alerts:CUD">
<Page
withPadding
headerProps={{
- title: "New Monitor",
+ title: "New Alert",
breadcrumb: [
- { name: "Monitors", href: `/project/${projectId}/monitors` },
+ { name: "Alerts", href: `/project/${projectId}/alerts` },
],
}}
>
diff --git a/web/src/features/tag/components/TagManager.tsx b/web/src/features/tag/components/TagManager.tsx
index 5468b4337f..78ca77b941 100644
--- a/web/src/features/tag/components/TagManager.tsx
+++ b/web/src/features/tag/components/TagManager.tsx
@@ -16,7 +16,7 @@ import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePos
import { Label } from "@/src/components/ui/label";
type TagManagerProps = {
- itemName: "prompt" | "trace" | "monitor";
+ itemName: "prompt" | "trace" | "alert";
tags: string[];
allTags: string[];
hasAccess: boolean;
diff --git a/web/src/pages/project/[projectId]/monitors/[monitorId]/edit.tsx b/web/src/pages/project/[projectId]/alerts/[monitorId]/edit.tsx
similarity index 100%
rename from web/src/pages/project/[projectId]/monitors/[monitorId]/edit.tsx
rename to web/src/pages/project/[projectId]/alerts/[monitorId]/edit.tsx
diff --git a/web/src/pages/project/[projectId]/monitors/[monitorId]/index.tsx b/web/src/pages/project/[projectId]/alerts/[monitorId]/index.tsx
similarity index 100%
rename from web/src/pages/project/[projectId]/monitors/[monitorId]/index.tsx
rename to web/src/pages/project/[projectId]/alerts/[monitorId]/index.tsx
diff --git a/web/src/pages/project/[projectId]/monitors/index.tsx b/web/src/pages/project/[projectId]/alerts/index.tsx
similarity index 100%
rename from web/src/pages/project/[projectId]/monitors/index.tsx
rename to web/src/pages/project/[projectId]/alerts/index.tsx
diff --git a/web/src/pages/project/[projectId]/monitors/new.tsx b/web/src/pages/project/[projectId]/alerts/new.tsx
similarity index 100%
rename from web/src/pages/project/[projectId]/monitors/new.tsx
rename to web/src/pages/project/[projectId]/alerts/new.tsx
diff --git a/web/src/server/api/routers/monitors.ts b/web/src/server/api/routers/monitors.ts
index 91929de44f..db3caab316 100644
--- a/web/src/server/api/routers/monitors.ts
+++ b/web/src/server/api/routers/monitors.ts
@@ -33,7 +33,7 @@ export const monitorsRouter = createTRPCRouter({
throwIfNoProjectAccess({
session: ctx.session,
projectId: input.projectId,
- scope: "monitors:CUD",
+ scope: "alerts:CUD",
});
const currentCount = await ctx.prisma.monitor.count({
@@ -55,7 +55,7 @@ export const monitorsRouter = createTRPCRouter({
throwIfNoProjectAccess({
session: ctx.session,
projectId: input.projectId,
- scope: "monitors:CUD",
+ scope: "alerts:CUD",
});
return MonitorService.update(sessionContextFromCtx(ctx), input);
}),
@@ -66,7 +66,7 @@ export const monitorsRouter = createTRPCRouter({
throwIfNoProjectAccess({
session: ctx.session,
projectId: input.projectId,
- scope: "monitors:CUD",
+ scope: "alerts:CUD",
});
await MonitorService.delete(sessionContextFromCtx(ctx), input);
return { success: true as const };
@@ -78,7 +78,7 @@ export const monitorsRouter = createTRPCRouter({
throwIfNoProjectAccess({
session: ctx.session,
projectId: input.projectId,
- scope: "monitors:read",
+ scope: "alerts:read",
});
return MonitorService.getById(sessionContextFromCtx(ctx), input);
}),
@@ -89,7 +89,7 @@ export const monitorsRouter = createTRPCRouter({
throwIfNoProjectAccess({
session: ctx.session,
projectId: input.projectId,
- scope: "monitors:read",
+ scope: "alerts:read",
});
return MonitorService.list(sessionContextFromCtx(ctx), input);
}),
@@ -100,7 +100,7 @@ export const monitorsRouter = createTRPCRouter({
throwIfNoProjectAccess({
session: ctx.session,
projectId: input.projectId,
- scope: "monitors:read",
+ scope: "alerts:read",
});
const count = await ctx.prisma.monitor.count({
where: { project: { orgId: ctx.session.orgId, deletedAt: null } },
@@ -115,7 +115,7 @@ export const monitorsRouter = createTRPCRouter({
throwIfNoProjectAccess({
session: ctx.session,
projectId: input.projectId,
- scope: "monitors:read",
+ scope: "alerts:read",
});
const monitor = await ctx.prisma.monitor.findFirst({
where: { projectId: input.projectId },
@@ -130,7 +130,7 @@ export const monitorsRouter = createTRPCRouter({
throwIfNoProjectAccess({
session: ctx.session,
projectId: input.projectId,
- scope: "monitors:read",
+ scope: "alerts:read",
});
return MonitorService.getFilterOptions(sessionContextFromCtx(ctx), input);
}),