Incomplete mongodb data in nodejs application

I have a nodejs 10.x web application hosted in Google App Engine (flex environment). The application uses mongodb via mongoose and redis.

When I navigate to Databases, select MongoDB, and show all transactions, the displayed operations represent only a very small subset of the database calls that I know are occurring. Moreover, the “call count” values appear to be approximated or otherwise rounded to unnaturally-similar numbers.

I’m using newrelic 6.9.0, mongoose 5.9.6.

Any idea why I’m getting incomplete database operation information?

Thanks for joining the community @myk !

To your first issue:

the displayed operations represent only a very small subset of the database calls that I know are occurring.

Mongoose’s built-in connection pooling affects our Node agent instrumentation and is currently not supported by the Node agent. This causes two issues, transaction conflation and state loss which means that Mongoose calls, or chained calls executed from the callback of a mongoose call can be getting dropped. One way to check for state loss is to generate trace level logs and look for log messages such as Not creating segment or No transaction.

As a potential workaround, you can use the Node agent custom instrumentation API to add your own instrumentation or expand existing transaction instrumentation

We also have a Feature Idea created for support of Mongoose, it would be great if you could go and vote on it as we use Feature Ideas to plan the future direction of our products:

Now to your other question:

Moreover, the “call count” values appear to be approximated or otherwise rounded to unnaturally-similar numbers.

The Node agent itself does not do any modifications to call count, but the UI does limit the number of significant figures shown. Since the agent is reporting these unprocessed values, you can use Insights and NRQL to query these values from the New Relic Database using the following query:

FROM Metric SELECT count(apm.service.datastore.operation.duration) * 1 WHERE appName = 'YOUR APP NAME' FACET metricTimesliceName, datastoreType, table, operation SINCE 30 minutes ago

The NRQL pro tip I just learned is multiplying your count *1 to get the unrounded values.

Here is this query run on your production app, note that only those on your account and New Relic Admins can access this.

You can see where we get this call count, and all our MongoDB instrumentation over in our Github:

Hope that gives you a direction to move forward with!

1 Like