-
Couldn't load subscription status.
- Fork 10
Open
Labels
bugConfirmed and unconfirmed bugs reported by us and customers.Confirmed and unconfirmed bugs reported by us and customers.supportProblems or questions reported by customers.Problems or questions reported by customers.
Description
Next.js 14.2.x applications don't report spans to the agent.
When configured following the docs, the agent starts, and host metrics work. However, Next.js spans aren't reported, and the AppSignal OpenTelemetry tracer isn't able to identify the current span nor create new ones.
Next.js built-in instrumentation works as the emitted spans can be seen when adding a ConsoleSpanExporter()
instrumentation.ts file to output spans in console and to run AppSignal at the same time.
export async function register() {
if (process.env.NEXT_RUNTIME === "nodejs") {
try {
const { NodeTracerProvider } = require("@opentelemetry/sdk-trace-node");
const { BatchSpanProcessor } = require("@opentelemetry/sdk-trace-base");
const { ConsoleSpanExporter } = require("@opentelemetry/sdk-trace-base");
const provider = new NodeTracerProvider();
// Just for testing, let's output to console
provider.addSpanProcessor(new BatchSpanProcessor(new ConsoleSpanExporter()));
provider.register();
console.log("Tracer provider registered");
require("./appsignal.cjs");
} catch (error) {
console.error("Failed to initialize OpenTelemetry:", error);
}
}
}Next.js 13.x, 14.1.x, and 15 work.
Metadata
Metadata
Assignees
Labels
bugConfirmed and unconfirmed bugs reported by us and customers.Confirmed and unconfirmed bugs reported by us and customers.supportProblems or questions reported by customers.Problems or questions reported by customers.