From 39729ef3efc78a95c3e22bebe677efa212324dbd Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Wed, 24 Jan 2024 13:10:40 +0100 Subject: [PATCH 1/2] proposal for supporting aggregation functions for analysis values Signed-off-by: Florian Bacher --- ...on-functions-in-analysis-value-template.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 text/0097-support-aggregation-functions-in-analysis-value-template.md diff --git a/text/0097-support-aggregation-functions-in-analysis-value-template.md b/text/0097-support-aggregation-functions-in-analysis-value-template.md new file mode 100644 index 0000000..a3c5d47 --- /dev/null +++ b/text/0097-support-aggregation-functions-in-analysis-value-template.md @@ -0,0 +1,34 @@ +# KEP 97 Support Aggregation functions in AnalysisValueTemplate + +## Motivation + +Currently, only the `KeptnMetrics` CRD supports the use of aggregation functions +(see [here](https://github.com/keptn/lifecycle-toolkit/blob/5fac158a7ffed67f7502fe03683138d717ea1acd/metrics-operator/api/v1beta1/keptnmetric_types.go#L76)). +Supporting the same aggregation functions might also be useful for `AnalysisValueTemplates` as well, +to better support queries that return multiple data points of a time series. +This way, the provider returning the results for the AnalysisValueTemplate can check whether +there are multiple data points in the result for the query and apply the aggregation function in that case. + +## Proposed Design + +The proposal is to extend the specification of the `AnalysisValueTemplates` with an `spec.aggregation` field, +similar to what is available in the `KeptnMetric` (see [specification](https://keptn.sh/latest/docs/reference/api-reference/metrics/v1beta1/#rangespec)). +Using this field, the metrics operator can inspect the result for an analysis value returned by a metrics provider., +and, if the aggregation function has been defined, use this function to aggregate the returned result if this is +an array of multiple values, as opposed to a single value. + +## Benefits + +- Unified way of defining aggregation functions for query results containing multiple time series data points +- More flexibility in terms of which queries can be used for each provider + +## Open Questions + +One argument that might speak against this feature is that usually monitoring provider +APIs support aggregation functions on their end already, +such as e.g. [DQL](https://docs.dynatrace.com/docs/platform/grail/dynatrace-query-language/functions#aggregation-functions), +so it might be sufficient to adapt queries for AnalysisValueTemplates to make use of the monitoring provider's aggregation capabilities. + +## References + +See the following Github discussion for more context: https://github.com/keptn/lifecycle-toolkit/issues/2650#issuecomment-1906038916 \ No newline at end of file From 34c7f90abd295e3c6f9ce23b8131a560b9437979 Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Thu, 1 Feb 2024 10:48:18 +0100 Subject: [PATCH 2/2] Update text/0097-support-aggregation-functions-in-analysis-value-template.md Co-authored-by: Giovanni Liva Signed-off-by: Florian Bacher --- ...-support-aggregation-functions-in-analysis-value-template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/0097-support-aggregation-functions-in-analysis-value-template.md b/text/0097-support-aggregation-functions-in-analysis-value-template.md index a3c5d47..f2f746b 100644 --- a/text/0097-support-aggregation-functions-in-analysis-value-template.md +++ b/text/0097-support-aggregation-functions-in-analysis-value-template.md @@ -13,7 +13,7 @@ there are multiple data points in the result for the query and apply the aggrega The proposal is to extend the specification of the `AnalysisValueTemplates` with an `spec.aggregation` field, similar to what is available in the `KeptnMetric` (see [specification](https://keptn.sh/latest/docs/reference/api-reference/metrics/v1beta1/#rangespec)). -Using this field, the metrics operator can inspect the result for an analysis value returned by a metrics provider., +Using this field, the metrics operator can inspect the result for an analysis value returned by a metrics provider, and, if the aggregation function has been defined, use this function to aggregate the returned result if this is an array of multiple values, as opposed to a single value.