
Security News
Next.js Patches Critical Middleware Vulnerability (CVE-2025-29927)
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.
opentelemetry-instrumentation-mongoose
Advanced tools
open telemetry instrumentation for the `mongoose` module
This package is heavily based on @wdalmut/opentelemetry-plugin-mongoose.
This module provides automatic instrumentation for mongoose
and follows otel DB Semantic Conventions.
npm install --save opentelemetry-instrumentation-mongoose
For further automatic instrumentation instruction see the @opentelemetry/instrumentation package.
const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const { MongooseInstrumentation } = require('opentelemetry-instrumentation-mongoose');
registerInstrumentations({
tracerProvider,
instrumentations: [
new MongooseInstrumentation({
// see under for available configuration
})
]
});
Mongoose instrumentation has few options available to choose from. You can set the following (all optional):
Options | Type | Description |
---|---|---|
suppressInternalInstrumentation | boolean | Mongoose operation use mongodb under the hood. Setting this to true will hide the underlying mongodb spans (if instrumented). |
responseHook | MongooseResponseCustomAttributesFunction | Hook called before response is returned, which allows to add custom attributes to span. |
dbStatementSerializer | DbStatementSerializer | Mongoose instrumentation will serialize db.statement using the specified function. |
moduleVersionAttributeName | string | If passed, a span attribute will be added to all spans with key of the provided moduleVersionAttributeName and value of the patched module version |
requireParentSpan | boolean | Set to true if you do not want to collect traces that start with mongoose |
db.statement
SerializerBy default, this instrumentation does not populate the db.statement
attribute.
If you pass dbStatementSerializer
while using this plugin, the return value of the serializer will be placed in the db.statement
.
Serializer meets the following interfaces:
interface SerializerPayload {
condition?: any;
options?: any;
updates?: any;
document?: any;
aggregatePipeline?: any;
}
type DbStatementSerializer = (operation: string, payload: SerializerPayload) => string;
Please make sure dbStatementSerializer
is error proof, as errors are not handled while executing this function.
This extension (and many others) was developed by Aspecto with ❤️
FAQs
open telemetry instrumentation for the `mongoose` module
The npm package opentelemetry-instrumentation-mongoose receives a total of 3,781 weekly downloads. As such, opentelemetry-instrumentation-mongoose popularity was classified as popular.
We found that opentelemetry-instrumentation-mongoose demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.
Security News
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.