activerecord-instrumentation 0.6.0.jhemphill2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -2
- data/Gemfile.lock +7 -7
- data/lib/active_record/open_tracing/processor.rb +27 -22
- data/lib/active_record/open_tracing/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ce6d77768f0c5c8ee3b9bc7459c840900d022ef672fb78f9342163bcfdee7ae
|
4
|
+
data.tar.gz: 5e73e0e111b40319e11326fe2247980daac4db510424b2d6c39452cba0f6fc06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a18568aadaa039d7b14dfaecd8a95a2e909399c7640127e4389f9a9fc0875e30e9349a64747f2e2005c48e9281af44f42601ea6a22ea04b77f47ec77cdc2191b
|
7
|
+
data.tar.gz: 2a6e52c506b1c997e7ac881cad9117559471ed8af64c5bb7c1c503b98548b56d90610670f92f67d717c6393f9e370c360bebb15bcdd95e8d77ae08c5518ac469
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
-
## 0.6.0
|
5
|
-
*
|
4
|
+
## 0.6.0 07/11/2022
|
5
|
+
* Improved pper address tag to reflect the current database when using the mysql adapter
|
6
6
|
|
7
7
|
## 0.5.2 01/24/2022
|
8
8
|
* Fixed query tagging for empty queries
|
data/Gemfile.lock
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activerecord-instrumentation (0.6.0
|
4
|
+
activerecord-instrumentation (0.6.0)
|
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)
|
@@ -73,14 +73,15 @@ module ActiveRecord
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def tags_for_payload(payload)
|
76
|
+
db_config = connection_config(payload[:connection])
|
77
|
+
|
76
78
|
{
|
77
79
|
"component" => COMPONENT_NAME,
|
78
80
|
"span.kind" => SPAN_KIND,
|
79
81
|
"db.instance" => db_instance,
|
80
82
|
"db.cached" => payload.fetch(:cached, false),
|
81
83
|
"db.type" => DB_TYPE,
|
82
|
-
"
|
83
|
-
"peer.address" => peer_address_tag(payload.fetch(:connection, false))
|
84
|
+
"peer.address" => peer_address_tag(db_config)
|
84
85
|
}.merge(db_statement(payload))
|
85
86
|
end
|
86
87
|
|
@@ -105,32 +106,36 @@ module ActiveRecord
|
|
105
106
|
sanitizer ? sanitizer.sanitize(sql) : sql
|
106
107
|
end
|
107
108
|
|
108
|
-
def peer_address_tag(
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
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
|
122
|
-
|
123
|
-
@peer_address_tag
|
109
|
+
def peer_address_tag(config)
|
110
|
+
@peer_address_tag ||= [
|
111
|
+
"#{config.fetch(:adapter)}://",
|
112
|
+
config[:username],
|
113
|
+
config[:host] && "@#{config[:host]}",
|
114
|
+
"/#{db_instance}"
|
115
|
+
].join
|
124
116
|
end
|
125
117
|
|
126
118
|
def db_instance
|
127
119
|
@db_instance ||= connection_config.fetch(:database)
|
128
120
|
end
|
129
121
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
122
|
+
# If a connection is passed in, pull the db config options hash from it. This connection
|
123
|
+
# is likely to be attached to the query/query client. Fall back to the application level
|
124
|
+
# config. This change will show writer vs reader/replica dbs in spans when it is determined
|
125
|
+
# at the query level.
|
126
|
+
def connection_config(connection = nil)
|
127
|
+
unless defined? @connection_config
|
128
|
+
if connection.raw_connection && connection.raw_connection.respond_to?(:query_options)
|
129
|
+
# you have a mysql client
|
130
|
+
@connection_config = connection.raw_connection.query_options
|
131
|
+
else
|
132
|
+
# Rails 6.2 will deprecate ActiveRecord::Base.connection_config
|
133
|
+
@connection_config = ActiveRecord::Base.try(:connection_db_config)&.configuration_hash ||
|
134
|
+
ActiveRecord::Base.connection_config
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
@connection_config
|
134
139
|
end
|
135
140
|
end
|
136
141
|
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
|
4
|
+
version: 0.6.0
|
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-07-
|
12
|
+
date: 2022-07-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -209,9 +209,9 @@ 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:
|
214
|
+
version: '0'
|
215
215
|
requirements: []
|
216
216
|
rubygems_version: 3.3.11
|
217
217
|
signing_key:
|