5.5 KiB
| title | overview | order | layout | type |
|---|---|---|---|---|
| Policy and Telemetry Rules | Describes the rules used to configure Mixer policy and telemetry. | 40 | docs | markdown |
{% include home.html %}
Index
Rule
A Rule is a selector and a set of intentions to be executed when the
selector evaluates to true.
| Field | Type | Description |
|---|---|---|
match |
string | Required. Match is an attribute based predicate. When Mixer receives a request it evaluates the match expression and executes all the associated A few example match:
|
actions[] |
repeated Action | Optional. The actions that will be executed when match evaluates to true. |
The following example instructs Mixer to invoke 'handler.prometheus' handler for
all services and pass it the instance constructed using the
RequestCount metric instance.
apiVersion: "config.istio.io/v1alpha2"
kind: rule
metadata:
name: promcount
namespace: istio-system
spec:
- match: destination.service == "*"
actions:
- handler: handler.prometheus
instances:
- RequestCount.metric
Custom Resource Definition
kind: CustomResourceDefinition
apiVersion: apiextensions.k8s.io/v1beta1
metadata:
name: rules.config.istio.io
labels:
package: istio.io.mixer
istio: core
spec:
group: config.istio.io
names:
kind: rule
plural: rules
singular: rule
scope: Namespaced
version: v1alpha2
Action
Action describes which Handler to invoke and what data to pass to it for processing.
| Field | Type | Description |
|---|---|---|
handler |
string | Required. Fully qualified name of the handler to invoke. Must match the name of a Handler. |
instances[] |
repeated string | Required. Each value must match the fully qualified name of the Instances. Referenced instances are evaluated by resolving the attributes/literals for all the fields. The constructed objects are then passed to the handler referenced within this action. |
The following example instructs Mixer to invoke the handler.prometheus handler
and pass it the instance constructed using the RequestCount metric instance.
handler: handler.prometheus
instances:
- RequestCount.metric
Handler
Handler allows the operator to configure a specific adapter implementation.
In the following example we define a prometheus handler using the Mixer's
prepackaged prometheus
adapter. Here,
we define how the handler should generate prometheus metrics from the metric
instances provided by Mixer.
apiVersion: "config.istio.io/v1alpha2"
kind: prometheus
metadata:
name: handler
namespace: istio-system
spec:
metrics:
- name: request_count
instance_name: RequestCount.metric.istio-system
kind: COUNTER
label_names:
- source_service
- source_version
- destination_service
- destination_version
- response_code
Instance
A Instance tells Mixer how to create values for particular template.
Instance is defined by the operator. Instance is defined relative to a known template. Their purpose is to tell Mixer how to use attributes or literals to produce values for the specified template at runtime.
The following example instructs Mixer to construct an instance associated with
metric template. It
provides a mapping from the template's fields to expressions. Instances produced
with this instance configuration can be referenced by
Actions using name RequestCount.
apiVersion: "config.istio.io/v1alpha2"
kind: metric
metadata:
name: RequestCount
namespace: istio-system
spec:
value: "1"
dimensions:
source_service: source.service | "unknown"
source_version: source.labels["version"] | "unknown"
destination_service: destination.service | "unknown"
destination_version: destination.labels["version"] | "unknown"
response_code: response.code | 200
monitored_resource_type: '"UNSPECIFIED"'