@reproapp/node-sdk 0.0.31 → 0.0.33
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.
- package/dist/index.d.ts +27 -0
- package/dist/index.js +235 -158
- package/package.json +3 -3
- package/src/index.ts +218 -149
- package/test/mongodb-integration.test.js +71 -1
- package/test/mongodb-mongoose-native-suppression.testcontainers.test.js +158 -0
- package/test/mongodb-suppression-cleanup.test.js +72 -0
package/dist/index.d.ts
CHANGED
|
@@ -262,6 +262,31 @@ export type ReproTracingInitOptions = TracerInitOpts & {
|
|
|
262
262
|
export declare function initReproTracing(opts?: ReproTracingInitOptions): TracerApi | null;
|
|
263
263
|
/** Optional helper if users want to check it. */
|
|
264
264
|
export declare function isReproTracingEnabled(): boolean;
|
|
265
|
+
type Ctx = {
|
|
266
|
+
sid?: string;
|
|
267
|
+
aid?: string;
|
|
268
|
+
rid?: string;
|
|
269
|
+
clockSkewMs?: number;
|
|
270
|
+
excludedSpanIds?: Set<string>;
|
|
271
|
+
maskReq?: MaskRequestContext;
|
|
272
|
+
privacyTasks?: Set<Promise<void>>;
|
|
273
|
+
captureScope?: RequestCaptureScopeState;
|
|
274
|
+
nativeMongoSuppressions?: NativeMongoSuppression[];
|
|
275
|
+
};
|
|
276
|
+
type NativeMongoSuppression = {
|
|
277
|
+
collection?: string | null;
|
|
278
|
+
ops?: Set<string>;
|
|
279
|
+
startedAt: number;
|
|
280
|
+
ownerStore?: Ctx;
|
|
281
|
+
};
|
|
282
|
+
type RequestCaptureScopeState = {
|
|
283
|
+
requestRid: string;
|
|
284
|
+
transport: 'http' | 'kafka' | 'amqp' | 'background';
|
|
285
|
+
backendRequestCount: number;
|
|
286
|
+
traceBatchCount: number;
|
|
287
|
+
dbChangeCount: number;
|
|
288
|
+
emailEventCount: number;
|
|
289
|
+
};
|
|
265
290
|
declare function sanitizeTraceValueForPrivacy(value: any): any;
|
|
266
291
|
declare function sanitizeMaterializedTraceValue(value: any): any;
|
|
267
292
|
export declare function __materializePendingTraceEventsForWorker(payload: TraceMaterializationWorkerPayload): Promise<PendingTraceEventRecord[]>;
|
|
@@ -382,6 +407,8 @@ export declare const __reproTestHooks: {
|
|
|
382
407
|
}): void;
|
|
383
408
|
drainSdkBackgroundQueueForTest(): Promise<void>;
|
|
384
409
|
resetSdkBackgroundQueuesForTest(): void;
|
|
410
|
+
runWithRequestContextForTest<T>(ctx: Partial<Ctx>, fn: () => T): T;
|
|
411
|
+
getNativeMongoSuppressionCountForTest(): number;
|
|
385
412
|
getRuntimePrivacyPolicyForTest(cfg: ReproMiddlewareConfig): NormalizedRuntimePrivacyPolicy | null;
|
|
386
413
|
setRuntimePrivacyPolicyForTest(cfg: ReproMiddlewareConfig, policy: NormalizedRuntimePrivacyPolicy | null): void;
|
|
387
414
|
recordKafkaTraceEventAsyncForTest: typeof recordKafkaTraceEventAsync;
|
package/dist/index.js
CHANGED
|
@@ -835,6 +835,7 @@ function pushNativeMongoSuppression(collection, ops) {
|
|
|
835
835
|
collection: collection == null ? null : String(collection),
|
|
836
836
|
ops: normalizedOps.length ? new Set(normalizedOps) : undefined,
|
|
837
837
|
startedAt: Date.now(),
|
|
838
|
+
ownerStore: store,
|
|
838
839
|
};
|
|
839
840
|
if (!Array.isArray(store.nativeMongoSuppressions)) {
|
|
840
841
|
store.nativeMongoSuppressions = [];
|
|
@@ -845,14 +846,40 @@ function pushNativeMongoSuppression(collection, ops) {
|
|
|
845
846
|
function popNativeMongoSuppression(token) {
|
|
846
847
|
if (!token)
|
|
847
848
|
return;
|
|
848
|
-
const store = als.getStore();
|
|
849
|
+
const store = token.ownerStore ?? als.getStore();
|
|
849
850
|
const suppressions = store?.nativeMongoSuppressions;
|
|
850
|
-
if (
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
851
|
+
if (Array.isArray(suppressions) && suppressions.length > 0) {
|
|
852
|
+
const index = suppressions.indexOf(token);
|
|
853
|
+
if (index >= 0) {
|
|
854
|
+
suppressions.splice(index, 1);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
token.ownerStore = undefined;
|
|
858
|
+
}
|
|
859
|
+
function releaseNativeMongoSuppression(target) {
|
|
860
|
+
const token = target?.__repro_native_mongo_suppression;
|
|
861
|
+
popNativeMongoSuppression(token);
|
|
862
|
+
try {
|
|
863
|
+
delete target.__repro_native_mongo_suppression;
|
|
864
|
+
}
|
|
865
|
+
catch {
|
|
866
|
+
try {
|
|
867
|
+
target.__repro_native_mongo_suppression = undefined;
|
|
868
|
+
}
|
|
869
|
+
catch { }
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
function isMongooseInternalNativeMongoCall() {
|
|
873
|
+
let stack = '';
|
|
874
|
+
try {
|
|
875
|
+
stack = new Error().stack ?? '';
|
|
876
|
+
}
|
|
877
|
+
catch {
|
|
878
|
+
stack = '';
|
|
855
879
|
}
|
|
880
|
+
return stack.includes('/node_modules/mongoose/') ||
|
|
881
|
+
stack.includes('\\node_modules\\mongoose\\') ||
|
|
882
|
+
stack.includes('mongoose/lib/');
|
|
856
883
|
}
|
|
857
884
|
function isNativeMongoSuppressed(collection, op) {
|
|
858
885
|
const suppressions = getCtx().nativeMongoSuppressions;
|
|
@@ -861,16 +888,28 @@ function isNativeMongoSuppressed(collection, op) {
|
|
|
861
888
|
const normalizedCollection = collection == null ? null : String(collection);
|
|
862
889
|
const normalizedOp = normalizeNativeMongoSuppressionOp(op);
|
|
863
890
|
const now = Date.now();
|
|
864
|
-
|
|
865
|
-
|
|
891
|
+
const matchingTokens = [];
|
|
892
|
+
for (let i = suppressions.length - 1; i >= 0; i -= 1) {
|
|
893
|
+
const token = suppressions[i];
|
|
894
|
+
if (!token || now - token.startedAt > 60000) {
|
|
895
|
+
suppressions.splice(i, 1);
|
|
866
896
|
continue;
|
|
897
|
+
}
|
|
867
898
|
if (token.collection && normalizedCollection && token.collection !== normalizedCollection)
|
|
868
899
|
continue;
|
|
869
900
|
if (token.ops && token.ops.size > 0 && !token.ops.has(normalizedOp))
|
|
870
901
|
continue;
|
|
871
|
-
|
|
902
|
+
matchingTokens.push(token);
|
|
872
903
|
}
|
|
873
|
-
|
|
904
|
+
if (matchingTokens.length === 0)
|
|
905
|
+
return false;
|
|
906
|
+
if (!isMongooseInternalNativeMongoCall()) {
|
|
907
|
+
return false;
|
|
908
|
+
}
|
|
909
|
+
for (const token of matchingTokens) {
|
|
910
|
+
popNativeMongoSuppression(token);
|
|
911
|
+
}
|
|
912
|
+
return true;
|
|
874
913
|
}
|
|
875
914
|
function currentClockSkewMs() {
|
|
876
915
|
const store = als.getStore();
|
|
@@ -4634,40 +4673,44 @@ function reproMongoosePlugin(cfg) {
|
|
|
4634
4673
|
next();
|
|
4635
4674
|
});
|
|
4636
4675
|
schema.post('save', { document: true }, function () {
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4676
|
+
try {
|
|
4677
|
+
const { sid, aid } = getCtx();
|
|
4678
|
+
if (!sid || !aid)
|
|
4679
|
+
return;
|
|
4680
|
+
if (this.$isSubdocument)
|
|
4681
|
+
return;
|
|
4682
|
+
const meta = this.__repro_meta || {};
|
|
4683
|
+
const before = null;
|
|
4684
|
+
const after = this;
|
|
4685
|
+
const collection = meta.collection || resolveCollectionOrWarn(this, 'doc');
|
|
4686
|
+
const spanContext = meta.spanContext || captureSpanContextFromTracer(this);
|
|
4687
|
+
if (!shouldCaptureDbSpan(spanContext))
|
|
4688
|
+
return;
|
|
4689
|
+
const modifiedPaths = Array.isArray(meta.modifiedPaths) ? meta.modifiedPaths : [];
|
|
4690
|
+
const query = meta.wasNew
|
|
4691
|
+
? { op: 'insertOne', doc: after }
|
|
4692
|
+
: {
|
|
4693
|
+
filter: { _id: this._id },
|
|
4694
|
+
update: buildModifiedPathUpdate(this, modifiedPaths),
|
|
4695
|
+
options: { upsert: false },
|
|
4696
|
+
};
|
|
4697
|
+
emitDbQuery(cfg, sid, aid ?? undefined, {
|
|
4698
|
+
collection,
|
|
4699
|
+
pk: { _id: this._id },
|
|
4700
|
+
before,
|
|
4701
|
+
after,
|
|
4702
|
+
op: meta.wasNew ? 'insert' : 'update',
|
|
4703
|
+
query,
|
|
4704
|
+
t: alignTimestamp(meta.t0 ?? Date.now()),
|
|
4705
|
+
spanContext,
|
|
4706
|
+
});
|
|
4707
|
+
}
|
|
4708
|
+
finally {
|
|
4709
|
+
releaseNativeMongoSuppression(this);
|
|
4710
|
+
}
|
|
4668
4711
|
});
|
|
4669
4712
|
schema.post('save', { document: true }, function (error, _doc, next) {
|
|
4670
|
-
|
|
4713
|
+
releaseNativeMongoSuppression(this);
|
|
4671
4714
|
next(error);
|
|
4672
4715
|
});
|
|
4673
4716
|
// -------- findOneAndUpdate capture (unchanged) --------
|
|
@@ -4689,34 +4732,38 @@ function reproMongoosePlugin(cfg) {
|
|
|
4689
4732
|
next();
|
|
4690
4733
|
});
|
|
4691
4734
|
schema.post('findOneAndUpdate', function (res) {
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4735
|
+
try {
|
|
4736
|
+
const { sid, aid } = getCtx();
|
|
4737
|
+
if (!sid || !aid)
|
|
4738
|
+
return;
|
|
4739
|
+
const before = null;
|
|
4740
|
+
const after = res ?? null;
|
|
4741
|
+
const collection = this.__repro_collection || resolveCollectionOrWarn(this, 'query');
|
|
4742
|
+
const spanContext = this.__repro_spanContext || captureSpanContextFromTracer(this);
|
|
4743
|
+
if (!shouldCaptureDbSpan(spanContext))
|
|
4744
|
+
return;
|
|
4745
|
+
const filter = this.__repro_filter;
|
|
4746
|
+
const pk = after?._id ?? (filter && typeof filter === 'object' ? filter._id : undefined);
|
|
4747
|
+
emitDbQuery(cfg, sid, aid ?? undefined, {
|
|
4748
|
+
collection,
|
|
4749
|
+
pk: { _id: pk },
|
|
4750
|
+
before,
|
|
4751
|
+
after,
|
|
4752
|
+
op: 'update',
|
|
4753
|
+
queryRaw: {
|
|
4754
|
+
filter,
|
|
4755
|
+
update: this.__repro_update,
|
|
4756
|
+
},
|
|
4757
|
+
t: alignTimestamp(this.__repro_t0 ?? Date.now()),
|
|
4758
|
+
spanContext,
|
|
4759
|
+
});
|
|
4760
|
+
}
|
|
4761
|
+
finally {
|
|
4762
|
+
releaseNativeMongoSuppression(this);
|
|
4763
|
+
}
|
|
4717
4764
|
});
|
|
4718
4765
|
schema.post('findOneAndUpdate', function (error, _res, next) {
|
|
4719
|
-
|
|
4766
|
+
releaseNativeMongoSuppression(this);
|
|
4720
4767
|
next(error);
|
|
4721
4768
|
});
|
|
4722
4769
|
// -------- deleteOne capture (unchanged) --------
|
|
@@ -4736,29 +4783,33 @@ function reproMongoosePlugin(cfg) {
|
|
|
4736
4783
|
next();
|
|
4737
4784
|
});
|
|
4738
4785
|
schema.post('deleteOne', { document: false, query: true }, function () {
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4786
|
+
try {
|
|
4787
|
+
const { sid, aid } = getCtx();
|
|
4788
|
+
if (!sid || !aid)
|
|
4789
|
+
return;
|
|
4790
|
+
const before = null;
|
|
4791
|
+
const collection = this.__repro_collection || resolveCollectionOrWarn(this, 'query');
|
|
4792
|
+
const filter = this.__repro_filter ?? undefined;
|
|
4793
|
+
const spanContext = this.__repro_spanContext || captureSpanContextFromTracer(this);
|
|
4794
|
+
if (!shouldCaptureDbSpan(spanContext))
|
|
4795
|
+
return;
|
|
4796
|
+
emitDbQuery(cfg, sid, aid ?? undefined, {
|
|
4797
|
+
collection,
|
|
4798
|
+
pk: filter && typeof filter === 'object' && '_id' in filter ? { _id: filter._id } : undefined,
|
|
4799
|
+
before,
|
|
4800
|
+
after: null,
|
|
4801
|
+
op: 'delete',
|
|
4802
|
+
queryRaw: { filter },
|
|
4803
|
+
t: alignTimestamp(this.__repro_t0 ?? Date.now()),
|
|
4804
|
+
spanContext,
|
|
4805
|
+
});
|
|
4806
|
+
}
|
|
4807
|
+
finally {
|
|
4808
|
+
releaseNativeMongoSuppression(this);
|
|
4809
|
+
}
|
|
4759
4810
|
});
|
|
4760
4811
|
schema.post('deleteOne', { document: false, query: true }, function (error, _res, next) {
|
|
4761
|
-
|
|
4812
|
+
releaseNativeMongoSuppression(this);
|
|
4762
4813
|
next(error);
|
|
4763
4814
|
});
|
|
4764
4815
|
// -------- NON-intrusive generic query telemetry via schema hooks -------
|
|
@@ -4814,29 +4865,33 @@ function reproMongoosePlugin(cfg) {
|
|
|
4814
4865
|
next();
|
|
4815
4866
|
});
|
|
4816
4867
|
schema.post(op, function (res) {
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4868
|
+
try {
|
|
4869
|
+
const { sid, aid } = getCtx();
|
|
4870
|
+
if (!sid)
|
|
4871
|
+
return;
|
|
4872
|
+
const meta = this.__repro_qmeta || { t0: Date.now(), collection: 'unknown', op };
|
|
4873
|
+
const spanContext = meta.spanContext || captureSpanContextFromTracer(this);
|
|
4874
|
+
emitDbQuery(cfg, sid, aid, {
|
|
4875
|
+
collection: meta.collection,
|
|
4876
|
+
op,
|
|
4877
|
+
queryRaw: {
|
|
4878
|
+
filter: meta.rawFilter,
|
|
4879
|
+
update: meta.rawUpdate,
|
|
4880
|
+
projection: meta.rawProjection,
|
|
4881
|
+
options: meta.rawOptions,
|
|
4882
|
+
},
|
|
4883
|
+
resultMetaRaw: res,
|
|
4884
|
+
durMs: Date.now() - meta.t0,
|
|
4885
|
+
t: alignedNow(),
|
|
4886
|
+
spanContext,
|
|
4887
|
+
});
|
|
4888
|
+
}
|
|
4889
|
+
finally {
|
|
4890
|
+
releaseNativeMongoSuppression(this);
|
|
4891
|
+
}
|
|
4837
4892
|
});
|
|
4838
4893
|
schema.post(op, function (error, _res, next) {
|
|
4839
|
-
|
|
4894
|
+
releaseNativeMongoSuppression(this);
|
|
4840
4895
|
next(error);
|
|
4841
4896
|
});
|
|
4842
4897
|
}
|
|
@@ -4865,24 +4920,28 @@ function reproMongoosePlugin(cfg) {
|
|
|
4865
4920
|
next();
|
|
4866
4921
|
});
|
|
4867
4922
|
schema.post('insertMany', { document: false, query: false }, function (docs) {
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4923
|
+
try {
|
|
4924
|
+
const { sid, aid } = getCtx();
|
|
4925
|
+
if (!sid)
|
|
4926
|
+
return;
|
|
4927
|
+
const meta = this.__repro_insert_meta || { t0: Date.now(), collection: 'unknown' };
|
|
4928
|
+
const spanContext = meta.spanContext || captureSpanContextFromTracer(this);
|
|
4929
|
+
emitDbQuery(cfg, sid, aid ?? undefined, {
|
|
4930
|
+
collection: meta.collection,
|
|
4931
|
+
op: 'insertMany',
|
|
4932
|
+
queryRaw: { docs: meta.rawDocs ?? undefined },
|
|
4933
|
+
resultMetaRaw: docs,
|
|
4934
|
+
durMs: Date.now() - meta.t0,
|
|
4935
|
+
t: alignedNow(),
|
|
4936
|
+
spanContext,
|
|
4937
|
+
});
|
|
4938
|
+
}
|
|
4939
|
+
finally {
|
|
4940
|
+
releaseNativeMongoSuppression(this);
|
|
4941
|
+
}
|
|
4883
4942
|
});
|
|
4884
4943
|
schema.post('insertMany', { document: false, query: false }, function (error, _res, next) {
|
|
4885
|
-
|
|
4944
|
+
releaseNativeMongoSuppression(this);
|
|
4886
4945
|
next(error);
|
|
4887
4946
|
});
|
|
4888
4947
|
schema.pre('bulkWrite', { document: false, query: false }, function (next, ops) {
|
|
@@ -4907,24 +4966,28 @@ function reproMongoosePlugin(cfg) {
|
|
|
4907
4966
|
next();
|
|
4908
4967
|
});
|
|
4909
4968
|
schema.post('bulkWrite', { document: false, query: false }, function (res) {
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4969
|
+
try {
|
|
4970
|
+
const { sid, aid } = getCtx();
|
|
4971
|
+
if (!sid)
|
|
4972
|
+
return;
|
|
4973
|
+
const meta = this.__repro_bulk_meta || { t0: Date.now(), collection: 'unknown' };
|
|
4974
|
+
const spanContext = meta.spanContext || captureSpanContextFromTracer(this);
|
|
4975
|
+
emitDbQuery(cfg, sid, aid, {
|
|
4976
|
+
collection: meta.collection,
|
|
4977
|
+
op: 'bulkWrite',
|
|
4978
|
+
queryRaw: { ops: meta.rawOps ?? undefined },
|
|
4979
|
+
resultMetaRaw: res,
|
|
4980
|
+
durMs: Date.now() - meta.t0,
|
|
4981
|
+
t: alignedNow(),
|
|
4982
|
+
spanContext,
|
|
4983
|
+
});
|
|
4984
|
+
}
|
|
4985
|
+
finally {
|
|
4986
|
+
releaseNativeMongoSuppression(this);
|
|
4987
|
+
}
|
|
4925
4988
|
});
|
|
4926
4989
|
schema.post('bulkWrite', { document: false, query: false }, function (error, _res, next) {
|
|
4927
|
-
|
|
4990
|
+
releaseNativeMongoSuppression(this);
|
|
4928
4991
|
next(error);
|
|
4929
4992
|
});
|
|
4930
4993
|
// Aggregate middleware (non-intrusive)
|
|
@@ -4954,24 +5017,28 @@ function reproMongoosePlugin(cfg) {
|
|
|
4954
5017
|
next();
|
|
4955
5018
|
});
|
|
4956
5019
|
schema.post('aggregate', function (res) {
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
5020
|
+
try {
|
|
5021
|
+
const { sid, aid } = getCtx();
|
|
5022
|
+
if (!sid)
|
|
5023
|
+
return;
|
|
5024
|
+
const meta = this.__repro_aggmeta || { t0: Date.now(), collection: 'unknown' };
|
|
5025
|
+
const spanContext = meta.spanContext || captureSpanContextFromTracer(this);
|
|
5026
|
+
emitDbQuery(cfg, sid, aid, {
|
|
5027
|
+
collection: meta.collection,
|
|
5028
|
+
op: 'aggregate',
|
|
5029
|
+
queryRaw: { pipeline: meta.rawPipeline },
|
|
5030
|
+
resultMetaRaw: res,
|
|
5031
|
+
durMs: Date.now() - meta.t0,
|
|
5032
|
+
t: alignedNow(),
|
|
5033
|
+
spanContext,
|
|
5034
|
+
});
|
|
5035
|
+
}
|
|
5036
|
+
finally {
|
|
5037
|
+
releaseNativeMongoSuppression(this);
|
|
5038
|
+
}
|
|
4972
5039
|
});
|
|
4973
5040
|
schema.post('aggregate', function (error, _res, next) {
|
|
4974
|
-
|
|
5041
|
+
releaseNativeMongoSuppression(this);
|
|
4975
5042
|
next(error);
|
|
4976
5043
|
});
|
|
4977
5044
|
};
|
|
@@ -8721,6 +8788,16 @@ exports.__reproTestHooks = {
|
|
|
8721
8788
|
lastClientActivityAt = 0;
|
|
8722
8789
|
sdkBackgroundQuietUntil = 0;
|
|
8723
8790
|
},
|
|
8791
|
+
runWithRequestContextForTest(ctx, fn) {
|
|
8792
|
+
return als.run({
|
|
8793
|
+
...ctx,
|
|
8794
|
+
excludedSpanIds: ctx.excludedSpanIds ?? new Set(),
|
|
8795
|
+
}, fn);
|
|
8796
|
+
},
|
|
8797
|
+
getNativeMongoSuppressionCountForTest() {
|
|
8798
|
+
const suppressions = getCtx().nativeMongoSuppressions;
|
|
8799
|
+
return Array.isArray(suppressions) ? suppressions.length : 0;
|
|
8800
|
+
},
|
|
8724
8801
|
getRuntimePrivacyPolicyForTest(cfg) {
|
|
8725
8802
|
return getRuntimePrivacyState(cfg).policy;
|
|
8726
8803
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reproapp/node-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"description": "Repro Nest SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"build": "tsc -p tsconfig.json",
|
|
13
13
|
"dev": "tsc -p tsconfig.json --watch --preserveWatchOutput",
|
|
14
14
|
"prepublishOnly": "npm run build",
|
|
15
|
-
"test": "npm run build && node test/unawaited.test.js && node test/integration-unawaited.js && node test/request-flush-timing.test.js && node test/request-capture-background.test.js && node test/init-auto-http-server.test.js && node test/client-performance-regression.test.js && node test/request-manifest-priority.test.js && node test/runtime-no-double-invoke.test.js && node test/express-trace-http-args.test.js && node test/trace-batch-size.test.js && node test/sdk-background-priority.test.js && node test/ingest-queue-retention.test.js && node test/ingest-high-priority-retention.test.js && node test/ingest-critical-retention.test.js && node test/ingest-critical-retry-retention.test.js && node test/ingest-timeout.test.js && node -r ./tracer/register test/promise-map.test.js && node test/disable-subtree.test.js && node test/circular-capture.test.js && node test/wrap-plugin-arrow-args.test.js && node test/wrap-plugin-super-call.test.js && node test/function-arg-identity.test.js && node test/privacy-runtime-policy.test.js && node test/runtime-privacy-materialization.test.js && node test/kafka-runtime-privacy-policy.test.js && node test/amqplib-integration.test.js && node test/mongodb-integration.test.js && node test/mongodb-esm-import-hook.test.js",
|
|
16
|
-
"test:containers": "npm run build && node test/runtime-no-double-invoke.testcontainers.test.js && node test/wrap-plugin-super-call.testcontainers.test.js && node test/function-arg-identity.testcontainers.test.js"
|
|
15
|
+
"test": "npm run build && node test/unawaited.test.js && node test/integration-unawaited.js && node test/request-flush-timing.test.js && node test/request-capture-background.test.js && node test/init-auto-http-server.test.js && node test/client-performance-regression.test.js && node test/request-manifest-priority.test.js && node test/runtime-no-double-invoke.test.js && node test/express-trace-http-args.test.js && node test/trace-batch-size.test.js && node test/sdk-background-priority.test.js && node test/ingest-queue-retention.test.js && node test/ingest-high-priority-retention.test.js && node test/ingest-critical-retention.test.js && node test/ingest-critical-retry-retention.test.js && node test/ingest-timeout.test.js && node -r ./tracer/register test/promise-map.test.js && node test/disable-subtree.test.js && node test/circular-capture.test.js && node test/wrap-plugin-arrow-args.test.js && node test/wrap-plugin-super-call.test.js && node test/function-arg-identity.test.js && node test/privacy-runtime-policy.test.js && node test/runtime-privacy-materialization.test.js && node test/kafka-runtime-privacy-policy.test.js && node test/amqplib-integration.test.js && node test/mongodb-integration.test.js && node test/mongodb-esm-import-hook.test.js && node test/mongodb-suppression-cleanup.test.js",
|
|
16
|
+
"test:containers": "npm run build && node test/runtime-no-double-invoke.testcontainers.test.js && node test/wrap-plugin-super-call.testcontainers.test.js && node test/function-arg-identity.testcontainers.test.js && node test/mongodb-mongoose-native-suppression.testcontainers.test.js"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"express": "^5.1.0",
|