pinpoint-apm / pinpoint-node-agent

Pinpoint Node.js agent
Apache License 2.0
56 stars 10 forks source link

next.js #114

Open feelform opened 2 years ago

Jungley8 commented 1 year ago

+1

clockk commented 1 year ago

We confirmed that it is currently tracking properly in the Next.js page directory. What does Next.js do?

kode15333 commented 3 months ago

i think some people faced same issue like me

if you want to set up Pinpoint-Node-Agent,

you should check next.config.js instrumentationHook option

and you just implement pinpoint code at instrumentation.js

// next.config.js
{
   experimental: {
    instrumentationHook: true,
  },
}
// instrumentation.js
export async function register () {
 if(process.env.NEXT_RUNTIME === "nodejs"){
  const Agent = await require("pinpoint-node-agent/lib/agent")

  new Agent({
   ...your config
   })
 }
}