🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
// @vitest-environment node
import { describe, expect, it } from "vitest";
import { renderNamePlaceholder } from "./renderMonitorLabels";
describe("renderNamePlaceholder", () => {
it("measured metric: aggregation of view + measure is operator threshold", () => {
expect(
renderNamePlaceholder({
view: "observations",
metric: { measure: "latency", aggregation: "sum" },
thresholdOperator: "LT",
alertThreshold: 100,
}),
).toBe("Sum of Observations Latency is below 100");
});
it("percentile aggregation: kept verbatim, not start-cased into 'P 95'", () => {
expect(
renderNamePlaceholder({
view: "observations",
metric: { measure: "latency", aggregation: "p95" },
thresholdOperator: "GT",
alertThreshold: 100,
}),
).toBe("p95 of Observations Latency is above 100");
});
it("bare count: omits the measure", () => {
expect(
renderNamePlaceholder({
view: "observations",
metric: { measure: "count", aggregation: "count" },
thresholdOperator: "GT",
alertThreshold: 5,
}),
).toBe("Count of Observations is above 5");
});
it("missing threshold: defaults the value to 0", () => {
expect(
renderNamePlaceholder({
view: "observations",
metric: { measure: "count", aggregation: "count" },
thresholdOperator: "GT",
alertThreshold: null,
}),
).toBe("Count of Observations is above 0");
});
});