opentelemetry-instrumentation-mongo 0.18.0 → 0.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fed739b4bc4c6475309644c78af588c0fc2be755c98d9fb6ecd686538a347e22
4
- data.tar.gz: efaaa9ab0b0f3cd40afa45fa04534065092dbc243e9fb55708b7fdd46c3a5974
3
+ metadata.gz: f44fe083e72ab40c586477c07982466d7d290fbfaac66da20bc0c3520248cd52
4
+ data.tar.gz: e4d06551813fe6b84b96e8ab3fe27c0d0606177a51f4d712c2b6c519187a6df5
5
5
  SHA512:
6
- metadata.gz: dc0fa3101397845df031962ba262071249f423abc925f9ec5f6cd9ae794403c6b526c31c0ce088732de1130772355204256e665d661a30731d33d7236794470a
7
- data.tar.gz: e4ae4d8668fe70ee4dd427178b847efd90a49fc96b7987fb3ae8a55131d28701d061a7cfc83a1c98908942cb358ea465065e0fa868b1fb0802516e54f6dcbc0a
6
+ metadata.gz: edfd4e5a11b8fe8c9bc676fadc28d0b612aae445f069dad6e1ab66a52f0c49bd12e21d324bc2cd2e6bbd0f83366f9486eca485e0f742cdb0a249aa4fa4b378f6
7
+ data.tar.gz: 42eab1ab30e08aa58b3108640158e304376e1a6882fcdf5238565bf2f4cb5d6a6e51d3f170d19c764ace4350c66cbcc216c7003e847d9b271c0c6c00ce533ff0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Release History: opentelemetry-instrumentation-mongo
2
2
 
3
+ ### v0.18.4 / 2021-12-02
4
+
5
+ * (No significant changes)
6
+
7
+ ### v0.18.3 / 2021-09-29
8
+
9
+ * (No significant changes)
10
+
11
+ ### v0.18.2 / 2021-08-12
12
+
13
+ * FIXED: Flakey mongo test
14
+
15
+ ### v0.18.1 / 2021-06-23
16
+
17
+ * (No significant changes)
18
+
3
19
  ### v0.18.0 / 2021-05-21
4
20
 
5
21
  * BREAKING CHANGE: Replace Time.now with Process.clock_gettime
@@ -25,6 +25,7 @@ module OpenTelemetry
25
25
  end
26
26
 
27
27
  option :peer_service, default: nil, validate: :string
28
+ option :db_statement, default: :include, validate: ->(opt) { %I[omit include].include?(opt) }
28
29
 
29
30
  private
30
31
 
@@ -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
- attributes = build_attributes(event)
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,21 +78,6 @@ module OpenTelemetry
63
78
  "#{collection}.#{command_name}"
64
79
  end
65
80
 
66
- def build_attributes(event)
67
- attrs = {
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
- }
75
- config = Mongo::Instrumentation.instance.config
76
- attrs['peer.service'] = config[:peer_service] if config[:peer_service]
77
- attrs.compact!
78
- attrs
79
- end
80
-
81
81
  def get_collection(command)
82
82
  collection = command.values.first
83
83
  collection if collection.is_a?(String)
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Mongo
10
- VERSION = '0.18.0'
10
+ VERSION = '0.18.4'
11
11
  end
12
12
  end
13
13
  end
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.18.0
4
+ version: 0.18.4
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-05-21 00:00:00.000000000 Z
11
+ date: 2021-12-02 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.0.rc1
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.0.rc1
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.18.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.18.0
40
+ version: 0.19.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: appraisal
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,42 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.0.0.rc1
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: 1.0.0.rc1
110
+ version: '1.0'
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'
111
139
  - !ruby/object:Gem::Dependency
112
140
  name: rspec-mocks
113
141
  requirement: !ruby/object:Gem::Requirement
@@ -214,10 +242,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
214
242
  licenses:
215
243
  - Apache-2.0
216
244
  metadata:
217
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-mongo/v0.18.0/file.CHANGELOG.html
245
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-mongo/v0.18.4/file.CHANGELOG.html
218
246
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/instrumentation/mongo
219
247
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
220
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-mongo/v0.18.0
248
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-mongo/v0.18.4
221
249
  post_install_message:
222
250
  rdoc_options: []
223
251
  require_paths: