![](/_next/image?url=https%3A%2F%2Fvercel.com%2Fapi%2Fv1%2Fintegrations%2Fassets%2Foac_gwLUg829XH0CZGiSpZg2CgSg%2Fimages%2Fb4d1dcf0df3260e40a75e90d8bca79210aaff73e.jpeg&w=3840&q=75)
![](/_next/image?url=https%3A%2F%2Fvercel.com%2Fapi%2Fv1%2Fintegrations%2Fassets%2Foac_gwLUg829XH0CZGiSpZg2CgSg%2Fimages%2F2967626ec2523db693e5149d9f8eceeb9d2b66f8.jpeg&w=3840&q=75)
![](/_next/image?url=https%3A%2F%2Fvercel.com%2Fapi%2Fv1%2Fintegrations%2Fassets%2Foac_gwLUg829XH0CZGiSpZg2CgSg%2Fimages%2Fc262bda583a29e3e8c91430ce339881c1e2d53b4.jpeg&w=3840&q=75)
![](/_next/image?url=https%3A%2F%2Fvercel.com%2Fapi%2Fv1%2Fintegrations%2Fassets%2Foac_gwLUg829XH0CZGiSpZg2CgSg%2Fimages%2F896074781c8a7be269ae61c338466fb4689345a5.jpeg&w=3840&q=75)
![](/_next/image?url=https%3A%2F%2Fvercel.com%2Fapi%2Fv1%2Fintegrations%2Fassets%2Foac_gwLUg829XH0CZGiSpZg2CgSg%2Fimages%2F552e69d8a509ec6a626b33833f443338d2c47350.jpeg&w=3840&q=75)
Overview
Middleware enables developers to easily monitor and analyze log and trace data generated on Vercel, gain insights into their applications, and proactively address potential issues. This Integration offers a robust APM solution through a unified dashboard, streamlining real-time and synthetic monitoring.
In addition, You can create custom dashboards to view trace data, set up alerts on different parameters, and monitor critical issues. The integration enables you to see detailed information about your logs and traces, such as service name, severity, latency, request counts, success ratio, method name, profiling, and attributes.
Instructions
It will produce automatic logs; Proceed by adding a few lines to complete the data flow for traces and profiling.
Required: Integrate @middleware.io/agent-apm-nextjs
package
@middleware.io/agent-apm-nextjs assists the platform in sending logs and traces from your Next.js project.
// Install packagenpm install @middleware.io/agent-apm-nextjs
// Modify next.config.jsmodule.exports = { // your existing config experimental: { instrumentationHook: true }}
// Create instrumentation.ts fileimport tracker from '@middleware.io/agent-apm-nextjs';export function register() { tracker.track({ serviceName: "<SERVICE-NAME>", accessToken: "<ACCESS-TOKEN>", target: "vercel", });}
// For logsexport default async function handler(req, res) { tracker.warn("Warning", { "tester": "Alex" }); tracker.error("Error");}
More details on the Installation > Instrumentation > APM > Vercel integration page.
This integration requires a Pro or Enterprise plan.