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

Merging to release-5.3: [TT-11371] Move leaky-bucket behind the dev build flag (5.3.0) (#6073) #6075

Merged

Conversation

buger
Copy link
Member

@buger buger commented Feb 27, 2024

User description

TT-11371 Move leaky-bucket behind the dev build flag (5.3.0) (#6073)

User description

https://tyktech.atlassian.net/browse/TT-11371


Type

enhancement, configuration changes


Description

  • Moved the Leaky Bucket rate limiter configuration behind a development
    build flag.
  • Removed the Leaky Bucket rate limiter option from the main
    configuration, making it exclusive to development builds.
  • Updated tests and internal logic to reflect the removal of the Leaky
    Bucket rate limiter from the main configuration.
  • Adjusted CLI linter schema to remove references to the now
    development-only Leaky Bucket rate limiter.

Changes walkthrough

Relevant files
Enhancement
development.go
Add Leaky Bucket Rate Limiter to Development Config           

config/development.go

  • Added EnableLeakyBucketRateLimiter configuration option to
    DevelopmentConfig.
  • +9/-0     
    Configuration changes
    rate_limit.go
    Remove Leaky Bucket Rate Limiter from Main Config               

    config/rate_limit.go

  • Removed EnableLeakyBucketRateLimiter from RateLimit struct.
  • Adjusted string representation logic for rate limiters.
  • +0/-13   
    rate_nodev.go
    Adjust Rate Limiter Handling for Release Builds                   

    internal/rate/rate_nodev.go

    • Removed Leaky Bucket rate limiter handling for release builds.
    +0/-3     
    schema.json
    Update CLI Linter Schema                                                                 

    cli/linter/schema.json

    • Removed JSON schema entries related to Leaky Bucket rate limiter.
    +0/-9     
    Tests
    mw_rate_limiting_test.go
    Update Rate Limiting Middleware Tests                                       

    gateway/mw_rate_limiting_test.go

    • Removed test case setup for Leaky Bucket rate limiter.
    +0/-2     

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions


    Co-authored-by: Tit Petric [email protected]


    Type

    enhancement, configuration changes


    Description

    • Moved the Leaky Bucket rate limiter configuration behind a development build flag.
    • Removed the Leaky Bucket rate limiter option from the main configuration.
    • Updated tests and internal logic to reflect the removal of the Leaky Bucket rate limiter from the main configuration.
    • Adjusted CLI linter schema to remove references to the now development-only Leaky Bucket rate limiter.

    Changes walkthrough

    Relevant files
    Enhancement
    development.go
    Add Leaky Bucket Rate Limiter to Development Config           

    config/development.go

  • Added EnableLeakyBucketRateLimiter configuration option to
    DevelopmentConfig.
  • +9/-0     
    rate_nodev.go
    Adjust Rate Limiter Kind Check for Release Builds               

    internal/rate/rate_nodev.go

  • Removed check for Leaky Bucket rate limiter in LimiterKind function.
  • +0/-3     
    Configuration changes
    rate_limit.go
    Remove Leaky Bucket Rate Limiter from Main Config               

    config/rate_limit.go

    • Removed EnableLeakyBucketRateLimiter from RateLimit struct.
    +0/-13   
    schema.json
    Update CLI Linter Schema                                                                 

    cli/linter/schema.json

    • Removed JSON schema entries for Leaky Bucket rate limiter.
    +0/-9     
    Tests
    mw_rate_limiting_test.go
    Update Rate Limiting Middleware Tests                                       

    gateway/mw_rate_limiting_test.go

    • Removed test cases for Leaky Bucket rate limiter.
    +0/-6     

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    ## **User description**
    https://tyktech.atlassian.net/browse/TT-11371
    
    
    ___
    
    ## **Type**
    enhancement, configuration changes
    
    
    ___
    
    ## **Description**
    - Moved the Leaky Bucket rate limiter configuration behind a development
    build flag.
    - Removed the Leaky Bucket rate limiter option from the main
    configuration, making it exclusive to development builds.
    - Updated tests and internal logic to reflect the removal of the Leaky
    Bucket rate limiter from the main configuration.
    - Adjusted CLI linter schema to remove references to the now
    development-only Leaky Bucket rate limiter.
    
    
    ___
    
    
    
    ## **Changes walkthrough**
    <table><thead><tr><th></th><th align="left">Relevant
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>development.go</strong><dd><code>Add Leaky Bucket Rate
    Limiter to Development Config</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; </dd></summary>
    <hr>
    
    config/development.go
    <li>Added <code>EnableLeakyBucketRateLimiter</code> configuration option
    to <br><code>DevelopmentConfig</code>.<br>
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://pull/6073/files#diff-d2253d9377e5163d9de068a2df71738383fb97e0b07b64482404a83610cd53b8">+9/-0</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    </table></td></tr><tr><td><strong>Configuration
    changes</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>rate_limit.go</strong><dd><code>Remove Leaky Bucket
    Rate Limiter from Main Config</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    config/rate_limit.go
    <li>Removed <code>EnableLeakyBucketRateLimiter</code> from
    <code>RateLimit</code> struct.<br> <li> Adjusted string representation
    logic for rate limiters.<br>
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://pull/6073/files#diff-375bf116f8d6527c50d7591d7cb01e8f821b22df4a4ca18b4da4c6f0d526f18e">+0/-13</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>rate_nodev.go</strong><dd><code>Adjust Rate Limiter
    Handling for Release Builds</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    internal/rate/rate_nodev.go
    - Removed Leaky Bucket rate limiter handling for release builds.
    
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://pull/6073/files#diff-5c08f4f86a19b6cc3d2ee94a0253749acc927b606b1c56d6b73aee46547cf4f7">+0/-3</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>schema.json</strong><dd><code>Update CLI Linter
    Schema</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    cli/linter/schema.json
    - Removed JSON schema entries related to Leaky Bucket rate limiter.
    
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://pull/6073/files#diff-103cec746d3e61d391c5a67c171963f66fea65d651d704d5540e60aa5d574f46">+0/-9</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    </table></td></tr><tr><td><strong>Tests</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>mw_rate_limiting_test.go</strong><dd><code>Update Rate
    Limiting Middleware Tests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/mw_rate_limiting_test.go
    - Removed test case setup for Leaky Bucket rate limiter.
    
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://pull/6073/files#diff-7cf2199231924147d538ba7ad576a48a3c0e691852077e147c9b2d86ba9b7c4d">+0/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    </table></td></tr></tr></tbody></table>
    
    ___
    
    > ✨ **PR-Agent usage**:
    >Comment `/help` on the PR to get a list of all available PR-Agent tools
    and their descriptions
    
    ---------
    
    Co-authored-by: Tit Petric <[email protected]>
    
    (cherry picked from commit 485ebf8)
    @buger buger merged commit ebcac71 into release-5.3 Feb 27, 2024
    @buger buger deleted the merge/release-5.3/485ebf879abe082eb448e1d58e1d42bce19e1162 branch February 27, 2024 04:05
    Copy link
    Contributor

    💥 CI tests failed 🙈

    git-state

    all ok

    Please look at the run or in the Checks tab.

    Copy link
    Contributor

    PR Description updated to latest commit (877c2d4)

    Copy link
    Contributor

    PR Review

    ⏱️ Estimated effort to review [1-5]

    2, because the changes are straightforward and mostly involve moving configuration options and updating related logic. The main effort will be in understanding the context and ensuring that the removal and addition of configuration options do not introduce any unintended side effects.

    🧪 Relevant tests

    No

    🔍 Possible issues

    The removal of EnableLeakyBucketRateLimiter from the main configuration and its addition to the development configuration might lead to confusion or issues for users who are unaware of this change.

    There is a potential risk that existing configurations relying on the Leaky Bucket rate limiter might fail to work as expected after this update, especially if the transition to the development flag is not properly communicated.

    🔒 Security concerns

    No

    Code feedback:
    relevant fileconfig/development.go
    suggestion      

    Consider adding a fallback or warning mechanism for production builds that attempt to use the EnableLeakyBucketRateLimiter setting. This could help in situations where configurations are not updated in line with the new changes, preventing silent failures. [important]

    relevant lineEnableLeakyBucketRateLimiter bool `json:"enable_leaky_bucket_rate_limiter"`

    relevant filegateway/mw_rate_limiting_test.go
    suggestion      

    Given the removal of the Leaky Bucket rate limiter from the main configuration, ensure that there are adequate tests for its functionality within the development configuration context. This might involve creating new test cases or modifying existing ones to reflect the change. [important]

    relevant line-func TestMwRateLimiting_CustomRatelimitKeyEnableLeakyBucketRateLimiter(t *testing.T) {

    relevant fileinternal/rate/rate_nodev.go
    suggestion      

    Update the documentation or add comments to clarify how the rate limiting configuration is expected to behave in non-development builds, especially in light of the removal of the Leaky Bucket rate limiter from the main configuration. This will help maintain clarity for future maintenance. [medium]

    relevant line- if c.EnableLeakyBucketRateLimiter {

    relevant filecli/linter/schema.json
    suggestion      

    Ensure that the CLI linter's schema is updated to reflect the removal of the enable_leaky_bucket_rate_limiter and related configurations. This should prevent any issues with schema validation for users updating their configurations. [important]

    relevant line- "enable_leaky_bucket_rate_limiter": {


    ✨ Review tool usage guide:

    Overview:
    The review tool scans the PR code changes, and generates a PR review. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
    When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:

    /review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...
    

    With a configuration file, use the following template:

    [pr_reviewer]
    some_config1=...
    some_config2=...
    
    Utilizing extra instructions

    The review tool can be configured with extra instructions, which can be used to guide the model to a feedback tailored to the needs of your project.

    Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify the relevant sub-tool, and the relevant aspects of the PR that you want to emphasize.

    Examples for extra instructions:

    [pr_reviewer] # /review #
    extra_instructions="""
    In the 'possible issues' section, emphasize the following:
    - Does the code logic cover relevant edge cases?
    - Is the code logic clear and easy to understand?
    - Is the code logic efficient?
    ...
    """
    

    Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

    How to enable\disable automation
    • When you first install PR-Agent app, the default mode for the review tool is:
    pr_commands = ["/review", ...]
    

    meaning the review tool will run automatically on every PR, with the default configuration.
    Edit this field to enable/disable the tool, or to change the used configurations

    Auto-labels

    The review tool can auto-generate two specific types of labels for a PR:

    • a possible security issue label, that detects possible security issues (enable_review_labels_security flag)
    • a Review effort [1-5]: x label, where x is the estimated effort to review the PR (enable_review_labels_effort flag)
    Extra sub-tools

    The review tool provides a collection of possible feedbacks about a PR.
    It is recommended to review the possible options, and choose the ones relevant for your use case.
    Some of the feature that are disabled by default are quite useful, and should be considered for enabling. For example:
    require_score_review, require_soc2_ticket, and more.

    Auto-approve PRs

    By invoking:

    /review auto_approve
    

    The tool will automatically approve the PR, and add a comment with the approval.

    To ensure safety, the auto-approval feature is disabled by default. To enable auto-approval, you need to actively set in a pre-defined configuration file the following:

    [pr_reviewer]
    enable_auto_approval = true
    

    (this specific flag cannot be set with a command line argument, only in the configuration file, committed to the repository)

    You can also enable auto-approval only if the PR meets certain requirements, such as that the estimated_review_effort is equal or below a certain threshold, by adjusting the flag:

    [pr_reviewer]
    maximal_review_effort = 5
    
    More PR-Agent commands

    To invoke the PR-Agent, add a comment using one of the following commands:

    • /review: Request a review of your Pull Request.
    • /describe: Update the PR title and description based on the contents of the PR.
    • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
    • /ask <QUESTION>: Ask a question about the PR.
    • /update_changelog: Update the changelog based on the PR's contents.
    • /add_docs 💎: Generate docstring for new components introduced in the PR.
    • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
    • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

    See the tools guide for more details.
    To list the possible configuration parameters, add a /config comment.

    See the review usage page for a comprehensive guide on using this tool.

    Copy link
    Contributor

    github-actions bot commented Feb 27, 2024

    PR Code Suggestions

    Suggestions                                                                                                                                                     
    enhancement
    Add a default value for the EnableLeakyBucketRateLimiter field. 

    Consider adding a default value for EnableLeakyBucketRateLimiter in the DevelopmentConfig
    struct to ensure that the behavior is explicit and predictable. This can help avoid
    unintended behavior in development environments where the default value might not be
    clear.

    config/development.go [15]

    -EnableLeakyBucketRateLimiter bool `json:"enable_leaky_bucket_rate_limiter"`
    +EnableLeakyBucketRateLimiter bool `json:"enable_leaky_bucket_rate_limiter" default:"false"`
     
    Update dependent components to reflect schema changes.                       

    After removing the LeakyBucket related fields from the schema, validate that any
    documentation, UI, or API that relies on this schema is updated to reflect the removal of
    these fields. This ensures consistency across the application and avoids confusion for
    users or developers.

    cli/linter/schema.json [409-410]

    -"enable_non_transactional_rate_limiter": {
    -  "type": "boolean"
    -},
    +// Ensure documentation, UI, or API is updated to reflect schema changes
     
    maintainability
    Clean up any LeakyBucket specific test setup or teardown.       

    Since the LeakyBucket rate limiter test case has been removed, ensure that any related
    test setup or teardown that specifically pertains to the LeakyBucket functionality is also
    cleaned up to prevent dead code or misleading test configurations.

    gateway/mw_rate_limiting_test.go [244-245]

    -default:
    -  t.Fatal("There is no such a rate limiter:", limiter)
    +// Ensure no setup or teardown for LeakyBucket remains
     
    Adjust or remove LeakyBucket references in non-dev specific code.

    Given that the LeakyBucket rate limiter configuration has been moved, ensure that any
    logic or references to it in non-development-specific code (like rate_nodev.go) are
    appropriately adjusted or removed to reflect this change.

    internal/rate/rate_nodev.go [13-14]

    -return "", false
    +// Adjust or remove references to LeakyBucket as needed
     
    Update application logic to reference the new location of EnableLeakyBucketRateLimiter.

    After moving the EnableLeakyBucketRateLimiter configuration, ensure that any logic in the
    application that previously depended on this setting being part of the RateLimit struct is
    updated to now reference its new location within the DevelopmentConfig struct. This may
    involve updating conditionals, configuration loading, or documentation.

    config/rate_limit.go [11]

    -EnableRedisRollingLimiter bool `json:"enable_redis_rolling_limiter"`
    +// Update references to EnableLeakyBucketRateLimiter to its new location
     

    ✨ Improve tool usage guide:

    Overview:
    The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.
    When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:

    /improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...
    

    With a configuration file, use the following template:

    [pr_code_suggestions]
    some_config1=...
    some_config2=...
    
    Enabling\disabling automation

    When you first install the app, the default mode for the improve tool is:

    pr_commands = ["/improve --pr_code_suggestions.summarize=true", ...]
    

    meaning the improve tool will run automatically on every PR, with summarization enabled. Delete this line to disable the tool from running automatically.

    Utilizing extra instructions

    Extra instructions are very important for the improve tool, since they enable to guide the model to suggestions that are more relevant to the specific needs of the project.

    Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify relevant aspects that you want the model to focus on.

    Examples for extra instructions:

    [pr_code_suggestions] # /improve #
    extra_instructions="""
    Emphasize the following aspects:
    - Does the code logic cover relevant edge cases?
    - Is the code logic clear and easy to understand?
    - Is the code logic efficient?
    ...
    """
    

    Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

    A note on code suggestions quality
    • While the current AI for code is getting better and better (GPT-4), it's not flawless. Not all the suggestions will be perfect, and a user should not accept all of them automatically.
    • Suggestions are not meant to be simplistic. Instead, they aim to give deep feedback and raise questions, ideas and thoughts to the user, who can then use his judgment, experience, and understanding of the code base.
    • Recommended to use the 'extra_instructions' field to guide the model to suggestions that are more relevant to the specific needs of the project, or use the custom suggestions 💎 tool
    • With large PRs, best quality will be obtained by using 'improve --extended' mode.
    More PR-Agent commands

    To invoke the PR-Agent, add a comment using one of the following commands:

    • /review: Request a review of your Pull Request.
    • /describe: Update the PR title and description based on the contents of the PR.
    • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
    • /ask <QUESTION>: Ask a question about the PR.
    • /update_changelog: Update the changelog based on the PR's contents.
    • /add_docs 💎: Generate docstring for new components introduced in the PR.
    • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
    • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

    See the tools guide for more details.
    To list the possible configuration parameters, add a /config comment.

    See the improve usage page for a more comprehensive guide on using this tool.

    @buger
    Copy link
    Member Author

    buger commented Feb 27, 2024

    API tests result - postgres15-sha256 env: success
    Branch used: refs/heads/release-5.3
    Commit: ebcac71 Merging to release-5.3: TT-11371 Move leaky-bucket behind the dev build flag (5.3.0) (#6073)

    TT-11371 Move leaky-bucket behind the dev build flag (5.3.0) (#6073)

    User description

    https://tyktech.atlassian.net/browse/TT-11371


    Type

    enhancement, configuration changes


    Description

    • Moved the Leaky Bucket rate limiter configuration behind a development
      build flag.
    • Removed the Leaky Bucket rate limiter option from the main
      configuration, making it exclusive to development builds.
    • Updated tests and internal logic to reflect the removal of the Leaky
      Bucket rate limiter from the main configuration.
    • Adjusted CLI linter schema to remove references to the now
      development-only Leaky Bucket rate limiter.

    Changes walkthrough

    Relevant files
    Enhancement
    development.go
    Add Leaky Bucket Rate Limiter to Development Config           

    config/development.go

  • Added EnableLeakyBucketRateLimiter configuration option to
    DevelopmentConfig.
  • +9/-0     
    Configuration changes
    rate_limit.go
    Remove Leaky Bucket Rate Limiter from Main Config               

    config/rate_limit.go

  • Removed EnableLeakyBucketRateLimiter from RateLimit struct.
  • Adjusted string representation logic for rate limiters.
  • +0/-13   
    rate_nodev.go
    Adjust Rate Limiter Handling for Release Builds                   

    internal/rate/rate_nodev.go

    • Removed Leaky Bucket rate limiter handling for release builds.
    +0/-3     
    schema.json
    Update CLI Linter Schema                                                                 

    cli/linter/schema.json

    • Removed JSON schema entries related to Leaky Bucket rate limiter.
    +0/-9     
    Tests
    mw_rate_limiting_test.go
    Update Rate Limiting Middleware Tests                                       

    gateway/mw_rate_limiting_test.go

    • Removed test case setup for Leaky Bucket rate limiter.
    +0/-2     

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions


    Co-authored-by: Tit Petric [email protected]
    Triggered by: push (@buger)
    Execution page

    @buger
    Copy link
    Member Author

    buger commented Feb 27, 2024

    API tests result - mongo44-sha256 env: success
    Branch used: refs/heads/release-5.3
    Commit: ebcac71 Merging to release-5.3: TT-11371 Move leaky-bucket behind the dev build flag (5.3.0) (#6073)

    TT-11371 Move leaky-bucket behind the dev build flag (5.3.0) (#6073)

    User description

    https://tyktech.atlassian.net/browse/TT-11371


    Type

    enhancement, configuration changes


    Description

    • Moved the Leaky Bucket rate limiter configuration behind a development
      build flag.
    • Removed the Leaky Bucket rate limiter option from the main
      configuration, making it exclusive to development builds.
    • Updated tests and internal logic to reflect the removal of the Leaky
      Bucket rate limiter from the main configuration.
    • Adjusted CLI linter schema to remove references to the now
      development-only Leaky Bucket rate limiter.

    Changes walkthrough

    Relevant files
    Enhancement
    development.go
    Add Leaky Bucket Rate Limiter to Development Config           

    config/development.go

  • Added EnableLeakyBucketRateLimiter configuration option to
    DevelopmentConfig.
  • +9/-0     
    Configuration changes
    rate_limit.go
    Remove Leaky Bucket Rate Limiter from Main Config               

    config/rate_limit.go

  • Removed EnableLeakyBucketRateLimiter from RateLimit struct.
  • Adjusted string representation logic for rate limiters.
  • +0/-13   
    rate_nodev.go
    Adjust Rate Limiter Handling for Release Builds                   

    internal/rate/rate_nodev.go

    • Removed Leaky Bucket rate limiter handling for release builds.
    +0/-3     
    schema.json
    Update CLI Linter Schema                                                                 

    cli/linter/schema.json

    • Removed JSON schema entries related to Leaky Bucket rate limiter.
    +0/-9     
    Tests
    mw_rate_limiting_test.go
    Update Rate Limiting Middleware Tests                                       

    gateway/mw_rate_limiting_test.go

    • Removed test case setup for Leaky Bucket rate limiter.
    +0/-2     

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions


    Co-authored-by: Tit Petric [email protected]
    Triggered by: push (@buger)
    Execution page

    @buger
    Copy link
    Member Author

    buger commented Feb 27, 2024

    API tests result - postgres15-murmur64 env: success
    Branch used: refs/heads/release-5.3
    Commit: ebcac71 Merging to release-5.3: TT-11371 Move leaky-bucket behind the dev build flag (5.3.0) (#6073)

    TT-11371 Move leaky-bucket behind the dev build flag (5.3.0) (#6073)

    User description

    https://tyktech.atlassian.net/browse/TT-11371


    Type

    enhancement, configuration changes


    Description

    • Moved the Leaky Bucket rate limiter configuration behind a development
      build flag.
    • Removed the Leaky Bucket rate limiter option from the main
      configuration, making it exclusive to development builds.
    • Updated tests and internal logic to reflect the removal of the Leaky
      Bucket rate limiter from the main configuration.
    • Adjusted CLI linter schema to remove references to the now
      development-only Leaky Bucket rate limiter.

    Changes walkthrough

    Relevant files
    Enhancement
    development.go
    Add Leaky Bucket Rate Limiter to Development Config           

    config/development.go

  • Added EnableLeakyBucketRateLimiter configuration option to
    DevelopmentConfig.
  • +9/-0     
    Configuration changes
    rate_limit.go
    Remove Leaky Bucket Rate Limiter from Main Config               

    config/rate_limit.go

  • Removed EnableLeakyBucketRateLimiter from RateLimit struct.
  • Adjusted string representation logic for rate limiters.
  • +0/-13   
    rate_nodev.go
    Adjust Rate Limiter Handling for Release Builds                   

    internal/rate/rate_nodev.go

    • Removed Leaky Bucket rate limiter handling for release builds.
    +0/-3     
    schema.json
    Update CLI Linter Schema                                                                 

    cli/linter/schema.json

    • Removed JSON schema entries related to Leaky Bucket rate limiter.
    +0/-9     
    Tests
    mw_rate_limiting_test.go
    Update Rate Limiting Middleware Tests                                       

    gateway/mw_rate_limiting_test.go

    • Removed test case setup for Leaky Bucket rate limiter.
    +0/-2     

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions


    Co-authored-by: Tit Petric [email protected]
    Triggered by: push (@buger)
    Execution page

    @buger
    Copy link
    Member Author

    buger commented Feb 27, 2024

    API tests result - mongo44-murmur64 env: success
    Branch used: refs/heads/release-5.3
    Commit: ebcac71 Merging to release-5.3: TT-11371 Move leaky-bucket behind the dev build flag (5.3.0) (#6073)

    TT-11371 Move leaky-bucket behind the dev build flag (5.3.0) (#6073)

    User description

    https://tyktech.atlassian.net/browse/TT-11371


    Type

    enhancement, configuration changes


    Description

    • Moved the Leaky Bucket rate limiter configuration behind a development
      build flag.
    • Removed the Leaky Bucket rate limiter option from the main
      configuration, making it exclusive to development builds.
    • Updated tests and internal logic to reflect the removal of the Leaky
      Bucket rate limiter from the main configuration.
    • Adjusted CLI linter schema to remove references to the now
      development-only Leaky Bucket rate limiter.

    Changes walkthrough

    Relevant files
    Enhancement
    development.go
    Add Leaky Bucket Rate Limiter to Development Config           

    config/development.go

  • Added EnableLeakyBucketRateLimiter configuration option to
    DevelopmentConfig.
  • +9/-0     
    Configuration changes
    rate_limit.go
    Remove Leaky Bucket Rate Limiter from Main Config               

    config/rate_limit.go

  • Removed EnableLeakyBucketRateLimiter from RateLimit struct.
  • Adjusted string representation logic for rate limiters.
  • +0/-13   
    rate_nodev.go
    Adjust Rate Limiter Handling for Release Builds                   

    internal/rate/rate_nodev.go

    • Removed Leaky Bucket rate limiter handling for release builds.
    +0/-3     
    schema.json
    Update CLI Linter Schema                                                                 

    cli/linter/schema.json

    • Removed JSON schema entries related to Leaky Bucket rate limiter.
    +0/-9     
    Tests
    mw_rate_limiting_test.go
    Update Rate Limiting Middleware Tests                                       

    gateway/mw_rate_limiting_test.go

    • Removed test case setup for Leaky Bucket rate limiter.
    +0/-2     

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions


    Co-authored-by: Tit Petric [email protected]
    Triggered by: push (@buger)
    Execution page

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

    Successfully merging this pull request may close these issues.

    2 participants