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

improve information at RequestContext for rich logging #804

Closed
vvakame opened this issue Jul 25, 2019 · 1 comment · Fixed by #828
Closed

improve information at RequestContext for rich logging #804

vvakame opened this issue Jul 25, 2019 · 1 comment · Fixed by #828
Labels
enhancement New feature or request

Comments

@vvakame
Copy link
Collaborator

vvakame commented Jul 25, 2019

I want to get operationName and persistedQueryHash to logging in handler.RequestMiddleware.

gql-log

Currently, We can't get accurate information.

for example, We can't detect which operation is in execute from RequestContext.
https://github.com/99designs/gqlgen-contrib/blob/c654377d611cfcf5b77012b5814af5a14a79bc86/gqlopencensus/tracer.go#L136-L147

query A {
  a: viewer {
    email
  }
}

query B {
  b: viewer {
    email
  }
}

Current tracer implementations can't get operationName B when it chosen.

so, I think func NewRequestContext(doc *ast.QueryDocument, query string, variables map[string]interface{}) *RequestContext is not extensible without breaking change.
I suggest to make func (rctx *RequestContext) Validate() error to check and fill empty field and deprecate NewRequestContext.

What do you think about my suggestion? ✨

@vektah vektah added the enhancement New feature or request label Aug 7, 2019
@vektah
Copy link
Collaborator

vektah commented Aug 7, 2019

Sounds good to me

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

Successfully merging a pull request may close this issue.

2 participants