dd-trace-js icon indicating copy to clipboard operation
dd-trace-js copied to clipboard

Filtering MongoDB span won't work

Open jeansouza opened this issue 2 years ago • 1 comments

Hey guys!

I use Mongoose here, and it always tries to create the MongoDB collection, and when this collection already exists MongoDB throws an error that is ignored by Mongoose, but the tracer catches it, and I want it to ignore it, I've tried two ways:

tracer.init({ profiling: true, runtimeMetrics: true })
tracer.use('mongodb-core', { measured: { 'create core.$cmd': false } })
tracer.init({ profiling: true, runtimeMetrics: true })
tracer.use('mongodb-core', { measured: { 'create core\\.\\$cmd': false } })

Both failed. Am I doing something wrong? Shouldn't this make the tracer ignore the spans?

Thanks!

Expected behaviour

The tracer should be filtering the specific span.

Actual behaviour

The span is not filtered.

Steps to reproduce

Setting up Mongoose with a schema with autoupdate enabled, and a DD tracer.

Environment

  • Operation system: macOS 13.3.1
  • Node.js version: v16
  • Tracer version: 4.6.0
  • Relevant library versions: Mongoose 7.4.2

jeansouza avatar Aug 22 '23 17:08 jeansouza

Having a similar issue with:

    tracer.use('mongodb-core', {
        measured: {
            "ismaster admin.$cmd": false,
        }
    });

ls-aron-kyle avatar Nov 15 '23 16:11 ls-aron-kyle