From 2dec63e6b057d25350c1b8b983ad6f6f579de4ed Mon Sep 17 00:00:00 2001 From: Bart de Water <496367+bdewater@users.noreply.github.com> Date: Fri, 14 Oct 2022 19:40:20 -0400 Subject: [PATCH] Update request_end instrumentation example (#1095) * Update request_end instrumentation example in README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e32af3dd7..69dea24da 100644 --- a/README.md +++ b/README.md @@ -261,9 +261,13 @@ For example: ```ruby Stripe::Instrumentation.subscribe(:request_end) do |request_event| + # Filter out high-cardinality ids from `path` + path_parts = event.path.split("/").drop(2) + resource = path_parts.map { |part| part.match?(/\A[a-z_]+\z/) ? part : ":id" }.join("/") + tags = { method: request_event.method, - resource: request_event.path.split('/')[2], + resource: resource, code: request_event.http_status, retries: request_event.num_retries }