From b1326ffd06ee6f24c9ce416ffaa3ae540f190f3b Mon Sep 17 00:00:00 2001 From: Alexander Yastrebov Date: Mon, 16 Dec 2024 21:41:09 +0100 Subject: [PATCH] docs: add example for tracingTagFromResponseIfStatus (#3348) 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..46d58ebddd 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 only for responses having status code from 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