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

Query: Switch Multiple Engines #6234

Merged
merged 13 commits into from
Apr 13, 2023

Commits on Apr 13, 2023

  1. Query: Switch engines using engine param

    Thanos query has two engine, prometheus (default) and thanos.
    A single engine runs through thanos query command at a time, and
    have to re run the command to switch between.
    
    This commit adds a functionality to run multiple engines at once
    and switch between them using `engine` query param inq query api.
    
    To avoid duplicate matrics registration, the thanos engine is
    provided with a different registerer having prefix `tpe_` (not
    been finalized yet).
    
    promql-engine command line flag has been removed that specifies
    the query engine to run.
    
    Currently this functionality not implemented on GRPCAPI.
    
    Signed-off-by: Pradyumna Krishna <[email protected]>
    PradyumnaKrishna committed Apr 13, 2023
    Configuration menu
    Copy the full SHA
    b3ef683 View commit details
    Browse the repository at this point in the history
  2. Add multiple engine support to GRPCAPI

    Fix build fail for thanos, adds support for multiple engine in
    GRPCAPI.
    
    Signed-off-by: Pradyumna Krishna <[email protected]>
    PradyumnaKrishna committed Apr 13, 2023
    Configuration menu
    Copy the full SHA
    5f6c2b4 View commit details
    Browse the repository at this point in the history
  3. Create QueryEngineFactory to create engines

    QueryEngineFactory makes a collection for all promql engines used
    by thanos and returns it. Any engine can be created and returned
    using `GetXEngine` method.
    
    It is currently limited to 2 engines prometheus and thanos engines
    that get created on the first call.
    
    Signed-off-by: Pradyumna Krishna <[email protected]>
    PradyumnaKrishna committed Apr 13, 2023
    Configuration menu
    Copy the full SHA
    1f4b054 View commit details
    Browse the repository at this point in the history
  4. Use QueryEngineFactory in query API

    thanos query commands pass `QueryEngineFactory` to query apis
    that will use engine based on query params. It will provide more
    flexibility to create multiple engines in thanos.
    
    Adds `defaultEngine` CLI flag, A default engine to use if not
    specified with query params.
    
    Signed-off-by: Pradyumna Krishna <[email protected]>
    PradyumnaKrishna committed Apr 13, 2023
    Configuration menu
    Copy the full SHA
    5079718 View commit details
    Browse the repository at this point in the history
  5. Update Query API tests

    Fixes breaking tests
    
    Signed-off-by: Pradyumna Krishna <[email protected]>
    PradyumnaKrishna committed Apr 13, 2023
    Configuration menu
    Copy the full SHA
    2706053 View commit details
    Browse the repository at this point in the history
  6. Minor changes and Docs fixes

    * Move defaultEngine argument to reduce diff.
    * Generated Docs.
    
    Signed-off-by: Pradyumna Krishna <[email protected]>
    PradyumnaKrishna committed Apr 13, 2023
    Configuration menu
    Copy the full SHA
    cde7b74 View commit details
    Browse the repository at this point in the history
  7. Add Engine Selector/ Dropdown to Query UI

    Engine Selector is a dropdown that sets an engine to be used to
    run the query. Currently two engines `thanos` and `prometheus`.
    
    This dropdown sends a query param `engine` to query api, which
    runs the api using the engine provided. Provided to run query
    using multiple query engines from Query UI.
    
    Signed-off-by: Pradyumna Krishna <[email protected]>
    PradyumnaKrishna committed Apr 13, 2023
    Configuration menu
    Copy the full SHA
    009ef90 View commit details
    Browse the repository at this point in the history
  8. Move Engine Selector to Panel

    Removes Dropdown component, and renders Engine Selector directly.
    Receives defaultEngine from `flags` API.
    Updates parseOptions to parse engine query param and updates test
    for Panel and utils.
    
    Signed-off-by: Pradyumna Krishna <[email protected]>
    PradyumnaKrishna committed Apr 13, 2023
    Configuration menu
    Copy the full SHA
    868541c View commit details
    Browse the repository at this point in the history
  9. Upgrade promql-engine dependency

    Updates promql-engine that brings functionality to provide
    fallback engine using enigne Opts.
    
    Signed-off-by: Pradyumna Krishna <[email protected]>
    PradyumnaKrishna committed Apr 13, 2023
    Configuration menu
    Copy the full SHA
    19e4bf4 View commit details
    Browse the repository at this point in the history
  10. Add MinT to remote client

    MinT method was missing from Client due to updated promql-engine.
    This commits adds mint to the remote client.
    
    Signed-off-by: Pradyumna Krishna <[email protected]>
    PradyumnaKrishna committed Apr 13, 2023
    Configuration menu
    Copy the full SHA
    340cf7d View commit details
    Browse the repository at this point in the history
  11. Use prometheus fallback engine in thanos engine

    Thanos engine creates a fallback prometheus engine that conflicts
    with another prometheus engine created by thanos, while
    registering metrics. To fix this, provided created thanos engine
    as fallback engine to thanos engine in engine Opts.
    
    Signed-off-by: Pradyumna Krishna <[email protected]>
    PradyumnaKrishna committed Apr 13, 2023
    Configuration menu
    Copy the full SHA
    6b9b1eb View commit details
    Browse the repository at this point in the history
  12. Use enum for EngineType in GRPC

    GRPC is used for communication between thanos components and
    defaultEngine was a string before. Enum makes more sense, and
    hence the request.Enigne type has been changed to
    querypb.EngineType.
    Default case is handled with another default value provided in
    the enum.
    
    Signed-off-by: Pradyumna Krishna <[email protected]>
    PradyumnaKrishna committed Apr 13, 2023
    Configuration menu
    Copy the full SHA
    72c354b View commit details
    Browse the repository at this point in the history
  13. Update query UI bindata.go

    Compile react app using `make assets`.
    
    Signed-off-by: Pradyumna Krishna <[email protected]>
    PradyumnaKrishna committed Apr 13, 2023
    Configuration menu
    Copy the full SHA
    281a07c View commit details
    Browse the repository at this point in the history