0

Currently using Azure App insights in a NodeJS app (specifically a Remix app using Express). After initializing the library, I am not seeing metrics show up on my Application Insights Dashboard nor the "Performance" tab

enter image description here

I've verified that the library is working, by going to "Transaction Search" and making a search for various metrics in my app and they show up there.

Clifford Fajardo
  • 1,357
  • 1
  • 17
  • 28

1 Answers1

0

For some reason, the library isn't properly registering capturing my ingoing and outgoing http requests. To solve this, I had to manually track requests/responses at the root of the app like so:

// server.js
app.all("*", (req, res, next) => {
    /**
     * App insights normally would track all requests by default after initialization, but for some reason its not working in this app.
     * I have manually called `trackNodeHttpRequest` below to get all our requests/responses analyzed and showing up on our dashboard.
     * https://github.com/microsoft/ApplicationInsights-node.js
     */
    appInsights.defaultClient.trackNodeHttpRequest({
        request: req,
        response: res
    });
})

My actual server.js code file: https://github.com/remix-run/remix/discussions/4499

Clifford Fajardo
  • 1,357
  • 1
  • 17
  • 28