opentelemetry-instrumentation-active_record 0.1.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +1 -1
- data/lib/opentelemetry/instrumentation/active_record/instrumentation.rb +9 -1
- data/lib/opentelemetry/instrumentation/active_record/patches/persistence_class_methods.rb +0 -6
- data/lib/opentelemetry/instrumentation/active_record/patches/relation_persistence.rb +34 -0
- data/lib/opentelemetry/instrumentation/active_record/version.rb +1 -1
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f45fc126930cb5135a9ab42d14cf285050c7e9b207c8d584c098848100dfd68
|
4
|
+
data.tar.gz: cb43858ecd8428af9ebc579298047087e1987c7d5d86ffa87027739732a0ef64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 350d5b0dd98032a79ba02784e5f670d75944a6ee5f715220929c4bb06f176e1a3e8cf2c39493917814a4156b95acb055e333a19120e87dba0b3d8ca35b0a0a7a
|
7
|
+
data.tar.gz: 8e575d88192b7e9399bf194cd0e2b4cc3463e9302dfa1195c218a928ee1149ef47db99d8738e8a993703955bdeea5bab372d66d91c8949448f29da98bd9a42dc
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-active_record
|
2
2
|
|
3
|
+
### v0.2.2 / 2021-12-01
|
4
|
+
|
5
|
+
* FIXED: Add max supported version for active record
|
6
|
+
|
7
|
+
### v0.2.1 / 2021-09-29
|
8
|
+
|
9
|
+
* (No significant changes)
|
10
|
+
|
11
|
+
### v0.2.0 / 2021-09-29
|
12
|
+
|
13
|
+
* ADDED: Trace update_all and delete_all calls in ActiveRecord
|
14
|
+
* FIXED: Remove Active Record instantiation patch
|
15
|
+
|
16
|
+
### v0.1.1 / 2021-08-12
|
17
|
+
|
18
|
+
* (No significant changes)
|
19
|
+
|
3
20
|
### v0.1.0 / 2021-07-08
|
4
21
|
|
5
22
|
* Initial release, adds instrumentation patches to querying and persistence methods.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# OpenTelemetry ActiveRecord Instrumentation
|
2
2
|
|
3
|
-
|
3
|
+
The Active Record instrumentation is a community-maintained instrumentation for the Active Record portion of the [Ruby on Rails][rails-home] web-application framework.
|
4
4
|
|
5
5
|
## How do I get started?
|
6
6
|
|
@@ -10,6 +10,7 @@ module OpenTelemetry
|
|
10
10
|
# The Instrumentation class contains logic to detect and install the ActiveRecord instrumentation
|
11
11
|
class Instrumentation < OpenTelemetry::Instrumentation::Base
|
12
12
|
MINIMUM_VERSION = Gem::Version.new('5.2.0')
|
13
|
+
MAX_MAJOR_VERSION = 6
|
13
14
|
|
14
15
|
install do |_config|
|
15
16
|
require_dependencies
|
@@ -21,7 +22,11 @@ module OpenTelemetry
|
|
21
22
|
end
|
22
23
|
|
23
24
|
compatible do
|
24
|
-
|
25
|
+
# We know that releases after MAX_MAJOR_VERSION are unstable so we
|
26
|
+
# check the major version number of the gem installed to make sure we
|
27
|
+
# do not install on a pre-release or full release of the latest
|
28
|
+
# if it exceeds the MAX_MAJOR_VERSION version.
|
29
|
+
gem_version >= MINIMUM_VERSION && gem_version.segments[0] <= MAX_MAJOR_VERSION
|
25
30
|
end
|
26
31
|
|
27
32
|
private
|
@@ -50,6 +55,8 @@ module OpenTelemetry
|
|
50
55
|
::ActiveRecord::Base.prepend(Patches::PersistenceInsertClassMethods) if insert_class_methods_supported?
|
51
56
|
::ActiveRecord::Base.prepend(Patches::TransactionsClassMethods)
|
52
57
|
::ActiveRecord::Base.prepend(Patches::Validations)
|
58
|
+
|
59
|
+
::ActiveRecord::Relation.prepend(Patches::RelationPersistence)
|
53
60
|
end
|
54
61
|
|
55
62
|
def require_dependencies
|
@@ -59,6 +66,7 @@ module OpenTelemetry
|
|
59
66
|
require_relative 'patches/persistence_insert_class_methods' if insert_class_methods_supported?
|
60
67
|
require_relative 'patches/transactions_class_methods'
|
61
68
|
require_relative 'patches/validations'
|
69
|
+
require_relative 'patches/relation_persistence'
|
62
70
|
end
|
63
71
|
end
|
64
72
|
end
|
@@ -30,12 +30,6 @@ module OpenTelemetry
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
def instantiate(attributes, column_types = {}, &block)
|
34
|
-
tracer.in_span("#{self}.instantiate") do
|
35
|
-
super
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
33
|
def update(id = :all, attributes) # rubocop:disable Style/OptionalArguments
|
40
34
|
tracer.in_span("#{self}.update") do
|
41
35
|
super
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
|
+
#
|
5
|
+
# SPDX-License-Identifier: Apache-2.0
|
6
|
+
|
7
|
+
module OpenTelemetry
|
8
|
+
module Instrumentation
|
9
|
+
module ActiveRecord
|
10
|
+
module Patches
|
11
|
+
# Module to prepend to ActiveRecord::Relation for instrumentation
|
12
|
+
module RelationPersistence
|
13
|
+
def update_all(*)
|
14
|
+
tracer.in_span("#{model.name}.update_all") do
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def delete_all(*)
|
20
|
+
tracer.in_span("#{model.name}.delete_all") do
|
21
|
+
super
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def tracer
|
28
|
+
ActiveRecord::Instrumentation.instance.tracer
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentelemetry-instrumentation-active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenTelemetry Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.0
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: opentelemetry-instrumentation-base
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.19.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.19.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activerecord
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,16 +98,16 @@ dependencies:
|
|
98
98
|
name: opentelemetry-sdk
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
103
|
+
version: '1.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
110
|
+
version: '1.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rake
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -211,6 +211,7 @@ files:
|
|
211
211
|
- lib/opentelemetry/instrumentation/active_record/patches/persistence_class_methods.rb
|
212
212
|
- lib/opentelemetry/instrumentation/active_record/patches/persistence_insert_class_methods.rb
|
213
213
|
- lib/opentelemetry/instrumentation/active_record/patches/querying.rb
|
214
|
+
- lib/opentelemetry/instrumentation/active_record/patches/relation_persistence.rb
|
214
215
|
- lib/opentelemetry/instrumentation/active_record/patches/transactions_class_methods.rb
|
215
216
|
- lib/opentelemetry/instrumentation/active_record/patches/validations.rb
|
216
217
|
- lib/opentelemetry/instrumentation/active_record/version.rb
|
@@ -218,10 +219,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
218
219
|
licenses:
|
219
220
|
- Apache-2.0
|
220
221
|
metadata:
|
221
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-active_record/v0.
|
222
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-active_record/v0.2.2/file.CHANGELOG.html
|
222
223
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/instrumentation/active_record
|
223
224
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
224
|
-
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-active_record/v0.
|
225
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-active_record/v0.2.2
|
225
226
|
post_install_message:
|
226
227
|
rdoc_options: []
|
227
228
|
require_paths:
|