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

Ksohi/add quota scheduler guide #3038

Merged
merged 12 commits into from
Dec 7, 2023
Merged

Conversation

karansohi
Copy link
Contributor

@karansohi karansohi commented Dec 7, 2023

Description of change

Checklist
  • Tested in playground or other setup
  • Screenshot (Grafana) from playground added to PR for 15+ minute run
  • Documentation is changed or added
  • Tests and/or benchmarks are included
  • Breaking changes

Summary by CodeRabbit

  • Documentation

    • Introduced a new "API Quota Management" guide with instructions on quota scheduling using the Aperture SDK.
    • Updated the "Managing OpenAI API Rate Limits" document with new sidebar positioning and modified import paths.
    • Enhanced the "Per-User Rate Limiting" guide with detailed setup and monitoring instructions for rate limiting policies.
  • New Features

    • Implemented new validation scripts for managing quotas and rate limiting, reflecting updated file paths and naming conventions.
  • Refactor

    • Adjusted example code in SDK to prompt for user input and demonstrate quota scheduling and rate limiting capabilities with the Aperture Client.

@karansohi karansohi requested review from a team as code owners December 7, 2023 20:17
@karansohi karansohi self-assigned this Dec 7, 2023
Copy link
Contributor

coderabbitai bot commented Dec 7, 2023

Walkthrough

The recent updates introduce comprehensive guidance and examples for managing API quotas and rate limiting using the Aperture SDK. New documents and scripts have been added to assist users in setting up quota scheduling policies and monitoring their performance. The SDK examples have been enriched with functions to initialize the Aperture Client, handle request rate limits, and schedule requests based on user tiers, enhancing the developer experience with practical, executable code.

Changes

File Path Change Summary
docs/content/guides/api-quota-management.md Added new document for API Quota Management with Aperture SDK instructions and examples.
docs/content/guides/assets/managing-quotas/validate.sh Introduced new Bash script for validating quota management setups.
docs/content/guides/assets/per-user-rate-limiting/validate.sh Updated paths for copying generated policy and graph files.
docs/content/guides/openai.md Updated sidebar position and import paths for managing OpenAI API rate limits.
docs/content/guides/per-user-rate-limiting.md Added instructions for setting up and monitoring rate limiting policies in Aperture.
sdks/aperture-js/example/quota_scheduler_example.ts Added new SDK example for quota scheduling with ApertureClient and inquirer.
sdks/aperture-js/example/rate_limit_example.ts Added new SDK example for rate limiting with ApertureClient and inquirer.

🐇✨
In the land of code where the data streams flow,
The Aperture SDK has put on a show.
With quotas and limits all neatly in line,
The rabbits rejoice, "The API's fine!"
🎉🐰


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 6

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 137d118 and 246700f.
Files ignored due to filter (36)
  • docs/content/code-snippets.json
  • docs/content/guides/api-quota-management/assets/managing-quotas/managing-quotas.mmd
  • docs/content/guides/api-quota-management/assets/managing-quotas/managing-quotas.mmd.md5sum
  • docs/content/guides/api-quota-management/assets/managing-quotas/managing-quotas.mmd.svg
  • docs/content/guides/assets/managing-quotas/graph.mmd
  • docs/content/guides/assets/managing-quotas/graph.mmd.md5sum
  • docs/content/guides/assets/managing-quotas/graph.mmd.svg
  • docs/content/guides/assets/managing-quotas/managing-quotas.mmd
  • docs/content/guides/assets/managing-quotas/managing-quotas.mmd.md5sum
  • docs/content/guides/assets/managing-quotas/managing-quotas.mmd.svg
  • docs/content/guides/assets/managing-quotas/policy.yaml
  • docs/content/guides/assets/managing-quotas/queue.png
  • docs/content/guides/assets/managing-quotas/quota-scheduling-test.png
  • docs/content/guides/assets/managing-quotas/request-metrics.png
  • docs/content/guides/assets/managing-quotas/values.yaml
  • docs/content/guides/assets/managing-quotas/workloads.png
  • docs/content/guides/assets/openai/flow-analytics-dark.png
  • docs/content/guides/assets/openai/flow-analytics-light.png
  • docs/content/guides/assets/openai/priorities-dark.png
  • docs/content/guides/assets/openai/priorities-light.png
  • docs/content/guides/assets/openai/quota-scheduler-blueprint.png
  • docs/content/guides/assets/openai/token-rate-dark.png
  • docs/content/guides/assets/openai/token-rate-light.png
  • docs/content/guides/assets/per-user-rate-limiting/graph.mmd
  • docs/content/guides/assets/per-user-rate-limiting/graph.mmd.md5sum
  • docs/content/guides/assets/per-user-rate-limiting/graph.mmd.svg
  • docs/content/guides/assets/per-user-rate-limiting/policy.yaml
  • docs/content/guides/assets/per-user-rate-limiting/rate-limit-test.png
  • docs/content/guides/assets/per-user-rate-limiting/rate-limiter-graph.png
  • docs/content/guides/assets/per-user-rate-limiting/rate-limiting.mmd
  • docs/content/guides/assets/per-user-rate-limiting/rate-limiting.mmd.md5sum
  • docs/content/guides/assets/per-user-rate-limiting/rate-limiting.mmd.svg
  • docs/content/guides/assets/per-user-rate-limiting/values.yaml
  • docs/gen/policy/aperture.swagger.yaml
  • sdks/aperture-js/example/package-lock.json
  • sdks/aperture-js/example/package.json
Files selected for processing (7)
  • docs/content/guides/api-quota-management.md (1 hunks)
  • docs/content/guides/assets/managing-quotas/validate.sh (1 hunks)
  • docs/content/guides/assets/per-user-rate-limiting/validate.sh (1 hunks)
  • docs/content/guides/openai.md (2 hunks)
  • docs/content/guides/per-user-rate-limiting.md (3 hunks)
  • sdks/aperture-js/example/quota_scheduler_example.ts (1 hunks)
  • sdks/aperture-js/example/rate_limit_example.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • docs/content/guides/assets/per-user-rate-limiting/validate.sh
Additional comments: 10
docs/content/guides/api-quota-management.md (1)
  • 1-274: The documentation in api-quota-management.md provides comprehensive instructions and code snippets for setting up quota scheduling with the Aperture SDK. It includes details on the overview of quota scheduling, setting up the Aperture Client, creating a quota scheduling policy, and monitoring the policy. The documentation also references various images and code snippets, which should be verified for accuracy and relevance to the content. Ensure that all referenced assets and code snippets are correctly included and rendered in the documentation.
docs/content/guides/openai.md (4)
  • 1-6: The change in sidebar position is noted and appears to be correct.

  • 11-18: The updates to the import paths align with the reorganization of the documentation structure as mentioned in the summary.

  • 9-21: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-20]

Please verify if the Grafana dashboard screenshot mentioned in the PR objectives has been included elsewhere in the PR, as it is not visible in the provided hunks.


The Grafana dashboard screenshot has been included in the README.md file.

  • 9-21: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-20]

The changes to the declarations of exported entities in TypeScript example scripts mentioned in the summaries are not part of the provided hunks, so they cannot be reviewed here.

docs/content/guides/per-user-rate-limiting.md (3)
  • 17-29: The addition of the note and overview provides useful context and information about rate limiting, which is relevant to the guide's topic.

  • 56-78: The pre-requisites note and the introduction to setting up the Aperture SDK are clear and provide a good starting point for users to follow along with the guide.

  • 82-252: The detailed instructions for setting up rate limiting, creating policies, and monitoring are well-structured and informative. The use of tabs to differentiate between interfaces and the inclusion of images are good practices for enhancing user understanding.

sdks/aperture-js/example/quota_scheduler_example.ts (1)
  • 63-68: Ensure that the introduction of these new functions and the changes made do not introduce breaking changes across the codebase.

The new functions scheduleRequests and sendRequestForTier are used within quota_scheduler_example.ts. No issues found with their usage in this context.

sdks/aperture-js/example/rate_limit_example.ts (1)
  • 34-34: Verify the unit of time expected for the deadline property in grpcCallOptions. If it expects a timestamp in milliseconds, then the current implementation is correct. Otherwise, adjust the calculation to match the expected unit.

sdks/aperture-js/example/rate_limit_example.ts Outdated Show resolved Hide resolved
sdks/aperture-js/example/rate_limit_example.ts Outdated Show resolved Hide resolved
sdks/aperture-js/example/quota_scheduler_example.ts Outdated Show resolved Hide resolved
sdks/aperture-js/example/quota_scheduler_example.ts Outdated Show resolved Hide resolved
sdks/aperture-js/example/quota_scheduler_example.ts Outdated Show resolved Hide resolved
docs/content/guides/api-quota-management.md Outdated Show resolved Hide resolved
docs/content/guides/api-quota-management.md Show resolved Hide resolved
docs/content/guides/api-quota-management.md Show resolved Hide resolved
docs/content/guides/api-quota-management.md Show resolved Hide resolved
docs/content/guides/api-quota-management.md Show resolved Hide resolved
docs/content/guides/api-quota-management.md Show resolved Hide resolved
docs/content/guides/api-quota-management.md Show resolved Hide resolved
docs/content/guides/api-quota-management.md Show resolved Hide resolved
docs/content/guides/api-quota-management.md Show resolved Hide resolved
docs/content/guides/per-user-rate-limiting.md Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 246700f and 5fdd159.
Files selected for processing (1)
  • sdks/aperture-js/example/quota_scheduler_example.ts (2 hunks)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between ebc9607 and 43cba79.
Files selected for processing (1)
  • docs/content/introduction.md (1 hunks)
Additional comments: 1
docs/content/introduction.md (1)
  • 55-58: The update to the hyperlink reference for the "API Quota Management" guide is correct and reflects the change mentioned in the summary.

@karansohi karansohi merged commit e989389 into main Dec 7, 2023
12 checks passed
@karansohi karansohi deleted the ksohi/add-quota-scheduler-guide branch December 7, 2023 21:47
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.

2 participants