1import { NextResponse } from "next/server"; 2import { renderPrometheus } from "@factory/observability"; 3 4// TASK-0135 — Prometheus scrape target for the web service 5// (`factory-web`): `target_info` + whatever the web process emits. 6// 204 when OTel is disabled (no provider) or the render fails — the scrape 7// target exists either way, same contract as the API's /metrics. 8// Unauthenticated by design (documented exception to the global guard); 9// exposes no tenant data — only OTel resource labels + counters. 10 11export const dynamic = "force-dynamic"; 12 13export async function GET() { 14 const body = await renderPrometheus().catch(() => ""); 15 if (!body) { 16 return new NextResponse(null, { status: 204 }); 17 } 18 return new NextResponse(body, { 19 status: 200, 20 headers: { "content-type": "text/plain; version=0.0.4; charset=utf-8" } 21 }); 22} 23