Skip to content

Add queryParameters in prometheus-scalerΒ #4962

@HenriquePiccolo

Description

@HenriquePiccolo

Proposal

I have a Thanos multi-tenancy cluster with soft-tenancy and hard-tenancy, it's separate using header "thanos-tenant" and queryParameter "tenant".

My proposal is to include a parameter in prometheus-scaler, where it's possible passa query parameters using coma to separate.

Use-Case

Expect Behavior

Using the below manifests, Keda should be able to pass query parameters in prometheus scaler

triggers:
- type: prometheus
  metadata:
    # Required fields:
    serverAddress: http://<prometheus-host>:9090
    metricName: http_requests_total # DEPRECATED: This parameter is deprecated as of KEDA v2.10 and will be removed in version 2.12. Note: name to identify the metric, generated value would be `prometheus-http_requests_total`
    query: sum(rate(http_requests_total{deployment="my-deployment"}[2m])) # Note: query must return a vector/scalar single element response
    queryParameters: tenant=123456,key-1=value-1
    threshold: '100.50'
    activationThreshold: '5.5'
    # Optional fields:
    namespace: example-namespace  # for namespaced queries, eg. Thanos
    cortexOrgID: my-org # DEPRECATED: This parameter is deprecated as of KEDA v2.10 in favor of customHeaders and will be removed in version 2.12. Use custom headers instead to set X-Scope-OrgID header for Cortex. (see below)
    customHeaders: X-Client-Id=cid,X-Tenant-Id=tid,X-Organization-Id=oid # Optional. Custom headers to include in query. In case of auth header, use the custom authentication or relevant authModes.
    ignoreNullValues: false # Default is `true`, which means ignoring the empty value list from Prometheus. Set to `false` the scaler will return error when Prometheus target is lost
    unsafeSsl: "false" #  Default is `false`, Used for skipping certificate check when having self-signed certs for Prometheus endpoint  

Is this a feature you are interested in implementing yourself?

Yes

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestAll issues for new features that have not been committed tohelp wantedLooking for support from communityneeds-discussion

    Type

    No type

    Projects

    Status

    Ready To Ship

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions