Skip to content

Commit

Permalink
Update request_end instrumentation example (#1095)
Browse files Browse the repository at this point in the history
* Update request_end instrumentation example in README.md
  • Loading branch information
bdewater authored Oct 14, 2022
1 parent af6fb06 commit 2dec63e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 2dec63e

Please sign in to comment.