pigeon-http 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b49e953d40948596cfea066d3002efb0e612ece45ce6b8bcdd1f25772d329ed
4
- data.tar.gz: fc38bffab847cd7c37b13e0009bd11a61e039ceaf87fd8495833ec2228861317
3
+ metadata.gz: 204c0c65ca18699400c662cdce4813337fa5f270a15012c63279ab03e1fb35c4
4
+ data.tar.gz: f2c2070ca2ab97182b0574ecf281759a14cee4b7d7d42f42ce23d97b8a8a0ace
5
5
  SHA512:
6
- metadata.gz: 2296d57aabe77db0a39cf9ef06abdbff05160b8a72fd16b910407e3c42075d8132c289ab9568942ccee5c44af51a96a43e020b01186f49225121e4d9a4f9e852
7
- data.tar.gz: ff378ba4eb6137df6e43bf6355bc77882d0d4520c9ec9132ec8b64d5742ab5ecde89faeaf6bc0a72f7651130a8e8fd424aa941af4eb3a8450146821926fe224a
6
+ metadata.gz: 2f66c5ce34abe98064138ade62435d182a0592ee147799b52c199e19893f5b5c66dc01d5a3d7755efc7b9c330fb95d74e539d8176637b8fbda03b6baa31fce4a
7
+ data.tar.gz: 72cc4bbac4814d99f6f3a79fdfe49a261cc65a7044706e8736469e61fb1b90ed5ca2edd07a47cc93f313c949bd7605b1f4982bfaf65990f08431b9a2b11dba58
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pigeon-http (0.1.3)
4
+ pigeon-http (0.1.4)
5
5
  circuitbox
6
6
  ddtrace
7
7
  dogstatsd-ruby
data/lib/pigeon/core.rb CHANGED
@@ -77,49 +77,43 @@ module Pigeon
77
77
  end
78
78
 
79
79
  def get url, args = {}
80
- start = Time.now
81
80
  response = http(:get, url, args)
82
- Pigeon::Statsd.new(@options[:request_name] + '_latency', tags: [url]).capture(action: :histogram, count: (Time.now - start)) unless @options[:monitoring]
83
-
84
- response
85
81
  rescue => e
82
+ puts e
86
83
  @callbacks[:HttpError]&.call(e)
87
84
  end
88
85
 
89
86
  def post url, args = {}
90
- start = Time.now
91
87
  response = http(:post, url, args)
92
- Pigeon::Statsd.new(@options[:request_name] + '_latency', tags: [url]).capture(action: :histogram, count: (Time.now - start)) unless @options[:monitoring]
93
-
94
- response
95
88
  rescue => e
96
89
  @callbacks[:HttpError]&.call(e)
97
90
  end
98
91
 
99
92
  def put url, args = {}
100
- start = Time.now
101
93
  response = http(:put, url, args)
102
- Pigeon::Statsd.new(@options[:request_name] + '_latency', tags: [url]).capture(action: :histogram, count: (Time.now - start)) unless @options[:monitoring]
103
-
104
- response
105
94
  rescue => e
106
95
  @callbacks[:HttpError]&.call(e)
107
96
  end
108
97
 
109
98
  def delete url, args = {}
110
- http(:delete, url, args)
99
+ response = http(:delete, url, args)
111
100
  rescue => e
112
101
  @callbacks[:HttpError]&.call(e)
113
102
  end
114
103
 
115
104
  def http method, url, args = {}
105
+ start = Time.now
116
106
  args.merge({
117
107
  read_timeout: @options[:request_timeout],
118
108
  open_timeout: @options[:request_open_timeout],
119
109
  ssl_verify: @options[:ssl_verify]
120
110
  })
121
111
  response = Pigeon::Http::Request.new(method, url, args).execute
122
- Pigeon::Statsd.new(@options[:request_name] + '_througput', tags: [url]).capture
112
+
113
+ uri = URI.parse(url)
114
+ Pigeon::Statsd.new(@options[:request_name] + '_latency', tags: [uri.host]).capture(action: :histogram, count: (Time.now - start))
115
+ Pigeon::Statsd.new(@options[:request_name] + '_througput', tags: [uri.host]).capture
116
+ Pigeon::Statsd.new(@options[:request_name] + '_status', tags: [response.code]).capture
123
117
 
124
118
  response
125
119
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pigeon
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pigeon-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fitra Aditya
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-12 00:00:00.000000000 Z
11
+ date: 2023-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: circuitbox