The prometheus probe allows users to run Prometheus queries and match the resulting output against specific conditions. The intent behind this probe is to allow users to define metrics-based SLOs in a declarative way and determine the experiment verdict based on its success. The probe runs the query on a Prometheus server defined by the endpoint, and checks whether the output satisfies the specified criteria.
It can be executed by setting type as promProbe inside .spec.experiments[].spec.probe.
View the prometheus probe schema
Field
.name
Description
Flag to hold the name of the probe
Type
Mandatory
Range
n/a (type: string)
Notes
The .name holds the name of the probe. It can be set based on the usecase
Field
.type
Description
Flag to hold the type of the probe
Type
Mandatory
Range
httpProbe, k8sProbe, cmdProbe, promProbe
Notes
The .type supports four type of probes. It can one of the httpProbe, k8sProbe, cmdProbe, promProbe
Field
.mode
Description
Flag to hold the mode of the probe
Type
Mandatory
Range
SOT, EOT, Edge, Continuous, OnChaos
Notes
The .mode supports five modes of probes. It can one of the SOT, EOT, Edge, Continuous, OnChaos
Field
.promProbe/inputs.endpoint
Description
Flag to hold the prometheus endpoints for the promProbe
Type
Mandatory
Range
n/a {type: string}
Notes
The .promProbe/inputs.endpoint contains the prometheus endpoints
Field
.promProbe/inputs.query
Description
Flag to hold the promql query for the promProbe
Type
Mandatory
Range
n/a {type: string}
Notes
The .promProbe/inputs.query contains the promql query to extract out the desired prometheus metrics via running it on the given prometheus endpoint
Field
.promProbe/inputs.queryPath
Description
Flag to hold the path of the promql query for the promProbe
Type
Optional
Range
n/a {type: string}
Notes
The .promProbe/inputs.queryPath This field is used in case of complex queries that spans multiple lines, the queryPath attribute can be used to provide the path to a file consisting of the same. This file can be made available to the experiment pod via a ConfigMap resource, with the ConfigMap name being defined in the ChaosEngine OR the ChaosExperiment CR.
It contains the promql query to extract out the desired prometheus metrics via running it on the given prometheus endpoint. The prometheus query can be provided in the query field.
It can be executed by setting .promProbe/inputs.query field.
Use the following example to tune this:
# contains the prom probe which execute the query and match for the expected criteriaapiVersion:litmuschaos.io/v1alpha1kind:ChaosEnginemetadata:name:engine-nginxspec:engineState:"active"appinfo:appns:"default"applabel:"app=nginx"appkind:"deployment"chaosServiceAccount:pod-delete-saexperiments:-name:pod-deletespec:probe:-name:"check-probe-success"type:"promProbe"promProbe/inputs:# endpoint for the promethus serviceendpoint:"<prometheus-endpoint>"# promql query, which should be executedquery:"<promql-query>"comparator:# criteria which should be followed by the actual output and the expected output#supports >=,<=,>,<,==,!= comparisioncriteria:"=="# expected value, which should follow the specified criteriavalue:"<value-for-criteria-match>"mode:"Edge"runProperties:probeTimeout:5interval:5retry:1
In case of complex queries that spans multiple lines, the queryPath attribute can be used to provide the path to a file consisting of the same. This file can be made available to the experiment pod via a ConfigMap resource, with the ConfigMap name being defined in the ChaosEngine OR the ChaosExperiment CR.
It can be executed by setting promProbe/inputs.queryPath field.
NOTE: It is mutually exclusive with the query field. If query is set then it will use the query field otherwise, it will use the queryPath field.
Use the following example to tune this:
# contains the prom probe which execute the query and match for the expected criteriaapiVersion:litmuschaos.io/v1alpha1kind:ChaosEnginemetadata:name:engine-nginxspec:engineState:"active"appinfo:appns:"default"applabel:"app=nginx"appkind:"deployment"chaosServiceAccount:pod-delete-saexperiments:-name:pod-deletespec:probe:-name:"check-probe-success"type:"promProbe"promProbe/inputs:# endpoint for the promethus serviceendpoint:"<prometheus-endpoint>"# the configMap should be mounted to the experiment which contains promql query# use the mounted path herequeryPath:"<pathofthequery>"comparator:# criteria which should be followed by the actual output and the expected output#supports >=,<=,>,<,==,!= comparisioncriteria:"=="# expected value, which should follow the specified criteriavalue:"<value-for-criteria-match>"mode:"Edge"runProperties:probeTimeout:5interval:5retry:1