Skip to content

Raw metrics stream #7094

@jkremser

Description

@jkremser

Proposal

Currently, KEDA exposes the metrics from its scalers for metrics adapter (aka keda-operator-metrics-apiserver) using blocking gRPC call:

 rpc GetMetrics (ScaledObjectRef) returns (k8s.io.metrics.pkg.apis.external_metrics.v1beta1.ExternalMetricValueList) {};

This doesn't report the raw metric value in a sense that if there are any scaling modifiers defined on the ScaledObject, these will be applied, also if the fallback is defined, it also get applied before sending to client.

This issue proposes a new gRPC methods that will allow another clients to hook into KEDA scalers ecosystem.

proposed api:

service RawMetricsService {
    rpc GetRawMetricsStream (RawMetricsRequest) returns (stream RawMetricsResponse) {};
    rpc SubscribeMetric (SubscriptionRequest) returns (SubscriptionAck) {};
    rpc UnsubscribeMetric (SubscriptionRequest) returns (SubscriptionAck) {};
}

So it defines a stateful protocol, when client needs to first Subscribe to a certain metric. Where metric is defined by ScaledObject name, namespace and triggerName. Then if such client opens the stream (gRPC server streaming), it will be receiving the metric values of subscribed metric in a best-effort manner.

In order to be able to talk to KEDA's gRPC api, one has to either reuse the cert that was created for keda-operator-metrics-apiserver or use the CA cert that's being used by KEDA operator
and sign a new cert with this (recommended).

Use-Case

motivation behind this:

  • input data for low-lvl integrations like some alerting mechanism
  • anything that can make use of the data coming from KEDA's scalers

Is this a feature you are interested in implementing yourself?

Yes

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Ready To Ship

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions