Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@opentelemetry/instrumentation-mongoose does not instrument insertMany method #2488

Open
Vovcharaa opened this issue Oct 16, 2024 · 2 comments
Labels
bug Something isn't working pkg:instrumentation-mongoose priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect

Comments

@Vovcharaa
Copy link

What version of OpenTelemetry are you using?

"@opentelemetry/api": "^1.9.0",
"@opentelemetry/context-async-hooks": "^1.26.0",
"@opentelemetry/exporter-metrics-otlp-grpc": "^0.53.0",
"@opentelemetry/exporter-trace-otlp-grpc": "^0.53.0",
"@opentelemetry/instrumentation-mongodb": "^0.47.0",
"@opentelemetry/instrumentation-mongoose": "^0.42.0",
"@opentelemetry/sdk-metrics": "^1.26.0",
"@opentelemetry/sdk-node": "^0.53.0",
"@opentelemetry/sdk-trace-node": "^1.26.0",

What version of Node are you using?

Node 20.18.0

What did you do?

SDK configuration

const sdk = new opentelemetry.NodeSDK({
  autoDetectResources: false,
  serviceName: process.env.SERVICE_NAME,
  traceExporter: new OTLPTraceExporter(),
  metricReader: new PeriodicExportingMetricReader({
    exporter: new OTLPMetricExporter(),
  }),
  contextManager: new AsyncLocalStorageContextManager(),
  instrumentations: [
    new MongooseInstrumentation({
      suppressInternalInstrumentation: true,
    }),
    new MongoDBInstrumentation({
      dbStatementSerializer: () => 'omitted',
    }),
  ],
  resource: new Resource({
    [ATTR_DEPLOYMENT_ENVIRONMENT]: process.env.ENVIRONMENT,
  }),
  resourceDetectors: [envDetector, hostDetector],
});

sdk.start();

Mongoose code

Model.insertMany(data);

What did you expect to see?

insertMany is instrumented by @opentelemetry/instrumentation-mongoose.

What did you see instead?

@opentelemetry/instrumentation-mongoose ignores insertMany and instead span is created by @opentelemetry/instrumentation-mongodb.
If @opentelemetry/instrumentation-mongodb is not used I don't see any traces from insertMany operation.

Additional context

I believe some other methods are also not instrumented but I have not encountered them yet.

@Vovcharaa Vovcharaa added the bug Something isn't working label Oct 16, 2024
@pichlermarc pichlermarc added pkg:instrumentation-mongoose priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect labels Oct 16, 2024
@pichlermarc
Copy link
Member

cc @blumamir (component owner)

@Vovcharaa
Copy link
Author

@blumamir Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg:instrumentation-mongoose priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect
Projects
None yet
Development

No branches or pull requests

2 participants