From 9f98ee9afd6f564cd56997f3a10939741555a203 Mon Sep 17 00:00:00 2001 From: Kuat Date: Fri, 14 Dec 2018 16:36:39 -0800 Subject: [PATCH] attribute: document lowercased keys in headers (#2974) * document keys Signed-off-by: Kuat Yessenov * spelling Signed-off-by: Kuat Yessenov --- .../policy-and-telemetry/attribute-vocabulary/index.md | 4 ++-- .../config/policy-and-telemetry/expression-language/index.md | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/content/docs/reference/config/policy-and-telemetry/attribute-vocabulary/index.md b/content/docs/reference/config/policy-and-telemetry/attribute-vocabulary/index.md index a4b570d742..cd8006adc8 100644 --- a/content/docs/reference/config/policy-and-telemetry/attribute-vocabulary/index.md +++ b/content/docs/reference/config/policy-and-telemetry/attribute-vocabulary/index.md @@ -46,7 +46,7 @@ deployments will have agents (Envoy or Mixer adapters) that produce these attrib | `destination.service.uid` | string | Unique identifier of the destination service. | `istio://istio-system/services/istio-telemetry` | | `destination.service.name` | string | Destination service name. | `istio-telemetry` | | `destination.service.namespace` | string | Destination service namespace. | `istio-system` | -| `request.headers` | map[string, string] | HTTP request headers. For gRPC, its metadata will be here. | | +| `request.headers` | map[string, string] | HTTP request headers with lowercase keys. For gRPC, its metadata will be here. | | | `request.id` | string | An ID for the request with statistically low probability of collision. | | | `request.path` | string | The HTTP URL path including query string | | | `request.url_path` | string | The path part of HTTP URL, with query string being stripped | | @@ -60,7 +60,7 @@ deployments will have agents (Envoy or Mixer adapters) that produce these attrib | `request.total_size` | int64 | Total size of HTTP request in bytes, including request headers, body and trailers. | | | `request.time` | timestamp | The timestamp when the destination receives the request. This should be equivalent to Firebase "now". | | | `request.useragent` | string | The HTTP User-Agent header. | | -| `response.headers` | map[string, string] | HTTP response headers. | | +| `response.headers` | map[string, string] | HTTP response headers with lowercase keys. | | | `response.size` | int64 | Size of the response body in bytes | | | `response.total_size` | int64 | Total size of HTTP response in bytes, including response headers and body. | | | `response.time` | timestamp | The timestamp when the destination produced the response. | | diff --git a/content/docs/reference/config/policy-and-telemetry/expression-language/index.md b/content/docs/reference/config/policy-and-telemetry/expression-language/index.md index 17b2d7e7aa..1bd59275fd 100644 --- a/content/docs/reference/config/policy-and-telemetry/expression-language/index.md +++ b/content/docs/reference/config/policy-and-telemetry/expression-language/index.md @@ -27,7 +27,7 @@ CEXL supports the following functions. |`!=` |Not Equals |`request.auth.principal != "admin"` ||| |Logical OR | `(request.size == 200)` || `(request.auth.principal == "admin")` |`&&` |Logical AND | `(request.size == 200) && (request.auth.principal == "admin")` -|`[ ]` |Map Access | `request.headers["x-id"]` +|`[ ]` |Map Access | `request.headers["x-request-id"]` |`+` |Add | `request.host + request.path` || |First non empty | `source.labels["app"]` | `source.labels["svc"]` | `"unknown"` |`match` | Glob match |`match(destination.service, "*.ns1.svc.cluster.local")` | Matches prefix or suffix based on the location of `*` @@ -41,6 +41,7 @@ CEXL supports the following functions. |`.endsWith` | string postfix match | `destination.service.endsWith("acme")` | Checks whether `destination.service` ends with `"acme"`. |`emptyStringMap` | Create an empty string map | `request.headers` | `emptyStringMap()`| Use `emptyStringMap` to create an empty string map for default value of `request.headers`. |`conditional` | Simulate ternary operator | `conditional((context.reporter.kind` | `"inbound") == "outbound", "client", "server")` | Returns `"client"` if report kind is `outbound` otherwise returns `"server"`. +|`toLower` | Convert a string to lowercase letters | `toLower("User-Agent")` | Returns `"user-agent"`. ## Type checking @@ -62,7 +63,7 @@ For example, the expression `request.auth.principal == "user1"` fails evaluation |Expression |Return Type |Description| |-----------|------------|-----------| |`request.size` | 200 | **int** | `request.size` if available, otherwise 200. -|`request.headers["X-FORWARDED-HOST"] == "myhost"`| **boolean** +|`request.headers["x-forwarded-host"] == "myhost"`| **boolean** |`(request.headers["x-user-group"] == "admin")` || `(request.auth.principal == "admin")`| **boolean**| True if the user is admin or in the admin group. |`(request.auth.principal` | `"nobody" ) == "user1"` | **boolean** | True if `request.auth.principal` is "user1", The expression will not error out if `request.auth.principal` is missing. |`source.labels["app"]=="reviews" && source.labels["version"]=="v3"`| **boolean** | True if app label is reviews and version label is v3, false otherwise.