istio.io/_docs/reference/api/mixer-service.md

17 KiB

title overview order layout type
Mixer Service Generated documentation for Mixer's API Surface 20 docs markdown

Package istio.mixer.v1

Index

Mixer

The Mixer API

Check

  rpc Check(CheckRequest) returns (CheckResponse)

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

Quota

  rpc Quota(QuotaRequest) returns (QuotaResponse)

Quota allocates and releases quota.

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

An instance of this message is delivered to the mixer with every API call.

The general idea is to leverage the stateful gRPC streams from the proxy to the mixer to keep to a minimum the 'attribute chatter'. Only delta attributes are sent over, multiple concurrent attribute contexts can be used to avoid thrashing, and attribute indices are used to keep the wire protocol maximally efficient.

Producing this message is the responsibility of the mixer's client library which is linked into different proxy implementations.

The processing order for this state in the mixer is:

  • Any new dictionary is applied

  • The requested attribute context is looked up. If no such context has been defined, a new context is automatically created and initialized to the empty state. When a gRPC stream is first created, there are no attribute contexts for the stream.

  • If reset_context is true, then the attribute context is reset to the empty state.

  • All attributes to deleted are removed from the attribute context.

  • All attribute changes are applied to the attribute context.

Field Type Description
dictionary repeated map<int32, string>

A dictionary that provides a mapping of shorthand index values to attribute names.

This is intended to leverage the stateful gRPC stream from the proxy to the mixer. This dictionary is sent over only when a stream to the mixer is first established and when the proxy's configuration changes and different attributes may be produced.

Once a dictionary has been sent over, it stays in effect until a new dictionary is sent to replace it. The first request sent on a stream must include a dictionary, otherwise the mixer can't process any attribute updates.

Dictionaries are independent of the attribute context and are thus global to each gRPC stream.

attribute_context int32

The attribute context against which to operate.

The mixer keeps different contexts live for any proxy gRPC stream. This allows the proxy to maintain multiple concurrent 'bags of attributes' within the mixer.

If the proxy doesn't want to leverage multiple contexts, it just passes 0 here for every request.

The proxy is configured to use a maximum number of attribute contexts in order to prevent an explosion of contexts in the mixer's memory space.

reset_context bool

When true, resets the current attribute context to the empty state before applying any incoming attributes.

Resetting contexts is useful to constrain the amount of resources used by the mixer. The proxy needs to intelligently manage a pool of contexts. It may be useful to reset a context when certain big events happen, such as when an HTTP2 connection into the proxy terminates.

string_attributes repeated map<int32, string> Attributes being updated within the specified attribute context. These maps add and/or overwrite the context's current set of attributes.
int64_attributes repeated map<int32, int64>
double_attributes repeated map<int32, double>
bool_attributes repeated map<int32, bool>
timestamp_attributes repeated map<int32, Timestamp>
duration_attributes repeated map<int32, Duration>
bytes_attributes repeated map<int32, bytes>
stringMap_attributes repeated map<int32, StringMap>
deleted_attributes[] repeated int32 Attributes that should be removed from the specified attribute context. Deleting attributes which aren't currently in the attribute context is not considered an error.
timestamp_attributes_HACK repeated map<int32, Timestamp>
duration_attributes_HACK repeated map<int32, Duration>

CheckRequest

Used to verify preconditions before performing an action.

Field Type Description
request_index int64 Index within the stream for this request, used to match to responses
attribute_update Attributes The attributes to use for this request

CheckResponse

Field Type Description
request_index int64 Index of the request this response is associated with
attribute_update Attributes The attributes to use for this response
result Status Indicates whether or not the preconditions succeeded
expiration Duration The amount of time for which this result can be considered valid, given the same inputs

QuotaRequest

Field Type Description
request_index int64 Index within the stream for this request, used to match to responses
attribute_update Attributes The attributes to use for this request
deduplication_id string Used for deduplicating quota allocation/free 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 quota allocation call.
quota string The quota to allocate from.
amount int64 The amount of quota to allocate.
best_effort bool If true, allows a response to return less quota than requested. When false, the exact requested amount is returned or 0 if not enough quota was available.

QuotaResponse

Field Type Description
request_index int64 Index of the request this response is associated with.
attribute_update Attributes The attributes to use for this response
result Status Indicates whether the quota request was successfully processed.
expiration Duration The amount of time the returned quota can be considered valid, this is 0 for non-expiring quotas.
amount int64 The total amount of quota returned, may be less than requested.

ReportRequest

Used to report telemetry after performing an action.

Field Type Description
request_index int64 Index within the stream for this request, used to match to responses
attribute_update Attributes The attributes to use for this request

ReportResponse

Field Type Description
request_index int64 Index of the request this response is associated with
attribute_update Attributes The attributes to use for this response
result Status Indicates whether the report was processed or not

StringMap

A map of string to string. The keys in these maps are from the current dictionary.

Field Type Description
map repeated map<int32, string>

Package google.rpc

Index

Status

The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC. The error model is designed to be:

  • Simple to use and understand for most users
  • Flexible enough to meet unexpected needs

Overview

The Status message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers understand and resolve the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package google.rpc which can be used for common error conditions.

Language mapping

The Status message is the logical representation of the error model, but it is not necessarily the actual wire format. When the Status message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C.

Other uses

The error model and the Status message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments.

Example uses of this error model include:

  • Partial errors. If a service needs to return partial errors to the client, it may embed the Status in the normal response to indicate the partial errors.

  • Workflow errors. A typical workflow has multiple steps. Each step may have a Status message for error reporting purpose.

  • Batch operations. If a client uses batch request and batch response, the Status message should be used directly inside batch response, one for each error sub-response.

  • Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the Status message.

  • Logging. If some API errors are stored in logs, the message Status could be used directly after any stripping needed for security/privacy reasons.

Field Type Description
code int32 The status code, which should be an enum value of google.rpc.Code.
message string A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
details[] repeated Any A list of messages that carry the error details. There will be a common set of message types for APIs to use.