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

contrib/99designs/gqlgen/tracer.go: nil check response #2792

Merged

Conversation

dienvoandpadcojp
Copy link
Contributor

What does this PR do?

Check result from graphql responseHandler is nil
related to issue #2791

Motivation

I think I need contribute to community

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

@dienvoandpadcojp dienvoandpadcojp requested review from a team as code owners July 17, 2024 10:03
@darccio
Copy link
Member

darccio commented Jul 17, 2024

@dienvoandpadcojp Thank you for contributing this. Would it possible for you to add a test proving that your fix does what is expected? Thanks!

@darccio darccio added apm:ecosystem contrib/* related feature requests or bugs waiting-for-info waiting for answer from issue creator labels Jul 17, 2024
@dienvoandpadcojp
Copy link
Contributor Author

hi @darccio , I've added test proving that my fix doesn't cause panic

@darccio darccio removed the waiting-for-info waiting for answer from issue creator label Jul 17, 2024
@dienvoandpadcojp
Copy link
Contributor Author

Hi @darccio , may I ask about this PR. Is there any changes are needed on my part? because I don't have the appropriate permissions to merge this PR to main and I don't know what I need to do next

@darccio
Copy link
Member

darccio commented Aug 9, 2024

Hi @dienvoandpadcojp. I meant to come back with our feedback, but I had other issues to handle. Unfortunately, your PR raises some questions:

  • Why the majority of the function is in a defer function?
  • It seems that the real change is just one line: if response != nil && len(response.Errors) > 0 {. Wouldn't be enough to just add the response != nil to the condition?

About the review process for external contributions, we do a gardening session weekly. We didn't have the opportunity to review this PR until this week meeting. In that meeting IDM (the team who has the last word on contribs in this repository) asked to reconsider my approval.

Please, can you address the two previous questions?

@dienvoandpadcojp
Copy link
Contributor Author

dienvoandpadcojp commented Aug 10, 2024

Thanks for your comment, let's me explain the changes

Why the majority of the function is in a defer function?

I saw the previous change version the query.Finish(...) and req.Finish(...) always be executed after the responseHandler was executed. Beside, there was already had defer function when finishing span (if it not nil). So I thought it should be in the defer function.

It seems that the real change is just one line: if response != nil && len(response.Errors) > 0 {. Wouldn't be enough to just add the response != nil to the condition?

You're right, I added logic check response != nil before the previous version which already check len(response.Errors) > 0 . I've check the logic of tracer.WithError and it ok to set err arg by nil. I will update the PR

Copy link

This PR is stale because it has been open 20 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the stale Stuck for more than 1 month label Sep 13, 2024
@dienvoandpadcojp dienvoandpadcojp force-pushed the check-response-handler-result-nil branch from 7721574 to f728c0e Compare September 27, 2024 08:41
@rarguelloF rarguelloF removed the stale Stuck for more than 1 month label Sep 27, 2024
@darccio darccio enabled auto-merge (squash) September 27, 2024 08:51
@darccio darccio merged commit b0bb4c7 into DataDog:main Sep 27, 2024
72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:ecosystem contrib/* related feature requests or bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants