Skip to content

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

feat(api): return langfuse version on /health (#792)

Marc Klingen660a23873193
diff --git a/fern/apis/server/definition/health.yml b/fern/apis/server/definition/health.yml
index 7acfa616a8..3a37e1f893 100644
--- a/fern/apis/server/definition/health.yml
+++ b/fern/apis/server/definition/health.yml
@@ -7,9 +7,22 @@ service:
docs: Check health of API and database
method: GET
path: /health
+ response: HealthResponse
errors:
- ServiceUnavailableError
+types:
+ HealthResponse:
+ properties:
+ version:
+ type: string
+ docs: Langfuse server version
+ status: string
+ examples:
+ - value:
+ version: 1.25.0
+ status: OK
+
errors:
ServiceUnavailableError:
status-code: 503
diff --git a/generated/openapi-server/openapi.yml b/generated/openapi-server/openapi.yml
index a672249f55..33bdd22d1b 100644
--- a/generated/openapi-server/openapi.yml
+++ b/generated/openapi-server/openapi.yml
@@ -300,8 +300,12 @@ paths:
- Health
parameters: []
responses:
- '204':
+ '200':
description: ''
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/HealthResponse'
'400':
description: ''
content:
@@ -1302,6 +1306,20 @@ components:
type: string
required:
- name
+ HealthResponse:
+ title: HealthResponse
+ type: object
+ properties:
+ version:
+ type: string
+ description: Langfuse server version
+ example: 1.25.0
+ status:
+ type: string
+ example: OK
+ required:
+ - version
+ - status
IngestionEvent:
title: IngestionEvent
oneOf:
diff --git a/src/pages/api/public/health.ts b/src/pages/api/public/health.ts
index a1626c26ac..3a593eb7bc 100644
--- a/src/pages/api/public/health.ts
+++ b/src/pages/api/public/health.ts
@@ -1,3 +1,4 @@
+import { VERSION } from "@/src/constants/VERSION";
import { cors, runMiddleware } from "@/src/features/public-api/server/cors";
import { telemetry } from "@/src/features/telemetry";
import { prisma } from "@/src/server/db";
@@ -12,7 +13,12 @@ export default async function handler(
try {
await prisma.$queryRaw`SELECT 1;`;
} catch (e) {
- return res.status(503).json({ status: "Database not available" });
+ return res.status(503).json({
+ status: "Database not available",
+ version: VERSION.replace("v", ""),
+ });
}
- return res.status(200).json({ status: "OK" });
+ return res
+ .status(200)
+ .json({ status: "OK", version: VERSION.replace("v", "") });
}