Mixer Service

Package istio.mixer.v1

Index

Mixer

Mixer provides three core features:

  • Precondition Checking. Enables callers to verify a number of preconditions before responding to an incoming request from a service consumer. Preconditions can include whether the service consumer is properly authenticated, is on the service’s whitelist, passes ACL checks, and more.

  • Quota Management. Enables services to allocate and free quota on a number of dimensions, Quotas are used as a relatively simple resource management tool to provide some fairness between service consumers when contending for limited resources. Rate limits are examples of quotas.

  • Telemetry Reporting. Enables services to report logging and monitoring. In the future, it will also enable tracing and billing streams intended for both the service operator as well as for service consumers.

Check

 rpc Check(CheckRequest) returns (CheckResponse) 

Checks preconditions and allocate quota before performing an operation. The preconditions enforced depend on the set of supplied attributes and the active configuration.

Report

 rpc Report(ReportRequest) returns (ReportResponse) 

Reports telemetry, such as logs and metrics. The reported information depends on the set of supplied attributes and the active configuration.

Attributes

Attributes represents a set of typed name/value pairs. Many of Mixer’s API either consume and/or return attributes.

Istio uses attributes to control the runtime behavior of services running in the service mesh. Attributes are named and typed pieces of metadata describing ingress and egress traffic and the environment this traffic occurs in. An Istio attribute carries a specific piece of information such as the error code of an API request, the latency of an API request, or the original IP address of a TCP connection. For example:

request.path: xyz/abc
request.size: 234
request.time: 12:34:56.789 04/17/2017
source.ip: 192.168.0.1
target.service: example

A given Istio deployment has a fixed vocabulary of attributes that it understands. The specific vocabulary is determined by the set of attribute producers being used in the deployment. The primary attribute producer in Istio is Envoy, although specialized Mixer adapters and services can also generate attributes.

The common baseline set of attributes available in most Istio deployments is defined here.

Attributes are strongly typed. The supported attribute types are defined by ValueType. Each type of value is encoded into one of the so-called transport types present in this message.

Within this message, strings are referenced using integer indices into one of two string dictionaries. Positive integers index into the global deployment-wide dictionary, whereas negative integers index into the message-level dictionary instead. The message-level dictionary is carried by the words field of this message, the deployment-wide dictionary is determined via configuration.

FieldTypeDescription
words[]repeated stringThe message-level dictionary.
stringsrepeated map<sint32, sint32>Attribute payload. All sint32 values represent indices into one of the word dictionaries. Positive values are indices into the global deployment-wide dictionary, negative values are indices into the message-level dictionary.
int64srepeated map<sint32, int64>
doublesrepeated map<sint32, double>
boolsrepeated map<sint32, bool>
timestampsrepeated map<sint32, Timestamp>
durationsrepeated map<sint32, Duration>
bytesrepeated map<sint32, bytes>
stringMapsrepeated map<sint32, StringMap>

CheckRequest

Used to get a thumbs-up/thumbs-down before performing an action.

FieldTypeDescription
attributesAttributes

The attributes to use for this request.

Mixer's configuration determines how these attributes are used to establish the result returned in the response.

globalWordCountuint32The number of words in the global dictionary, used with to populate the attributes. This value is used as a quick way to determine whether the client is using a dictionary that the server understands.
deduplicationIdstringUsed for deduplicating Check calls in the case of failed RPCs and retries. This should be a UUID per call, where the same UUID is used for retries of the same call.
quotasrepeated map<string, QuotaParams>The individual quotas to allocate

QuotaParams

parameters for a quota allocation

FieldTypeDescription
amountint64Amount of quota to allocate
bestEffortboolWhen true, supports returning less quota than what was requested.

CheckResponse

FieldTypeDescription
preconditionPreconditionResultThe precondition check results.
quotasrepeated map<string, QuotaResult>The resulting quota, one entry per requested quota.

PreconditionResult

FieldTypeDescription
statusStatusA status code of OK indicates all preconditions were satisfied. Any other code indicates not all preconditions were satisfied and details describe why.
validDurationDurationThe amount of time for which this result can be considered valid.
validUseCountint32The number of uses for which this result can be considered valid.
attributesAttributes

The attributes returned by Mixer.

The exact set of attributes returned is determined by the set of adapters Mixer is configured with. These attributes are used to ferry new attributes that Mixer derived based on the input set of attributes and its configuration.

referencedAttributesReferencedAttributesThe total set of attributes that were used in producing the result along with matching conditions.

QuotaResult

FieldTypeDescription
validDurationDurationThe amount of time for which this result can be considered valid.
grantedAmountint64The amount of granted quota. When QuotaParams.bestEffort is true, this will be >= 0. If QuotaParams.bestEffort is false, this will be either 0 or >= QuotaParams.amount.
referencedAttributesReferencedAttributesThe total set of attributes that were used in producing the result along with matching conditions.

ReferencedAttributes

Describes the attributes that were used to determine the response. This can be used to construct a response cache.

FieldTypeDescription
words[]repeated stringThe message-level dictionary. Refer to Attributes for information on using dictionaries.
attributeMatches[]repeated AttributeMatchDescribes a set of attributes.

AttributeMatch

FieldTypeDescription
namesint32The name of the attribute. This is a dictionary index encoded in a manner identical to all strings in the Attributes message.
conditionConditionThe kind of match against the attribute value.
regexstringThe matching regex in the case of condition = REGEX

Condition

How an attribute’s value was matched

ValueDescription
CONDITION_UNSPECIFIEDshould not occur
ABSENCEmatch when attribute doesn't exist
EXACTmatch when attribute value is an exact byte-for-byte match
REGEXmatch when attribute value matches the included regex

ReportRequest

Used to report telemetry after performing one or more actions.

FieldTypeDescription
attributes[]repeated Attributes

The attributes to use for this request.

Each Attributes element represents the state of a single action. Multiple actions can be provided in a single message in order to improve communication efficiency. The client can accumulate a set of actions and send them all in one single message.

Although each Attributes message is semantically treated as an independent stand-alone entity unrelated to the other attributes within the message, this message format leverages delta-encoding between attribute messages in order to substantially reduce the request size and improve end-to-end efficiency. Each individual set of attributes is used to modify the previous set. This eliminates the need to redundantly send the same attributes multiple times over within a single request.

If a client is not sophisticated and doesn't want to use delta-encoding, a degenerate case is to include all attributes in every individual message.

defaultWords[]repeated string

The default message-level dictionary for all the attributes. Individual attribute messages can have their own dictionaries, but if they don't then this set of words, if it is provided, is used instead.

This makes it possible to share the same dictionary for all attributes in this request, which can substantially reduce the overall request size.

globalWordCountuint32The number of words in the global dictionary. To detect global dictionary out of sync between client and server.

ReportResponse

NOTE: _No fields in this message type.__

StringMap

A map of string to string. The keys and values in this map are dictionary indices (see the Attributes message for an explanation)

FieldTypeDescription
entriesrepeated map<sint32, sint32>