Skip to content

Commit

Permalink
Revert "Clean await detector data after each method and publication"
Browse files Browse the repository at this point in the history
This reverts commit 70a7d5e.
  • Loading branch information
zodern committed Oct 16, 2024
1 parent 70a7d5e commit 87cc521
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 27 deletions.
21 changes: 2 additions & 19 deletions lib/hijack/wrap_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ export function wrapSession (sessionProto) {
Kadira.tracer.event(kadiraInfo.trace, EventType.Complete);
}

awaitDetector.clean(kadiraInfo.awaitDetectorStore);
kadiraInfo.awaitDetectorStore = undefined;

// processing the message
let trace = Kadira.tracer.buildTrace(kadiraInfo.trace);
Kadira.EventBus.emit('method', 'methodCompleted', trace, this);
Expand All @@ -185,14 +182,7 @@ Meteor.server.publish_handlers = new Proxy(Meteor.server.publish_handlers, {
}

return function (...args) {
return awaitDetector.detect(() => {
let info = Kadira._getInfo();
if (info) {
info.awaitDetectorStore = awaitDetector.getStore();
}

return origMethod.apply(this, args);
});
return awaitDetector.detect(() => origMethod.apply(this, args));
};
}
});
Expand All @@ -215,14 +205,7 @@ Meteor.methods = function (methodMap) {
function wrapMethodHandlerForErrors (name, originalHandler, methodMap) {
methodMap[name] = function () {
try {
return awaitDetector.detect(() => {
let info = Kadira._getInfo();
if (info) {
info.awaitDetectorStore = awaitDetector.getStore();
}

return originalHandler.apply(this, arguments);
});
return awaitDetector.detect(() => originalHandler.apply(this, arguments));
} catch (ex) {
if (ex && Kadira._getInfo()) {
// sometimes error may be just a string or a primitive
Expand Down
7 changes: 0 additions & 7 deletions lib/hijack/wrap_subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { MeteorDebugIgnore } from './error';
import { _ } from 'meteor/underscore';
import { runWithEnvironment } from '../async/als';
import { EventType } from '../constants';
import { awaitDetector } from '../async/async-hook';

export function wrapSubscription (subscriptionProto) {
let originalRunHandler = subscriptionProto._runHandler;
Expand Down Expand Up @@ -41,9 +40,6 @@ export function wrapSubscription (subscriptionProto) {
Kadira.tracer.endLastEvent(kadiraInfo.trace);
Kadira.tracer.event(kadiraInfo.trace, EventType.Complete);
trace = Kadira.tracer.buildTrace(kadiraInfo.trace);

awaitDetector.clean(kadiraInfo.awaitDetectorStore);
kadiraInfo.awaitDetectorStore = undefined;
}

Kadira.EventBus.emit('pubsub', 'subCompleted', trace, this._session, this);
Expand Down Expand Up @@ -72,9 +68,6 @@ export function wrapSubscription (subscriptionProto) {
Kadira.tracer.event(kadiraInfo.trace, EventType.Error, {error: errorForApm});
let trace = Kadira.tracer.buildTrace(kadiraInfo.trace);

awaitDetector.clean(kadiraInfo.awaitDetectorStore);
kadiraInfo.awaitDetectorStore = undefined;

Kadira.models.pubsub._trackError(this._session, this, trace);

// error tracking can be disabled and if there is a trace
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Package.describe({

let npmModules = {
debug: '0.8.1',
'@monti-apm/core': '2.0.0-beta.6',
'@monti-apm/core': '2.0.0-beta.5',
'lru-cache': '5.1.1',
'json-stringify-safe': '5.0.1',
'monti-apm-sketches-js': '0.0.3',
Expand Down

0 comments on commit 87cc521

Please sign in to comment.