feat: add OpenTelemetry observability, Faro frontend monitoring, remove legacy Next.js app
- Add OpenTelemetry SDK with tracing, metrics, and OTLP export for API and worker - Integrate Grafana Faro for frontend real-user monitoring - Instrument health checks, database, Bull queues, and HTTP exception filter - Add Grafana dashboard JSON for service overview - Remove deprecated apps/web-nj (Next.js) — fully replaced by Vite+React frontend - Update nginx config with OTEL collector proxy - Minor UI fixes in schema viewer, category components, and subscription flow Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
20
apps/api/src/telemetry/worker-tracing.ts
Normal file
20
apps/api/src/telemetry/worker-tracing.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import "dotenv/config"; // Load env vars before checking OTEL_ENABLED
|
||||
import { isOtelEnabled } from "./index";
|
||||
import type { NodeSDK } from "@opentelemetry/sdk-node";
|
||||
|
||||
let sdk: NodeSDK | null = null;
|
||||
|
||||
if (isOtelEnabled) {
|
||||
const { createNodeSDK } = require("./sdk-factory") as typeof import("./sdk-factory");
|
||||
const { HttpInstrumentation } = require("@opentelemetry/instrumentation-http");
|
||||
const { IORedisInstrumentation } = require("@opentelemetry/instrumentation-ioredis");
|
||||
|
||||
sdk = createNodeSDK({
|
||||
serviceName: process.env.OTEL_SERVICE_NAME || "sase-worker",
|
||||
instrumentations: [new HttpInstrumentation(), new IORedisInstrumentation()],
|
||||
});
|
||||
} else {
|
||||
console.log("[worker][otel] Telemetry disabled (OTEL_ENABLED !== 'true')");
|
||||
}
|
||||
|
||||
export { sdk };
|
||||
Reference in New Issue
Block a user