@sentienguard/apm 1.0.18 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +3 -1
  2. package/src/tracing.js +7 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentienguard/apm",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "SentienGuard APM SDK - Minimal, production-safe application performance monitoring",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -58,6 +58,8 @@
58
58
  "@opentelemetry/core": "^2.6.1",
59
59
  "@opentelemetry/instrumentation-express": "^0.46.0",
60
60
  "@opentelemetry/instrumentation-http": "^0.57.2",
61
+ "@opentelemetry/instrumentation-mongodb": "^0.68.0",
62
+ "@opentelemetry/instrumentation-mongoose": "^0.61.0",
61
63
  "@opentelemetry/resources": "^1.30.1",
62
64
  "@opentelemetry/sdk-node": "^0.57.2",
63
65
  "@opentelemetry/sdk-trace-base": "^1.30.1",
package/src/tracing.js CHANGED
@@ -10,6 +10,8 @@ import { SEMRESATTRS_SERVICE_NAME, SEMRESATTRS_DEPLOYMENT_ENVIRONMENT } from '@o
10
10
  import { W3CTraceContextPropagator } from '@opentelemetry/core';
11
11
  import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
12
12
  import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express';
13
+ import { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb';
14
+ import { MongooseInstrumentation } from '@opentelemetry/instrumentation-mongoose';
13
15
  import { AlwaysOnSampler, BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
14
16
  import { getConfig, debug } from './config.js';
15
17
  import { SentienGuardSpanExporter } from './spanExporter.js';
@@ -169,6 +171,8 @@ export function startTracing() {
169
171
  });
170
172
 
171
173
  const expressInstrumentation = new ExpressInstrumentation();
174
+ const mongoInstrumentation = new MongoDBInstrumentation();
175
+ const mongooseInstrumentation = new MongooseInstrumentation();
172
176
 
173
177
  sdk = new NodeSDK({
174
178
  resource,
@@ -176,7 +180,9 @@ export function startTracing() {
176
180
  // Raw trace export sampling is handled inside SentienGuardTraceSpanExporter instead.
177
181
  sampler: new AlwaysOnSampler(),
178
182
  textMapPropagator: new W3CTraceContextPropagator(),
179
- instrumentations: [httpInstrumentation, expressInstrumentation],
183
+ // Include MongoDB/Mongoose instrumentations for "zero-code" DB spans.
184
+ // These are safe even when the app doesn't use MongoDB; they patch when modules are loaded.
185
+ instrumentations: [httpInstrumentation, expressInstrumentation, mongoInstrumentation, mongooseInstrumentation],
180
186
  spanProcessors: [
181
187
  new BatchSpanProcessor(metricsExporter),
182
188
  new BatchSpanProcessor(traceExporter)