Skip to content

Commit

Permalink
Only send telemetry if request ID was present
Browse files Browse the repository at this point in the history
Tweaks telemetry implementation slightly to be inline with the recent
implementation in stripe-php. Telemetry isn't much good if a request ID
wasn't present, so we only send telemetry if it was.
  • Loading branch information
brandur committed Nov 15, 2018
1 parent 8c4813f commit 78df532
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/stripe/stripe_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ def execute_request_with_rescues(api_base, context)
resp = yield
context = context.dup_from_response(resp)
log_response(context, request_start, resp.status, resp.body)
if Stripe.enable_telemetry?

if Stripe.enable_telemetry? && context.request_id
request_duration_ms = ((Time.now - request_start) * 1000).to_int
@last_request_metrics = StripeRequestMetrics.new(context.request_id, request_duration_ms)
end
Expand Down

0 comments on commit 78df532

Please sign in to comment.