AttributeGen Config
AttributeGen plugin uses builtin attributes as inputs and produces new attributes that can be used by downstream plugins.
The following is an example of a configuration that produces one attribute
named istio_operationId
using request.url_path
and request.method
.
{
"attributes": [
{
"output_attribute": "istio_operationId",
"match": [
{
"value": "ListBooks",
"condition": "request.url_path == '/books' && request.method ==
'GET'"
},
{
"value": "GetBook",
"condition":
"request.url_path.matches('^/shelves/[[:alnum:]]*/books/[[:alnum:]]*$')
&& request.method == 'GET'"
},
{
"value": "CreateBook",
"condition": "request.url_path == '/books/' && request.method ==
'POST'"
}
]
}
]
}
If the Stats plugin runs after AttributeGen, it can use istio_operationId
to populate a dimension on a metric.
The following is an example of response codes being mapped into a smaller
number of response classes as the istio_responseClass
attribute. For
example, all response codes in 200s are mapped to 2xx
.
{
"attributes": [
{
"output_attribute": "istio_responseClass",
"match": [
{
"value": "2xx",
"condition": "response.code >= 200 && response.code <= 299"
},
{
"value": "3xx",
"condition": "response.code >= 300 && response.code <= 399"
},
{
"value": "404",
"condition": "response.code == 404"
},
{
"value": "429",
"condition": "response.code == 429"
},
{
"value": "503",
"condition": "response.code == 503"
},
{
"value": "5xx",
"condition": "response.code >= 500 && response.code <= 599"
},
{
"value": "4xx",
"condition": "response.code >= 400 && response.code <= 499"
}
]
}
]
}
If multiple AttributeGen configurations produce the same attribute, the result of the last configuration will be visible to downstream filters.
PluginConfig
Top level configuration to generate new attributes based on attributes of the proxied traffic.
AttributeGeneration
AttributeGeneration define generation of one attribute.
Match
If the condition evaluates to true then the Match returns the specified value.