opentelemetry-instrumentation-mongo 0.16.0 → 0.18.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 +29 -7
- data/README.md +13 -2
- data/lib/opentelemetry/instrumentation/mongo.rb +1 -0
- data/lib/opentelemetry/instrumentation/mongo/instrumentation.rb +3 -0
- data/lib/opentelemetry/instrumentation/mongo/subscriber.rb +17 -13
- data/lib/opentelemetry/instrumentation/mongo/version.rb +1 -1
- metadata +51 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24bf5fab8314c837b21a92ce2e00d248873f3ccaa6e77491bcac0e212a0c75e1
|
4
|
+
data.tar.gz: f09676d1b97f859520a814bfb4ecaee0b26da7584d4a809310a863fab5dcb47f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b47188d748b610b4296b2286acd93164f41d56b5462beee805c4347cc85613f997601df98472922405cbb8fe785315438700071ba3e0a06693680bced1d3731f
|
7
|
+
data.tar.gz: '0090d4aee3839e7938a25ecff4739a42bc6e6bcb6721799b427c53b1b3f75f4f89da6489d05e48dc2bd5937f4b66ecbd75b43462e8f4069fdbb77e82a0330f0e'
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,31 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-mongo
|
2
2
|
|
3
|
+
### v0.18.2 / 2021-08-12
|
4
|
+
|
5
|
+
* FIXED: Flakey mongo test
|
6
|
+
|
7
|
+
### v0.18.1 / 2021-06-23
|
8
|
+
|
9
|
+
* (No significant changes)
|
10
|
+
|
11
|
+
### v0.18.0 / 2021-05-21
|
12
|
+
|
13
|
+
* BREAKING CHANGE: Replace Time.now with Process.clock_gettime
|
14
|
+
|
15
|
+
* ADDED: Updated API depedency for 1.0.0.rc1
|
16
|
+
* FIXED: Replace Time.now with Process.clock_gettime
|
17
|
+
* FIXED: Mongodb test asserting error message
|
18
|
+
|
19
|
+
### v0.17.0 / 2021-04-22
|
20
|
+
|
21
|
+
* ADDED: Mongo instrumentation accepts peer service config attribute.
|
22
|
+
* FIXED: Fix Mongo instrumentation example.
|
23
|
+
* FIXED: Refactor propagators to add #fields
|
24
|
+
|
3
25
|
### v0.16.0 / 2021-03-17
|
4
26
|
|
5
|
-
* FIXED: Example scripts now reference local common lib
|
6
|
-
* DOCS: Replace Gitter with GitHub Discussions
|
27
|
+
* FIXED: Example scripts now reference local common lib
|
28
|
+
* DOCS: Replace Gitter with GitHub Discussions
|
7
29
|
|
8
30
|
### v0.15.0 / 2021-02-18
|
9
31
|
|
@@ -11,13 +33,13 @@
|
|
11
33
|
|
12
34
|
### v0.14.0 / 2021-02-03
|
13
35
|
|
14
|
-
* BREAKING CHANGE: Replace getter and setter callables and remove rack specific propagators
|
36
|
+
* BREAKING CHANGE: Replace getter and setter callables and remove rack specific propagators
|
15
37
|
|
16
|
-
* ADDED: Replace getter and setter callables and remove rack specific propagators
|
38
|
+
* ADDED: Replace getter and setter callables and remove rack specific propagators
|
17
39
|
|
18
40
|
### v0.13.0 / 2021-01-29
|
19
41
|
|
20
|
-
* FIXED: Mongo Instrumenter: Do not send nil attributes
|
42
|
+
* FIXED: Mongo Instrumenter: Do not send nil attributes
|
21
43
|
|
22
44
|
### v0.12.0 / 2020-12-24
|
23
45
|
|
@@ -25,7 +47,7 @@
|
|
25
47
|
|
26
48
|
### v0.11.0 / 2020-12-11
|
27
49
|
|
28
|
-
* FIXED: Copyright comments to not reference year
|
50
|
+
* FIXED: Copyright comments to not reference year
|
29
51
|
|
30
52
|
### v0.10.0 / 2020-12-03
|
31
53
|
|
@@ -33,4 +55,4 @@
|
|
33
55
|
|
34
56
|
### v0.9.0 / 2020-11-03
|
35
57
|
|
36
|
-
* Initial release of Mongo instrumenter (ported from Datadog)
|
58
|
+
* Initial release of Mongo instrumenter (ported from Datadog)
|
data/README.md
CHANGED
@@ -30,9 +30,19 @@ OpenTelemetry::SDK.configure do |c|
|
|
30
30
|
end
|
31
31
|
```
|
32
32
|
|
33
|
-
##
|
33
|
+
## Example
|
34
34
|
|
35
|
-
|
35
|
+
To run the example:
|
36
|
+
|
37
|
+
1. Start MongoDB using docker-compose
|
38
|
+
* `docker-compose up mongo`
|
39
|
+
2. In a separate terminal window, `cd` to the examples directory and install gems
|
40
|
+
* `cd example`
|
41
|
+
* `bundle install`
|
42
|
+
3. Run the sample client script
|
43
|
+
* `ruby mongo.rb`
|
44
|
+
|
45
|
+
This will run a few MongoDB commands, printing OpenTelemetry traces to the console as it goes.
|
36
46
|
|
37
47
|
## How can I get involved?
|
38
48
|
|
@@ -51,3 +61,4 @@ Apache 2.0 license. See [LICENSE][license-github] for more information.
|
|
51
61
|
[ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
|
52
62
|
[community-meetings]: https://github.com/open-telemetry/community#community-meetings
|
53
63
|
[discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
|
64
|
+
|
@@ -13,15 +13,30 @@ module OpenTelemetry
|
|
13
13
|
class Subscriber
|
14
14
|
THREAD_KEY = :__opentelemetry_mongo_spans__
|
15
15
|
|
16
|
-
def started(event)
|
16
|
+
def started(event) # rubocop:disable Metrics/AbcSize
|
17
17
|
# start a trace and store it in the current thread; using the `operation_id`
|
18
18
|
# is safe since it's a unique id used to link events together. Also only one
|
19
19
|
# thread is involved in this execution so thread-local storage should be safe. Reference:
|
20
20
|
# https://github.com/mongodb/mongo-ruby-driver/blob/master/lib/mongo/monitoring.rb#L70
|
21
21
|
# https://github.com/mongodb/mongo-ruby-driver/blob/master/lib/mongo/monitoring/publishable.rb#L38-L56
|
22
|
+
|
22
23
|
collection = get_collection(event.command)
|
23
|
-
|
24
|
+
|
25
|
+
attributes = {
|
26
|
+
'db.system' => 'mongodb',
|
27
|
+
'db.name' => event.database_name,
|
28
|
+
'db.operation' => event.command_name,
|
29
|
+
'net.peer.name' => event.address.host,
|
30
|
+
'net.peer.port' => event.address.port
|
31
|
+
}
|
32
|
+
|
33
|
+
config = Mongo::Instrumentation.instance.config
|
34
|
+
attributes['peer.service'] = config[:peer_service] if config[:peer_service]
|
35
|
+
# attributes['db.statement'] = CommandSerializer.new(event.command).serialize
|
36
|
+
attributes['db.statement'] = CommandSerializer.new(event.command).serialize if config[:db_statement] == :include
|
24
37
|
attributes['db.mongodb.collection'] = collection if collection
|
38
|
+
attributes.compact!
|
39
|
+
|
25
40
|
span = tracer.start_span(span_name(collection, event.command_name), attributes: attributes, kind: :client)
|
26
41
|
set_span(event, span)
|
27
42
|
end
|
@@ -63,17 +78,6 @@ module OpenTelemetry
|
|
63
78
|
"#{collection}.#{command_name}"
|
64
79
|
end
|
65
80
|
|
66
|
-
def build_attributes(event)
|
67
|
-
{
|
68
|
-
'db.system' => 'mongodb',
|
69
|
-
'db.name' => event.database_name,
|
70
|
-
'db.operation' => event.command_name,
|
71
|
-
'db.statement' => CommandSerializer.new(event.command).serialize,
|
72
|
-
'net.peer.name' => event.address.host,
|
73
|
-
'net.peer.port' => event.address.port
|
74
|
-
}.compact
|
75
|
-
end
|
76
|
-
|
77
81
|
def get_collection(command)
|
78
82
|
collection = command.values.first
|
79
83
|
collection if collection.is_a?(String)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentelemetry-instrumentation-mongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.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-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 1.0.0.rc3
|
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: 0.
|
26
|
+
version: 1.0.0.rc3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: opentelemetry-instrumentation-base
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.18.2
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.18.2
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: appraisal
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +100,42 @@ dependencies:
|
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
103
|
+
version: 1.0.0.rc1
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
110
|
+
version: 1.0.0.rc1
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry-byebug
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
97
139
|
- !ruby/object:Gem::Dependency
|
98
140
|
name: rspec-mocks
|
99
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -200,10 +242,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
200
242
|
licenses:
|
201
243
|
- Apache-2.0
|
202
244
|
metadata:
|
203
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-mongo/v0.
|
245
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-mongo/v0.18.2/file.CHANGELOG.html
|
204
246
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/instrumentation/mongo
|
205
247
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
206
|
-
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-mongo/v0.
|
248
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-mongo/v0.18.2
|
207
249
|
post_install_message:
|
208
250
|
rdoc_options: []
|
209
251
|
require_paths:
|
@@ -219,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
261
|
- !ruby/object:Gem::Version
|
220
262
|
version: '0'
|
221
263
|
requirements: []
|
222
|
-
rubygems_version: 3.1.
|
264
|
+
rubygems_version: 3.1.6
|
223
265
|
signing_key:
|
224
266
|
specification_version: 4
|
225
267
|
summary: Mongo instrumentation for the OpenTelemetry framework
|