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

Add performance hints support #309

Merged
merged 3 commits into from
Dec 2, 2024
Merged

Add performance hints support #309

merged 3 commits into from
Dec 2, 2024

Conversation

fauna-chase
Copy link
Contributor

@fauna-chase fauna-chase commented Nov 27, 2024

ENG-6989

Description

This allows the driver to be configured to query with performance hints enabled. When enabled, performance hints will be returned in the summary of the response.

Motivation and context

Without this change we won't be able to display performance hints in the dashboard or CLI. Performance hints are intended to be a self service way for users to debug query performance/cost and just overall find ways to improve their queries.

How was the change tested?

I added a test for the specified header. I also tested this version of the CLI with a locally running version of the dashboard to ensure I could get performance hints to show up.

Screenshots (if appropriate):

Change types

    • Bug fix (non-breaking change that fixes an issue)
  • [ x ] New feature (non-breaking change that adds functionality)
    • Breaking change (backwards-incompatible fix or feature)

Checklist:

  • [ x ] My code follows the code style of this project.
    • My change requires a change to Fauna documentation.
    • My change requires a change to the README, and I have updated it accordingly.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

This allows the driver to be configured to query with performance hints
enabled. When enabled, performance hints will be returned in the summary
of the response.
@fauna-chase fauna-chase requested a review from ecooper November 27, 2024 17:55
ecooper
ecooper previously approved these changes Nov 27, 2024
Copy link
Contributor

@ecooper ecooper left a comment

Choose a reason for hiding this comment

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

Approved assuming you make the recommended changes.

/**
* Enable or disable performance hints. If no value is provided, performance hints will be disabled.
*/
performanceHints?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

As much as this pains me, for better or worse, these types have been using snake_case for configuration that gets passed as headers. We should keep these consistent and make this performance_hints.

We can move everything user-facing to camel in a future major version change. Until then, it's better to be consistent even if it's sort of silly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

o thats cool! I just didn't realize that and I just trend towards the camel case by default

@@ -120,6 +120,11 @@ export interface ClientConfiguration {
*/
typecheck?: boolean;

/**
* Enable or disable performance hints. If no value is provided, performance hints will be disabled.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add the context that this shows up in QueryInfo's summary? Otherwise, it's not very clear how this changes the output.

jrodewig
jrodewig previously approved these changes Nov 27, 2024
Copy link
Contributor

@jrodewig jrodewig left a comment

Choose a reason for hiding this comment

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

LGTM. I left some suggestions that you can take or leave as wanted. I'll ensure JS driver support is covered in https://github.com/fauna/docs.fauna.com/pull/2676.

src/client-configuration.ts Outdated Show resolved Hide resolved
src/wire-protocol.ts Outdated Show resolved Hide resolved
Co-authored-by: James Rodewig <james.rodewig@fauna.com>
Copy link
Contributor

@ptpaterson ptpaterson left a comment

Choose a reason for hiding this comment

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

LGTM. Y'all did all the hard work!

@fauna-chase fauna-chase merged commit fa87bfb into main Dec 2, 2024
7 checks passed
@fauna-chase fauna-chase deleted the performance-hints branch December 2, 2024 22:46
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 this pull request may close these issues.

4 participants