AnalysisDefinition
An AnalysisDefinition
resource defines the
list of Service Level Objectives (SLOs) for an Analysis
.
Synopsis
apiVersion: metrics.keptn.sh/v1
kind: AnalysisDefinition
metadata:
name: <name-of-this-resource>
namespace: <namespace-where-this-resource-resides>
spec:
objectives:
- analysisValueTemplateRef:
name: <name-of-referenced-analysisValueTemplate-resource>
namespace: <namespace-of-referenced-analysisValueTemplate-resource>
target:
failure:
<operator>:
fixedValue: <integer> | <quantity>
inRange: | notInRange:
lowBound: <integer> | <quantity>
highBound: <integer> | <quantity>
warning:
<operator>:
fixedValue: <integer> | <quantity>
inRange: | notInRange:
lowBound: <integer> | <quantity>
highBound: <integer> | <quantity>
weight: <integer>
keyObjective: <boolean>
totalScore:
passPercentage: <min-percentage-to-pass>
warningPercentage: <min-percentage-for-warning>
Fields
- apiVersion -- API version being used
- kind -- Resource type.
Must be set to
AnalysisDefinition
.- metadata
- name -- Unique name of this analysis definition. Names must comply with the Kubernetes Object Names and IDs specification.
- namespace -- Namespace where this resource is located.
Analysis
resources must specify this namespace when referencing this definition, unless it resides in the same namespace as theAnalysis
resource.
- metadata
-
spec
-
objectives A list of objectives whose results are combined to determine whether the analysis fails, passes, or passes with a warning.
-
analysisValueTemplateRef (required) -- This string marks the beginning of each objective
- name (required) -- The
metadata.name
value of the AnalysisValueTemplateRef resource that defines the SLI used for this objective. That resource defines the data provider and the query to use. - namespace --
Namespace of the
analysisValueTemplateRef
resource. If the namespace is not specified, the analysis controller looks for theAnalysisValueTemplateRef
resource in the same namespace as theAnalysis
resource.
- name (required) -- The
-
target -- defines failure or, optionally, warning criteria. Values not specified for failure or warning result in a pass. Keptn writes the results of the analysis to the
status
section of the Analysis resource after the analysis runs.To use a value that includes a fraction, use a Kubernetes quantity value rather than a
float
. For example, use the3m
quantity rather than the0.003
float; afloat
value here causesInvalid value
errors. A whole number (integer) is also a legalquantity
value.-
failure -- criteria for failure, specified as
operator: <quantity>
. This can be specified either as an absolutequantity
value or as a range of values.Valid operators for absolute values are:
lessThan
--<
operatorlessThanOrEqual
--<=
operatorgreaterThan
-->
operatorgreaterThanOrEqual
-->=
operatorequalTo
--==
operator
Valid operators for specifying ranges are:
inRange
-- value is inclusively in the defined rangenotInRange
-- value is exclusively out of the defined range
Each of these operators require two arguments:
lowBound
-- minimumquantity
value of the range included or excludedhighBound
-- maximumquantity
value of the range included or excluded
-
warning -- criteria for a warning, specified in the same way as the
failure
field.
-
-
weight -- used to emphasize the importance of one
objective
over others - keyObjective -- If set to
true
, the entire analysis fails if this particular objective fails, no matter what the actualscore
of the analysis is
-
-
totalScore (required) --
- passPercentage -- threshold to reach for the full analysis (all objectives) to pass
- warning Percentage
for the full analysis (all objectives) to pass with
warning
status
-
Usage
An AnalysisDefinition
resource contains a list of objectives to satisfy.
Each of these objectives must specify:
- The
AnalysisValueTemplate
resource that contains the SLIs, defining the data provider from which to gather the data and how to compute the Analysis - Failure or warning target criteria
- Whether the objective is a key objective meaning that its failure fails the Analysis
- Weight of the objective on the overall Analysis
Example
apiVersion: metrics.keptn.sh/v1
kind: AnalysisDefinition
metadata:
labels:
app.kubernetes.io/name: analysisdefinition
app.kubernetes.io/instance: analysisdefinition-sample
app.kubernetes.io/part-of: metrics-operator
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/created-by: metrics-operator
name: analysisdefinition-sample
spec:
objectives:
- analysisValueTemplateRef:
name: response-time-p95
namespace: keptn-system
target:
failure:
lessThan:
fixedValue: 600
warning:
inRange:
lowBound: 300
highBound: 500
weight: 1
keyObjective: false
totalScore:
passPercentage: 90
warningPercentage: 75
For a full example of how to implement the Keptn Analysis feature, see the Analysis guide page.
Files
API reference: AnalysisDefinition
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.