activerecord-instrumentation 0.6.0.jhemphill2 → 0.6.0.jhemphill3

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: 29ef8227c4292b15e644ab1b59e56c28d48d97e36fe7be95862678bae61e5d9c
4
- data.tar.gz: 0e1efa52bb4a69a41b219028e8a25d9b21a67026c138d08c4b05b4bf72ab85bd
3
+ metadata.gz: 95c186a845e1f54640ec23d41c6f4af63672c70a2b40eead66abd7dfdfa9a5d9
4
+ data.tar.gz: 5dbd6b7b69424ff53fe2aaaecd2c9980ea427f32ac85b69f779b6bd60fbfe1c5
5
5
  SHA512:
6
- metadata.gz: fc2935010852dca0b75cc17d3add77c3257a7b636117eb0fd58e19cb06132d6f2475bc9ecf02964e970625b2660b51f4d1e8eeb8b9265d693b7fc835c34654e4
7
- data.tar.gz: a7368790d1e844bf6b47812b50c2b439081c79648869f1eaf0dfba6e573568b0b7bd4097df7eefd7ce9dbe35cc9b584b0e4f5238dfd7c701cdbda2fb9f2279ab
6
+ metadata.gz: 1542c660df6a46953df85ed993648afcf28b3a5195560176b528d7f03dd148ad404bbe53e732ea8ac4a0fa6f81cc471e89bb8931da42aa0c181ac93c819f8b36
7
+ data.tar.gz: bf4172f41056e08ef86bbcab7a6c56cd2d044d90f18ccd600ac59758ead73abf056283e7b2424771460b6a1ed6fd9a74d0d36ac790986629810d429167d259b6
data/CHANGELOG.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
- ## 0.6.0.jhemphill2 07/11/2022
4
+ ## 0.6.0.jhemphill3 07/11/2022
5
5
  * Fixed query tagging for empty queries
6
6
 
7
7
  ## 0.5.2 01/24/2022
data/Gemfile.lock CHANGED
@@ -1,19 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activerecord-instrumentation (0.6.0.jhemphill2)
4
+ activerecord-instrumentation (0.6.0.jhemphill3)
5
5
  activerecord
6
6
  opentracing (~> 0.5)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (6.1.6)
12
- activesupport (= 6.1.6)
13
- activerecord (6.1.6)
14
- activemodel (= 6.1.6)
15
- activesupport (= 6.1.6)
16
- activesupport (6.1.6)
11
+ activemodel (6.1.6.1)
12
+ activesupport (= 6.1.6.1)
13
+ activerecord (6.1.6.1)
14
+ activemodel (= 6.1.6.1)
15
+ activesupport (= 6.1.6.1)
16
+ activesupport (6.1.6.1)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (>= 1.6, < 2)
19
19
  minitest (>= 5.1)
@@ -79,8 +79,8 @@ module ActiveRecord
79
79
  "db.instance" => db_instance,
80
80
  "db.cached" => payload.fetch(:cached, false),
81
81
  "db.type" => DB_TYPE,
82
- "connection" => payload[:connection].inspect,
83
- "peer.address" => peer_address_tag(payload.fetch(:connection, false))
82
+ "peer.mysql_db_name" => mysql_db_name_tag(payload.fetch(:connection, nil)&.raw_connection),
83
+ "peer.address" => peer_address_tag
84
84
  }.merge(db_statement(payload))
85
85
  end
86
86
 
@@ -105,22 +105,19 @@ module ActiveRecord
105
105
  sanitizer ? sanitizer.sanitize(sql) : sql
106
106
  end
107
107
 
108
- def peer_address_tag(connection)
109
- unless defined? @peer_address_tag
110
- if connection.respond_to? :host # using the postgres/mysql adapter
111
- @peer_address_tag = connection.host + "_hotdogs_"
112
- else
113
- @peer_address_tag = "farts"
114
- # [
115
- # "#{connection_config.fetch(:adapter)}://",
116
- # connection_config[:username],
117
- # connection_config[:host] && "@#{connection_config[:host]}",
118
- # "/#{db_instance}"
119
- # ].join
120
- end
121
- end
108
+ def mysql_db_name_tag(db_connection)
109
+ return db_connection.host if db_connection.respond_to?(:host)
110
+ return nil
111
+ end
122
112
 
123
- @peer_address_tag
113
+ def peer_address_tag
114
+ @peer_address_tag ||=
115
+ [
116
+ "#{connection_config.fetch(:adapter)}://",
117
+ connection_config[:username],
118
+ connection_config[:host] && "@#{connection_config[:host]}",
119
+ "/#{db_instance}"
120
+ ].join
124
121
  end
125
122
 
126
123
  def db_instance
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module OpenTracing
5
- VERSION = "0.6.0.jhemphill2"
5
+ VERSION = "0.6.0.jhemphill3"
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.6.0.jhemphill2
4
+ version: 0.6.0.jhemphill3
5
5
  platform: ruby
6
6
  authors:
7
7
  - SaleMove TechMovers