Understanding Next.js Instrumentation for Custom Logic at Startup
By
nimishk
If you only eat one bagel today, this is the bagel.
Summary
Next.js 14 introduces the Instrumentation feature for running custom logic at application startup. The feature involves creating an instrumentation file at the project root that exposes a register() API. It is commonly used for initializing logging or telemetry services, as demonstrated with OpenTelemetry in Vercel's example.
Key quotes
· 4 pulledInstrumentation is a new feature introduced in Next.js 14 that allows you to run custom logic when your application starts.
The instrumentation.ts/js file lives at the root of your Next.js project and exposes a register() API, which will be called once when a new Next.js server instance is initiated.
Instrumentation is most often used to initiate logging or telemetry services.
In this example, the register() function initializes OpenTelemetry for the Next.js application.
You might also wanna read
Project Glasswing: AI-assisted vulnerability detection finds over 10,000 critical software flaws
Project Glasswing is a collaborative effort launched to secure critical software against potential threats from increasingly capable AI mode
Project Glasswing: AI-assisted vulnerability detection finds over 10,000 critical software flaws
Project Glasswing is a collaborative effort launched to secure critical software against potential threats from increasingly capable AI mode
Kefir C compiler development moves to private mode indefinitely
The developer of the Kefir C compiler announces the cessation of public development, transitioning the project to private mode indefinitely.
NVIDIA releases open-source physical AI tools for robotics and autonomous vehicle development
NVIDIA has released a set of open-source "physical AI" skills and tools as part of the NVIDIA Agent Toolkit, designed to simplify robotics,
North Korean Group Famous Chollima Compromises Packagist Package to Target PHP Developers
A cybersecurity threat report detailing how the threat actor group "Famous Chollima" (linked to North Korea) targeted PHP developers by comp
hendryadrian.com·1h agoCentOS Stream vs AlmaLinux vs Rocky Linux vs Oracle Linux: A VPS Hosting Comparison
This article compares four Linux distributions—CentOS Stream, AlmaLinux, Rocky Linux, and Oracle Linux—as alternatives for VPS hosting follo
blog.radwebhosting.com·1h ago