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: additional options to reduce noise #2695

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

samsullivan
Copy link
Contributor

@samsullivan samsullivan commented May 15, 2024

What does this PR do?

Adds two new configuration options to contrib/99designs/gqlgen, which have a similar end goal of reducing noise:

  • SkipFieldsForIntrospectionQuery
    • if the OperationName is IntrospectionQuery, spans are not created for each field
  • SkipFieldsWithTrivialResolver
    • if the field resolver is trivial (doesn't require a function / can be accessed directly from the parent object), spans are not created

Motivation

We started using contrib/99designs/gqlgen middleware recently and noticed it creates way more spans than we intended, most of which have little value for our needs.

Fixes #2684. Fixes #2610.

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!

@samsullivan samsullivan requested review from a team as code owners May 15, 2024 04:08
Comment on lines -162 to +175
Trivial: !(fieldCtx.IsMethod || fieldCtx.IsResolver), // TODO: Is this accurate?
Trivial: isTrivial,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@samsullivan
Copy link
Contributor Author

Alternate naming: WithOmitTrivialFields and WithOmitIntrospectionQuery 🤷

@seh
Copy link

seh commented May 27, 2024

Alternate naming: WithOmitTrivialFields and WithOmitIntrospectionQuery 🤷

How about WithTrivialFieldsOmitted and WithIntrospectionQueriesOmitted?

What else remains to settle in order to merge this patch?

@samsullivan
Copy link
Contributor Author

Alternate naming: WithOmitTrivialFields and WithOmitIntrospectionQuery 🤷

How about WithTrivialFieldsOmitted and WithIntrospectionQueriesOmitted?

Can push tomorrow.

What else remains to settle in order to merge this patch?

Nothing but review, as far as I'm aware.

@samsullivan
Copy link
Contributor Author

@darccio I was just signing on for the day; did you have any opinion on the naming?

@darccio
Copy link
Contributor

darccio commented May 28, 2024

@darccio I was just signing on for the day; did you have any opinion on the naming?

Being honest, I would drop the With from both options, but I decided to keep them as you all seemed comfortable with them 😁 If you meant between Skip and Omit I prefer Skip at the beginning of the name, so the user can be sure about what it does (and Skip sounds more clear to me than Omit).

@samsullivan
Copy link
Contributor Author

@darccio I was just signing on for the day; did you have any opinion on the naming?

Being honest, I would drop the With from both options, but I decided to keep them as you all seemed comfortable with them 😁 If you meant between Skip and Omit I prefer Skip at the beginning of the name, so the user can be sure about what it does (and Skip sounds more clear to me than Omit).

Agreed, but had simply been trying to follow other patterns existing elsewhere in the repo; pushed to shorten these by removing With prefix (fns start w/Skip).

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