Skip to content

Mongoose tracing plugin instrumentation does not trace useful timings #4078

Description

@andreialecu

Package + Version

  • @sentry/tracing: 6.13.3

Version:

6.13.3

Description

Using the mongoose tracing plugin does not produce useful data because it seems to patch functions like .find() which are usually chained:

Calls usually look like:

      const results = await model.find({
        ...query
      })
      .sort({ scheduledDate: 1 })
      .lean();

However, the plugin attaches to the find method which returns immediately. Proof of this here:

Screenshot 2021-10-19 at 15 41 43

Instead of attaching to find, it should attach to exec.

Reference for properly instrumenting mongoose: https://github.com/aspecto-io/opentelemetry-ext-js/blob/master/packages/instrumentation-mongoose/src/mongoose.ts

Originally implemented in:
#3252
#3176

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions