From 49d9ea68c7d787f1bd9c729c12915372746f3e87 Mon Sep 17 00:00:00 2001 From: Friedrich Albert Kyuri Date: Fri, 1 Mar 2024 13:40:49 +0100 Subject: [PATCH 1/3] feat: add documentation for metric-scaler-format Signed-off-by: Friedrich Albert Kyuri --- content/docs/2.14/scalers/metrics-api.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/content/docs/2.14/scalers/metrics-api.md b/content/docs/2.14/scalers/metrics-api.md index 0eee27816..afe43ee32 100644 --- a/content/docs/2.14/scalers/metrics-api.md +++ b/content/docs/2.14/scalers/metrics-api.md @@ -19,6 +19,7 @@ triggers: - type: metrics-api metadata: targetValue: "8.8" + format: "json" activationTargetValue: "3.8" url: "http://api:3232/api/v1/stats" valueLocation: "components.worker.tasks" @@ -27,7 +28,10 @@ triggers: **Parameter list:** - `url` - Full URL of the API operation to call to get the metric value (eg. `http://app:1317/api/v1/stats`). -- `valueLocation` - [GJSON path notation](https://github.com/tidwall/gjson#path-syntax) to refer to the field in the payload containing the metric value. +- `format` - One of the following formats: `json`, `xml`, `yaml`, `prometheus`. (Default: `json`, Optional) +- `valueLocation` - The location of the metric value in the response payload. The value is format specific. + * `json` - [GJSON path notation](https://github.com/tidwall/gjson#path-syntax) to refer to the field in the payload containing the metric value. + * `yaml`, `xml`, `prometheus` - We use internal implementation that retrieves a value using a dot-separated path: [#2633](https://github.com/kedacore/keda/issues/2633). - `targetValue` - Target value to scale on. When the metric provided by the API is equal or higher to this value, KEDA will start scaling out. When the metric is 0 or less, KEDA will scale down to 0. (This value can be a float) - `activationTargetValue` - Target value for activating the scaler. Learn more about activation [here](./../concepts/scaling-deployments.md#activating-and-scaling-thresholds).(Default: `0`, Optional, This value can be a float) - `unsafeSsl` - Skip certificate validation when connecting over HTTPS. (Values: `true`, `false`, Default: `false`, Optional) From 823da03c03a8519834ae09530d36c1f18c194f97 Mon Sep 17 00:00:00 2001 From: Murr Kyuri <39532283+Friedrich42@users.noreply.github.com> Date: Mon, 25 Mar 2024 10:26:03 +0100 Subject: [PATCH 2/3] Update content/docs/2.14/scalers/metrics-api.md Co-authored-by: Jan Wozniak Signed-off-by: Murr Kyuri <39532283+Friedrich42@users.noreply.github.com> --- content/docs/2.14/scalers/metrics-api.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/docs/2.14/scalers/metrics-api.md b/content/docs/2.14/scalers/metrics-api.md index afe43ee32..0e470a83a 100644 --- a/content/docs/2.14/scalers/metrics-api.md +++ b/content/docs/2.14/scalers/metrics-api.md @@ -31,7 +31,8 @@ triggers: - `format` - One of the following formats: `json`, `xml`, `yaml`, `prometheus`. (Default: `json`, Optional) - `valueLocation` - The location of the metric value in the response payload. The value is format specific. * `json` - [GJSON path notation](https://github.com/tidwall/gjson#path-syntax) to refer to the field in the payload containing the metric value. - * `yaml`, `xml`, `prometheus` - We use internal implementation that retrieves a value using a dot-separated path: [#2633](https://github.com/kedacore/keda/issues/2633). + * `yaml`, `xml`, `prometheus` - implemented as dot-separated path algorithm for value parsing. + * ... examples - `targetValue` - Target value to scale on. When the metric provided by the API is equal or higher to this value, KEDA will start scaling out. When the metric is 0 or less, KEDA will scale down to 0. (This value can be a float) - `activationTargetValue` - Target value for activating the scaler. Learn more about activation [here](./../concepts/scaling-deployments.md#activating-and-scaling-thresholds).(Default: `0`, Optional, This value can be a float) - `unsafeSsl` - Skip certificate validation when connecting over HTTPS. (Values: `true`, `false`, Default: `false`, Optional) From 1c9d3b7d3a35f02f745859edfa63c620d3caf2ab Mon Sep 17 00:00:00 2001 From: Friedrich Albert Kyuri Date: Mon, 25 Mar 2024 10:31:48 +0100 Subject: [PATCH 3/3] add examples Signed-off-by: Friedrich Albert Kyuri --- content/docs/2.14/scalers/metrics-api.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/content/docs/2.14/scalers/metrics-api.md b/content/docs/2.14/scalers/metrics-api.md index 0e470a83a..52c36f1a7 100644 --- a/content/docs/2.14/scalers/metrics-api.md +++ b/content/docs/2.14/scalers/metrics-api.md @@ -32,7 +32,10 @@ triggers: - `valueLocation` - The location of the metric value in the response payload. The value is format specific. * `json` - [GJSON path notation](https://github.com/tidwall/gjson#path-syntax) to refer to the field in the payload containing the metric value. * `yaml`, `xml`, `prometheus` - implemented as dot-separated path algorithm for value parsing. - * ... examples + * `{foo: {bar: 42}}` - `foo.bar` will return 42 + * `{foo: [{bar: 42}]}` - `foo.0.bar` will return 42 + * same syntax is used for `yaml`, `xml` and `prometheus` formats. + - `targetValue` - Target value to scale on. When the metric provided by the API is equal or higher to this value, KEDA will start scaling out. When the metric is 0 or less, KEDA will scale down to 0. (This value can be a float) - `activationTargetValue` - Target value for activating the scaler. Learn more about activation [here](./../concepts/scaling-deployments.md#activating-and-scaling-thresholds).(Default: `0`, Optional, This value can be a float) - `unsafeSsl` - Skip certificate validation when connecting over HTTPS. (Values: `true`, `false`, Default: `false`, Optional)