feat: Next.js + Socket.IO 3-mode game (Skribbl, Gartic, Color)

This commit is contained in:
PM
2026-05-01 20:12:36 +00:00
parent b02976c10b
commit 2a40097fad
47 changed files with 7907 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
// OpenTelemetry auto-instrumentation. Imported FIRST in server.js.
const process = require("process");
try {
const { NodeSDK } = require("@opentelemetry/sdk-node");
const {
getNodeAutoInstrumentations,
} = require("@opentelemetry/auto-instrumentations-node");
const {
OTLPTraceExporter,
} = require("@opentelemetry/exporter-trace-otlp-http");
const endpointBase =
process.env.SIGNOZ_OTEL_ENDPOINT || "http://100.64.0.10:4318";
const tracesEndpoint = `${endpointBase.replace(/\/$/, "")}/v1/traces`;
const sdk = new NodeSDK({
serviceName: "skribbl-gartic-color",
traceExporter: new OTLPTraceExporter({ url: tracesEndpoint }),
instrumentations: [
getNodeAutoInstrumentations({
"@opentelemetry/instrumentation-fs": { enabled: false },
}),
],
});
try {
sdk.start();
console.log(
`[otel] tracing initialised (endpoint=${tracesEndpoint}, service=skribbl-gartic-color)`
);
} catch (err) {
console.warn("[otel] sdk.start failed (continuing without tracing):", err?.message || err);
}
process.on("SIGTERM", () => {
sdk.shutdown().catch(() => {}).finally(() => process.exit(0));
});
} catch (err) {
console.warn(
"[otel] tracing dependencies not available, continuing without telemetry:",
err?.message || err
);
}