Define the data source and query for each SLI

An AnalysisValueTemplate resource defines a Service Level Indicator (SLI), which identifies the data to be analyzed by data source to use and the query to issue. One Analysis can use data from multiple instances of multiple types of data provider.


kind: AnalysisValueTemplate
  name: response-time-p95
  namespace: <namespace-where-this-resource-resides>
    name: prometheus | dynatrace | dql | datadog
  query: <query>


  • apiVersion – API version being used
  • kind – Resource type. Must be set to AnalysisValueTemplate
  • metadata
    • labels – The Analysis feature uses the name and part-of labels that are discussed in Basic annotations plus the following:
      • analysis-sample

      • – Tool used to manage the operation of the application. Valid values are helm and kustomize.

      • metrics-operator

        TODO: Need to clarify how to use these annotations

    • name – Unique name of this template. Names must comply with the Kubernetes Object Names and IDs specification.
    • namespace (optional) – Namespace where this template lives. Analysis resources must specify this namespace when referencing this definition, unless it resides in the same namespace as the Analysis resource.
  • spec
    • provider (required) – the KeptnMetricProvider
      • name – The value of the KeptnMetricsProvider resource to use. Note that each AnalysisValueTemplate resource can use only one data source. However, an Analysis resource can use multiple AnalysisValueTemplate resources, each of which uses a different data source.
    • query (required) – query to be made. This is done in the data provider’s query language. It can include variables that use the go templating syntax to insert a placeholder in the query. For example, the query might include {{.nodename}}'}; the value to substitute for that variable for this Analysis is defined in the spec.args section of the AnalysisTemplate resource, which might be set to nodename: test.


You must define a KeptnMetricsProvider for each instance of each data provider you are using. The AnalysisValueTemplate refers to that provider and queries it.

One Analysis can use data from multiple instances of multiple types of data provider; you must define a KeptnMetricsProvider resource for each instance of each data provider you are using. The template refers to that provider and queries it.


kind: AnalysisValueTemplate
  labels: analysisvaluetemplate analysisvaluetemplate-sample metrics-operator kustomize metrics-operator
  name: response-time-p95
  namespace: keptn-lifecycle-toolkit-system
    name: prometheus
  query: "sum(kube_pod_container_resource_limits{node='{{.nodename}}'}) - sum(kube_node_status_capacity{node='{{.nodename}}'})"

For a full example of how the AnalysisValueTemplate is used to implement the Keptn Analysis feature, see the Analysis guide page.


API reference: AnalysisValueTemplate

Differences between versions

Keptn v0.8.3 includes a preliminary release of the Keptn Analysis feature but is hidden behind a feature flag. To preview these features, set the environment ENABLE_ANALYSIS to true in the metrics-operator deployment.

See also

Last modified 2023-11-03: Update docs man (#2408) (756d61a)