activerecord-instrumentation 0.6.0.jhemphill3 → 0.6.1.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -2
- data/Gemfile.lock +1 -1
- data/lib/active_record/open_tracing/processor.rb +28 -20
- data/lib/active_record/open_tracing/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0c5d0d44e18ee992c3f8458ab3e4a8f6fe3738ce47cbb553224aec647901113
|
4
|
+
data.tar.gz: 73152d2108ae460ee4c4795b1e3b50e4af567cc8292469b0c02ee7b7f251046b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51ba7e18ebd147dd0ea8f80c50f675f8655f29bb77b360b95f1d1b94685c7c9d00f00a1ca5083055e21d48a520a73e8ff6d1228ac19dfc9032c9ac995911bd2e
|
7
|
+
data.tar.gz: c108734ef121ad092f5fe24b7a477a287c6cabc57ca956f407547eddf77e13d5663d1174c8f77960cfb28889d2f1bd9c390900531edd19f51c1c85f070487e56
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
-
## 0.6.
|
5
|
-
*
|
4
|
+
## 0.6.1.pre 09/07/2022
|
5
|
+
* Splat hash when passing method expecting keyword args
|
6
|
+
|
7
|
+
## 0.6.0 07/11/2022
|
8
|
+
* Improved pper address tag to reflect the current database when using the mysql adapter
|
6
9
|
|
7
10
|
## 0.5.2 01/24/2022
|
8
11
|
* Fixed query tagging for empty queries
|
data/Gemfile.lock
CHANGED
@@ -54,7 +54,7 @@ module ActiveRecord
|
|
54
54
|
|
55
55
|
if (exception = payload[:exception_object])
|
56
56
|
span.set_tag("error", true)
|
57
|
-
span.log_kv(exception_metadata(exception))
|
57
|
+
span.log_kv(**exception_metadata(exception))
|
58
58
|
end
|
59
59
|
|
60
60
|
span.finish(end_time: finish)
|
@@ -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
|
-
"peer.
|
83
|
-
"peer.address" => peer_address_tag
|
84
|
+
"peer.address" => peer_address_tag(db_config)
|
84
85
|
}.merge(db_statement(payload))
|
85
86
|
end
|
86
87
|
|
@@ -105,29 +106,36 @@ module ActiveRecord
|
|
105
106
|
sanitizer ? sanitizer.sanitize(sql) : sql
|
106
107
|
end
|
107
108
|
|
108
|
-
def
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
[
|
116
|
-
"#{connection_config.fetch(:adapter)}://",
|
117
|
-
connection_config[:username],
|
118
|
-
connection_config[:host] && "@#{connection_config[:host]}",
|
119
|
-
"/#{db_instance}"
|
120
|
-
].join
|
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
|
121
116
|
end
|
122
117
|
|
123
118
|
def db_instance
|
124
119
|
@db_instance ||= connection_config.fetch(:database)
|
125
120
|
end
|
126
121
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
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
|
131
139
|
end
|
132
140
|
end
|
133
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.
|
4
|
+
version: 0.6.1.pre
|
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-09-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -213,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
213
|
- !ruby/object:Gem::Version
|
214
214
|
version: 1.3.1
|
215
215
|
requirements: []
|
216
|
-
rubygems_version: 3.
|
216
|
+
rubygems_version: 3.1.6
|
217
217
|
signing_key:
|
218
218
|
specification_version: 4
|
219
219
|
summary: ActiveRecord OpenTracing intrumenter
|