elastic / apm-agent-rum-js

https://www.elastic.co/guide/en/apm/agent/rum-js/current/index.html
MIT License
278 stars 133 forks source link

APM with NextJS not working #1475

Closed silici0 closed 8 months ago

silici0 commented 8 months ago

My _app.tsx :

  initApm({
    serviceName: "Admin Flix",
    serverUrl: "https://server.com",
    serviceVersion: "",
    environment: "localhost",
    logLevel: "trace",
    distributedTracingOrigins: [
      "https://server.flix.codes",
      "http://localhost:3000",
    ],
  });

All pages configured with export default withTransaction("Roles", "component")(Roles);

Looking on debug when i access a page first time image

Its seens the startTransaction is missing which page it is... When i look the reports is missing a lot info, missing page-loads, missing http-request

What i missing ?

vigneshshanmugam commented 8 months ago

@silici0 Looking at the configuration and the code you shared export default withTransaction("Roles", "component")(Roles);

This will effectively put all the transactions as Roles and under component type. It really depends on where there withTransaction components are called, but if they are called everywhere during page-load and also during page transitions (route-change), then all these types would be replaced by the component type since they are overriden in that way.

withTransaction is meant only for instrumenting individual components/pages where the auto instrumentation suffers to capture the right information from the user activity. I would recommend you to use it sparingly and only on pages that you don't see the agent gathering enough information.

silici0 commented 8 months ago

I see, that why it was so confusing. Thanks so much