From aff5b4dc7b1bcfb67a34c8a286b7053eaf18ca56 Mon Sep 17 00:00:00 2001 From: Alexander Yastrebov Date: Mon, 16 Dec 2024 17:03:42 +0100 Subject: [PATCH] docs: add example for tracingTagFromResponseIfStatus Add an example using template placeholder for the tag value. Follow up on #3202 Signed-off-by: Alexander Yastrebov --- docs/reference/filters.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/reference/filters.md b/docs/reference/filters.md index 3f2e2d5548..4552b3b9ee 100644 --- a/docs/reference/filters.md +++ b/docs/reference/filters.md @@ -3361,16 +3361,26 @@ tracingTag("http.flow_id", "${request.header.X-Flow-Id}") ### tracingTagFromResponse -This filter works just like [tracingTag](#tracingtag), but is applied after the request was processed. In particular, [template placeholders](#template-placeholders) referencing the response can be used in the parameters. +This filter works just like [tracingTag](#tracingtag), but is applied after the request was processed. +In particular, [template placeholders](#template-placeholders) referencing the response can be used in the tag value. ### tracingTagFromResponseIfStatus -Example: set error tag to true in case response status code is `>= 500` and `<= 599` +This filter works like [tracingTagFromResponse](#tracingtagfromresponse), but is applied if response +status code is within the specified range. + +Example: set error tag to true in case response status code is `>= 500` and `<= 599`: ``` tracingTagFromResponseIfStatus("error", "true", 500, 599) ``` +Example: set user id tag for ratelimited requests: + +``` +tracingTagFromResponseIfStatus("user.id", "${request.header.X-User-Id}", 429, 429) -> clusterClientRatelimit("user-id", 10, "1m", "X-User-Id") +``` + ### tracingSpanName