@@ -668,3 +668,65 @@ Reference the template in the canary analysis:
668
668
max : 1000
669
669
interval : 1m
670
670
` ` `
671
+
672
+ ## Keptn
673
+
674
+ You can create custom metric checks using the Keptn provider.
675
+ This Provider allows to verify either the value of a single [KeptnMetric](https://keptn.sh/stable/docs/reference/crd-reference/metric/),
676
+ representing the value of a single metric,
677
+ or of a [Keptn Analysis](https://keptn.sh/stable/docs/reference/crd-reference/analysis/),
678
+ which provides a flexible grading logic for analysing and prioritising a number of different
679
+ metric values coming from different data sources.
680
+
681
+ This provider requires [Keptn](https://keptn.sh/stable/docs/installation/) to be installed in the cluster.
682
+
683
+ Example for a Keptn metric template:
684
+
685
+ ` ` ` yaml
686
+ apiVersion : flagger.app/v1beta1
687
+ kind : MetricTemplate
688
+ metadata :
689
+ name : response-time
690
+ namespace : istio-system
691
+ spec :
692
+ provider :
693
+ type : keptn
694
+ query : keptnmetric/my-namespace/response-time/2m/reporter=destination
695
+ ` ` `
696
+
697
+ This will reference the ` KeptnMetric` with the name `response-time` in
698
+ the namespace `my-namespace`, which could look like the following :
699
+
700
+ ` ` ` yaml
701
+ apiVersion: metrics.keptn.sh/v1beta1
702
+ kind: KeptnMetric
703
+ metadata:
704
+ name: response-time
705
+ namespace: my-namespace
706
+ spec:
707
+ fetchIntervalSeconds: 10
708
+ provider:
709
+ name: my-prometheus-keptn-provider
710
+ query: histogram_quantile(0.8, sum by(le) (rate(http_server_request_latency_seconds_bucket{status_code='200',
711
+ job='simple-go-backend'}[5m[])))
712
+ ` ` `
713
+
714
+ The `query` contains the following components, which are divided by `/` characters :
715
+
716
+ ` ` `
717
+ <type>/<namespace>/<resource-name>/<timeframe>/<arguments>
718
+ ` ` `
719
+
720
+ * **type (required)**: Must be either `keptnmetric` or `analysis`.
721
+ * **namespace (required)**: The namespace of the referenced `KeptnMetric`/`AnalysisDefinition`.
722
+ * **resource-name (required):** The name of the referenced `KeptnMetric`/`AnalysisDefinition`.
723
+ * **timeframe (optional)**: The timeframe used for the Analysis.
724
+ This will usually be set to the same value as the analysis interval of a `Canary`.
725
+ Only relevant if the `type` is set to `analysis`.
726
+ * **arguments (optional)**: Arguments to be passed to an `Analysis`.
727
+ Arguments are passed as a list of key value pairs, separated by `;` characters,
728
+ e.g. `foo=bar;bar=foo`.
729
+ Only relevant if the `type` is set to `analysis`.
730
+
731
+ For the type `analysis`, the value returned by the provider is either `0`
732
+ (if the analysis failed), or `1` (analysis passed).
0 commit comments