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 pgsql scenario #3125

Merged
merged 12 commits into from
Jan 5, 2024
Merged

Add pgsql scenario #3125

merged 12 commits into from
Jan 5, 2024

Conversation

hasit
Copy link
Contributor

@hasit hasit commented Jan 5, 2024

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

  • New Features

    • Introduced a load testing script for PostgreSQL database concurrency.
    • Added a new Dockerfile for building a Go application with health check.
    • Implemented PostgreSQL database connection and handling in the Go SDK example.
  • Enhancements

    • Search functionality now supports custom HTTP headers.
    • Updated Kubernetes configurations with namespace, labels, and environment variables.
  • Bug Fixes

    • Fixed the initialization of inflightRequests to prevent logic errors in request handling.
  • Refactor

    • Replaced wget with curl for HTTP requests to improve reliability and performance.
    • Modified flow.go to better manage inflight requests.

@hasit hasit self-assigned this Jan 5, 2024
@hasit hasit requested review from a team as code owners January 5, 2024 01:09
Copy link
Contributor

coderabbitai bot commented Jan 5, 2024

Walkthrough

The recent changes encompass a variety of updates including a shift from wget to curl with additional headers for a web request, a new load testing script for PostgreSQL using k6, enhanced Kubernetes configuration for an application with PostgreSQL support, a Dockerfile for a Go application with a multi-stage build process, and Go code to connect to PostgreSQL and handle specific HTTP requests. Furthermore, a notable code change in the SDK impacts the initialization of inflightRequests.

Changes

File Path Change Summary
playground/Tiltfile Replaced wget with curl and added custom headers.
playground/scenarios/postgres-concurrency/load-generator/test.js
playground/tanka/lib/apps/aperture-sdk-example/aperture-sdk-example.libsonnet
Introduced a k6 load testing script for PostgreSQL and updated Kubernetes configuration for PostgreSQL support.
sdks/aperture-go/Dockerfile.manual Introduced a Dockerfile for a multi-stage Go application build.
sdks/aperture-go/examples/manual/main.go
sdks/aperture-go/sdk/flow.go
Updated Go code to connect to PostgreSQL and handle specific HTTP requests, including a notable change impacting inflightRequests initialization.
blueprints/concurrency-limiting/base/config.libsonnet
blueprints/concurrency-scheduling/base/config.libsonnet
blueprints/quota-scheduling/base/config.libsonnet
blueprints/rate-limiting/base/config.libsonnet
Various modifications to the configuration files for concurrency, scheduling, and rate limiting.
docs/content/reference/blueprints/concurrency-scheduling/base.md
docs/content/reference/blueprints/quota-scheduling/base.md
docs/content/reference/blueprints/rate-limiting/base.md
Updates to the documentation reflecting changes in default values and configurations for concurrency, scheduling, and rate limiting blueprints.
pkg/scheduler/wfq.go Modified the onQueueExit method within the preemptionMetrics struct.

Poem

🐇💻 CodeRabbit hopped along,
🔄 Swapping wget with curl so strong.
🚀 To the cloud, the app takes flight,
With PostgreSQL, it scales new heights. 🌟


Tips

Chat

There are 3 ways to chat with CodeRabbit's AI:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid.
    • @coderabbitai read the files in the src/scheduler package and generate README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c8e7be1 and 55163c6.
Files ignored due to filter (5)
  • playground/scenarios/postgres-concurrency/metadata.json
  • playground/scenarios/postgres-concurrency/policies/concurrency-scheduling-cr.yaml
  • playground/scenarios/postgres-concurrency/policies/concurrency-scheduling.yaml
  • sdks/aperture-go/examples/manual/go.mod
  • sdks/aperture-go/examples/manual/go.sum
Files selected for processing (6)
  • playground/Tiltfile (1 hunks)
  • playground/scenarios/postgres-concurrency/load-generator/test.js (1 hunks)
  • playground/tanka/lib/apps/aperture-sdk-example/aperture-sdk-example.libsonnet (3 hunks)
  • sdks/aperture-go/Dockerfile.manual (1 hunks)
  • sdks/aperture-go/examples/manual/main.go (9 hunks)
  • sdks/aperture-go/sdk/flow.go (1 hunks)
Additional comments: 4
playground/scenarios/postgres-concurrency/load-generator/test.js (1)
  • 28-50: Ensure that the endpoint http://localhost:8099/postgres is correct and reachable in the test environment where the load generator will be executed.
playground/tanka/lib/apps/aperture-sdk-example/aperture-sdk-example.libsonnet (1)
  • 41-72: Confirm that the namespace and labels used in the Kubernetes configurations align with the existing naming conventions and policies in the project.
Verification successful

Based on the output from the shell scripts, we can see that the use of namespace: and labels: is widespread throughout the project. The references to namespace and labels in various files suggest that these are common constructs used within the project's Kubernetes configurations and other related files.

The output shows that namespaces and labels are used in a variety of contexts, including Kubernetes manifests, documentation, policy definitions, and SDK examples. This indicates that the project has established patterns for using these Kubernetes concepts.

Given the widespread use of these patterns, it is reasonable to infer that the changes made in the PR to the namespace and labels in the playground/tanka/lib/apps/aperture-sdk-example/aperture-sdk-example.libsonnet file are consistent with the project's conventions. The specific values for namespace and labels would be determined by the context in which they are used, which is defined by the _environment.namespace and _values.labels variables in the Jsonnet file.

Therefore, without any explicit project naming convention or policy provided, we can conclude that the changes align with the existing usage patterns in the project.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the namespace and labels conform to project conventions
grep -R "namespace:" .
grep -R "labels:" .

Length of output: 76736

sdks/aperture-go/sdk/flow.go (1)
  • 313-313: Verify that initializing inflightRequests as an empty slice does not affect any logic that relies on its length, especially since the previous implementation derived the length from f.checkResponse.GetLimiterDecisions().
playground/Tiltfile (1)
  • 1412-1412: The change from wget to curl and the addition of custom headers in the aperture_go_pod_exec_script align with the PR objectives to replace wget with curl and add custom headers for HTTP requests. Ensure that the curl command is compatible with the existing environment and that the headers are correctly formatted and necessary for the request.

sdks/aperture-go/Dockerfile.manual Show resolved Hide resolved
sdks/aperture-go/examples/manual/main.go Outdated Show resolved Hide resolved
@hasit hasit requested a review from a team as a code owner January 5, 2024 02:30
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 55163c6 and 3de6e40.
Files ignored due to filter (19)
  • api/buf.lock
  • blueprints/concurrency-limiting/base/gen/definitions.json
  • blueprints/concurrency-limiting/base/gen/values.yaml
  • blueprints/concurrency-scheduling/base/gen/definitions.json
  • blueprints/concurrency-scheduling/base/gen/values.yaml
  • blueprints/quota-scheduling/base/gen/definitions.json
  • blueprints/quota-scheduling/base/gen/values.yaml
  • blueprints/rate-limiting/base/gen/definitions.json
  • blueprints/rate-limiting/base/gen/values.yaml
  • docs/content/aperture-for-infra/guides/api-quota-management/assets/inter-service-rate-limiting/policy.yaml
  • docs/content/guides/assets/managing-quotas/policy.yaml
  • docs/content/guides/assets/openai/policy.yaml
  • docs/content/reference/aperture-cli/policies/assets/raw_values.yaml
  • playground/scenarios/concurrency-scheduler/policies/concurrency-scheduler-cr.yaml
  • playground/scenarios/postgres-concurrency/policies/concurrency-scheduling-cr.yaml
  • playground/scenarios/postgres-concurrency/policies/concurrency-scheduling.yaml
  • playground/scenarios/quota-scheduler/policies/quota-scheduler-cr.yaml
  • sdks/aperture-go/examples/manual/go.mod
  • sdks/aperture-go/examples/manual/go.sum
Files selected for processing (10)
  • blueprints/concurrency-limiting/base/config.libsonnet (1 hunks)
  • blueprints/concurrency-scheduling/base/config.libsonnet (1 hunks)
  • blueprints/quota-scheduling/base/config.libsonnet (1 hunks)
  • blueprints/rate-limiting/base/config.libsonnet (1 hunks)
  • docs/content/reference/blueprints/concurrency-limiting/base.md (1 hunks)
  • docs/content/reference/blueprints/concurrency-scheduling/base.md (2 hunks)
  • docs/content/reference/blueprints/quota-scheduling/base.md (2 hunks)
  • docs/content/reference/blueprints/rate-limiting/base.md (1 hunks)
  • pkg/scheduler/wfq.go (2 hunks)
  • sdks/aperture-go/examples/manual/main.go (10 hunks)
Files skipped from review due to trivial changes (3)
  • blueprints/concurrency-limiting/base/config.libsonnet
  • blueprints/rate-limiting/base/config.libsonnet
  • docs/content/reference/blueprints/quota-scheduling/base.md
Files skipped from review as they are similar to previous changes (1)
  • sdks/aperture-go/examples/manual/main.go
Additional comments: 5
blueprints/concurrency-scheduling/base/config.libsonnet (1)
  • 18-18: Initializing the scheduler object as an empty object may have implications on the scheduling behavior. Verify that this change is intentional and that all related components are compatible with an empty scheduler configuration.
docs/content/reference/blueprints/concurrency-limiting/base.md (1)
  • 124-124: The documentation has been updated to reflect the new structure of policy.concurrency_limiter.parameters. Ensure that this change is consistent with the actual code changes and that all references to the removed fields are updated throughout the documentation.
docs/content/reference/blueprints/concurrency-scheduling/base.md (2)
  • 110-110: The documentation now shows an updated default value for policy.concurrency_scheduler.concurrency_limiter, removing the limit_by_label_key property. Verify that this documentation change is accurate and reflects the codebase's current state.

  • 138-138: The documentation for policy.concurrency_scheduler.scheduler has been updated to an empty object. This is a significant change that should be double-checked for accuracy and to ensure that it does not conflict with existing configurations or documentation.

pkg/scheduler/wfq.go (1)
  • 528-559: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [531-573]

The logic for updating preemption and delay metrics seems correct, but the repeated initialization of metrics within publishSummary and publishCounter functions is inefficient. It would be better to initialize all required metrics once at the start of onQueueExit and then use them in the respective functions.

pkg/scheduler/wfq.go Show resolved Hide resolved
pkg/scheduler/wfq.go Show resolved Hide resolved
pkg/scheduler/wfq.go 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: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 3de6e40 and e490b49.
Files ignored due to filter (7)
  • playground/scenarios/concurrency-limiter/metadata.json
  • playground/scenarios/concurrency-limiter/policies/concurrency-limiting-cr.yaml
  • playground/scenarios/concurrency-limiter/policies/concurrency-limiting.yaml
  • playground/scenarios/postgres-concurrency/metadata.json
  • playground/scenarios/postgres-concurrency/values.yaml
  • sdks/aperture-go/examples/manual/go.mod
  • sdks/aperture-go/examples/manual/go.sum
Files selected for processing (7)
  • playground/Tiltfile (2 hunks)
  • playground/scenarios/postgres-concurrency/load-generator/test.js (1 hunks)
  • playground/tanka/apps/aperture-go-example/mixins.libsonnet (1 hunks)
  • playground/tanka/lib/apps/aperture-sdk-example/aperture-sdk-example.libsonnet (3 hunks)
  • sdks/aperture-go/Dockerfile.manual (1 hunks)
  • sdks/aperture-go/examples/manual/init.sql (1 hunks)
  • sdks/aperture-go/examples/manual/main.go (8 hunks)
Files skipped from review as they are similar to previous changes (5)
  • playground/Tiltfile
  • playground/scenarios/postgres-concurrency/load-generator/test.js
  • playground/tanka/lib/apps/aperture-sdk-example/aperture-sdk-example.libsonnet
  • sdks/aperture-go/Dockerfile.manual
  • sdks/aperture-go/examples/manual/main.go

@hdkshingala hdkshingala merged commit d17df66 into main Jan 5, 2024
24 of 25 checks passed
@hdkshingala hdkshingala deleted the hasit/pgsql-scenario branch January 5, 2024 07:03
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