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

Premature closing of execute span in graphql instrumentation #750

Closed
samriley opened this issue Nov 22, 2021 · 0 comments · Fixed by #752
Closed

Premature closing of execute span in graphql instrumentation #750

samriley opened this issue Nov 22, 2021 · 0 comments · Fixed by #752

Comments

@samriley
Copy link
Contributor

samriley commented Nov 22, 2021

In the case of execute result being a promise, and if there is no responseHook defined endSpan is called too early

if (
typeof config.responseHook !== 'function' ||
result === undefined ||
err
) {
endSpan(span, err);
return;
}

This is already handled correctly if there is a responseHook defined

if (result.constructor.name === 'Promise') {
(result as Promise<graphqlTypes.ExecutionResult>).then(resultData => {
this._executeResponseHook(span, resultData);
});
} else {
this._executeResponseHook(span, result as graphqlTypes.ExecutionResult);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant