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