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

Remove unnecessary this overwrite in stack context manager #873

Merged
merged 2 commits into from
Mar 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/opentelemetry-web/src/StackContextManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export class StackContextManager implements ContextManager {
context = Context.ROOT_CONTEXT
): T {
const manager = this;
const contextWrapper = function(...args: unknown[]) {
return manager.with(context, () => target.apply(context, args));
const contextWrapper = function(this: any, ...args: any[]) {
return manager.with(context, () => target.apply(this, args));
};
Object.defineProperty(contextWrapper, 'length', {
enumerable: false,
Expand Down Expand Up @@ -112,7 +112,7 @@ export class StackContextManager implements ContextManager {
this._currentContext = context || Context.ROOT_CONTEXT;

try {
return fn.apply(context);
return fn();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@obecny would like to get your reviews on this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm it was a bit tricky from what I remember, but if the all tests are working fine, then I guess it should be fine too ?. Can you check the the examples replacing the zone scope manager with the stack if nothing is missing ?.

} catch (err) {
throw err;
} finally {
Expand Down