AnalysisValueTemplate
An AnalysisValueTemplate
resource
defines a Service Level Indicator (SLI),
which identifies the data to be analyzed
by a data source to use and the query to issue.
One Analysis can use data from multiple AnalysisValueTemplates.
Synopsis
apiVersion: metrics.keptn.sh/v1
kind: AnalysisValueTemplate
metadata:
name: response-time-p95
namespace: <namespace-where-this-resource-resides>
spec:
provider:
name: cortex | datadog | dql | dynatrace | prometheus | thanos
query: <query>
Fields
- apiVersion -- API version being used
- kind -- Resource type.
Must be set to
AnalysisValueTemplate
-
metadata
- 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 theAnalysis
resource.
-
spec
- provider (required) -- the KeptnMetricProvider
- name -- The
spec.name
value of the KeptnMetricsProvider resource to use. Note that eachAnalysisValueTemplate
resource can use only one data source. However, anAnalysis
resource can use multipleAnalysisValueTemplate
resources, each of which uses a different data source.
- name -- The
- 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 thespec.args
section of theAnalysisTemplate
resource, which might be set tonodename: test
.
- provider (required) -- the KeptnMetricProvider
Usage
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.
Example
apiVersion: metrics.keptn.sh/v1
kind: AnalysisValueTemplate
metadata:
labels:
app.kubernetes.io/name: analysisvaluetemplate
app.kubernetes.io/instance: analysisvaluetemplate-sample
app.kubernetes.io/part-of: metrics-operator
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/created-by: metrics-operator
name: response-time-p95
namespace: keptn-system
spec:
provider:
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.
Files
API reference: AnalysisValueTemplate
Differences between versions
The Keptn Analysis feature is an official part of Keptn v0.10.0 and later. Keptn v0.8.3 included a preliminary release of this feature but it was hidden behind a feature flag. The behavior of this feature is unchanged since v0.8.3.