activerecord-instrumentation 0.5.1 → 0.6.0.jhemphill1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec1aa8f04a43ddc425d1b75bbb1b36e2a460a40301fa26ab3c231011acb2205a
4
- data.tar.gz: 584f05b61f5bc532dcdbf65cd08d5e45697994f8dec83ab9c2f85b02175c0b9e
3
+ metadata.gz: 2f9fe8e655275c95316af6091d55c794c384c20b721c301056661aa4eca8aafd
4
+ data.tar.gz: 128ba9528fdc517e3fddfab4ad75cad0cfea8fd4f4dab7f371cfd0b7c79c5699
5
5
  SHA512:
6
- metadata.gz: 9f4f2a6b39886d381866f1df1e0cd0edd83c39c9f603139948276216e8627cc34a9db7be1a10a8dfdb2df660601f28e291de642a9207ffbfefc78176ca96c570
7
- data.tar.gz: 38c5ba6648ade1f097333ce41e4b47b6ecca143ad620b96b60cae1d6c68886d10726f96039040826b71b09463fb95ffa620aead8389375777af84d4c71503f78
6
+ metadata.gz: 1b3b8da9054b12445889993ee125a3ef456ff97f056ef3ee6194d3bfc100eb263401335e797681334dd58745bc3d9108110bf3b2aa9e69212d25f68a9e840a03
7
+ data.tar.gz: de602d96113006ff75dbaf44a497289f5fcc193b1fd8a5797a35c3a4bfafa65a546effd7152db406ca901dfc738bae538ef214c24a485888ac9a96e52bf4b668
data/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## 0.5.2 01/24/2022
5
+ * Fixed query tagging for empty queries
6
+
4
7
  ## 0.5.1 01/20/2022
5
8
  * Fixed the publishing process
6
9
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activerecord-instrumentation (0.5.1)
4
+ activerecord-instrumentation (0.6.0.jhemphill1)
5
5
  activerecord
6
6
  opentracing (~> 0.5)
7
7
 
@@ -22,7 +22,7 @@ GEM
22
22
  ast (2.4.0)
23
23
  concurrent-ruby (1.1.9)
24
24
  diff-lcs (1.3)
25
- i18n (1.8.11)
25
+ i18n (1.10.0)
26
26
  concurrent-ruby (~> 1.0)
27
27
  jaro_winkler (1.5.4)
28
28
  minitest (5.15.0)
@@ -66,7 +66,7 @@ GEM
66
66
  tzinfo (2.0.4)
67
67
  concurrent-ruby (~> 1.0)
68
68
  unicode-display_width (1.6.1)
69
- zeitwerk (2.5.3)
69
+ zeitwerk (2.5.4)
70
70
 
71
71
  PLATFORMS
72
72
  ruby
@@ -79,7 +79,7 @@ module ActiveRecord
79
79
  "db.instance" => db_instance,
80
80
  "db.cached" => payload.fetch(:cached, false),
81
81
  "db.type" => DB_TYPE,
82
- "peer.address" => peer_address_tag
82
+ "peer.address" => peer_address_tag(payload.fetch(:connection, false))
83
83
  }.merge(db_statement(payload))
84
84
  end
85
85
 
@@ -87,7 +87,7 @@ module ActiveRecord
87
87
  def db_statement(payload)
88
88
  if sql_logging_enabled
89
89
  query_sql = sanitize_sql(payload.fetch(:sql).squish)
90
- first_word = query_sql.split.first.downcase
90
+ first_word = query_sql.split.first&.downcase || ""
91
91
 
92
92
  {
93
93
  "db.statement" => query_sql,
@@ -104,13 +104,21 @@ module ActiveRecord
104
104
  sanitizer ? sanitizer.sanitize(sql) : sql
105
105
  end
106
106
 
107
- def peer_address_tag
108
- @peer_address_tag ||= [
109
- "#{connection_config.fetch(:adapter)}://",
110
- connection_config[:username],
111
- connection_config[:host] && "@#{connection_config[:host]}",
112
- "/#{db_instance}"
113
- ].join
107
+ def peer_address_tag(connection)
108
+ unless defined? @peer_address_tag
109
+ if connection.respond_to? :host # using the postgres adapter
110
+ @peer_address_tag = connection.host
111
+ else
112
+ @peer_address_tag = [
113
+ "#{connection_config.fetch(:adapter)}://",
114
+ connection_config[:username],
115
+ connection_config[:host] && "@#{connection_config[:host]}",
116
+ "/#{db_instance}"
117
+ ].join
118
+ end
119
+ end
120
+
121
+ @peer_address_tag
114
122
  end
115
123
 
116
124
  def db_instance
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module OpenTracing
5
- VERSION = "0.5.1"
5
+ VERSION = "0.6.0.jhemphill1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-instrumentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0.jhemphill1
5
5
  platform: ruby
6
6
  authors:
7
7
  - SaleMove TechMovers
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-01-20 00:00:00.000000000 Z
12
+ date: 2022-07-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -209,11 +209,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
209
209
  version: '0'
210
210
  required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  requirements:
212
- - - ">="
212
+ - - ">"
213
213
  - !ruby/object:Gem::Version
214
- version: '0'
214
+ version: 1.3.1
215
215
  requirements: []
216
- rubygems_version: 3.2.32
216
+ rubygems_version: 3.1.6
217
217
  signing_key:
218
218
  specification_version: 4
219
219
  summary: ActiveRecord OpenTracing intrumenter