Class: Stripe::StripeClient::StripeRequestMetrics

Inherits:
Object
  • Object
show all
Defined in:
lib/stripe/stripe_client.rb

Overview

StripeRequestMetrics tracks metadata to be reported to stripe for metrics collection

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_id, request_duration_ms, usage: []) ⇒ StripeRequestMetrics

Returns a new instance of StripeRequestMetrics.



1085
1086
1087
1088
1089
# File 'lib/stripe/stripe_client.rb', line 1085

def initialize(request_id, request_duration_ms, usage: [])
  self.request_id = request_id
  self.request_duration_ms = request_duration_ms
  self.usage = usage
end

Instance Attribute Details

#request_duration_msObject

Request duration in milliseconds



1080
1081
1082
# File 'lib/stripe/stripe_client.rb', line 1080

def request_duration_ms
  @request_duration_ms
end

#request_idObject

The Stripe request ID of the response.



1077
1078
1079
# File 'lib/stripe/stripe_client.rb', line 1077

def request_id
  @request_id
end

#usageObject

list of names of tracked behaviors associated with this request



1083
1084
1085
# File 'lib/stripe/stripe_client.rb', line 1083

def usage
  @usage
end

Instance Method Details

#payloadObject



1091
1092
1093
1094
1095
# File 'lib/stripe/stripe_client.rb', line 1091

def payload
  ret = { request_id: request_id, request_duration_ms: request_duration_ms }
  ret[:usage] = usage if !usage.nil? && !usage.empty?
  ret
end