mongo 2.23.0 → 2.23.1
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 +4 -4
- data/lib/mongo/tracing/open_telemetry/command_tracer.rb +27 -0
- data/lib/mongo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b68606a8f00dce7ebf543f9f5e266a485e4afcca05710f1d6d8782d53418372c
|
|
4
|
+
data.tar.gz: 6f5aa6fb136f59286f33f61885f163ccd3cb371c626d8a77c41f1edbb11b0351
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f7c4aacca1e8ca699ccc0db50096603bfc30967e54feb3312981cc6792bbb68722b190ea04e2ec727af3b4d304856fd9ad4f641290ecd085a13d6d9b04e53ec6
|
|
7
|
+
data.tar.gz: b31a21ca1f01ce8693a9b28b85e5a14dd38d869a0b0ffdd150273a6d5416b201e2e8c5c2c0183e6ffb39690ecb18fcc77aaf4349075f8dc389da8419de8043ed
|
|
@@ -21,6 +21,15 @@ module Mongo
|
|
|
21
21
|
#
|
|
22
22
|
# @api private
|
|
23
23
|
class CommandTracer
|
|
24
|
+
include Mongo::Monitoring::Event::Secure
|
|
25
|
+
|
|
26
|
+
# Commands for which a span MUST NOT be created. The OpenTelemetry spec
|
|
27
|
+
# requires drivers to skip command spans for sensitive commands listed in
|
|
28
|
+
# the Command Logging and Monitoring spec. We additionally skip hello /
|
|
29
|
+
# legacy hello in all forms — these are handshake/heartbeat traffic and
|
|
30
|
+
# would only add noise to traces.
|
|
31
|
+
HELLO_COMMANDS = %w[hello ismaster isMaster].freeze
|
|
32
|
+
|
|
24
33
|
# Initializes a new CommandTracer.
|
|
25
34
|
#
|
|
26
35
|
# @param otel_tracer [ OpenTelemetry::Trace::Tracer ] the OpenTelemetry tracer.
|
|
@@ -57,6 +66,8 @@ module Mongo
|
|
|
57
66
|
# @return [ Object ] the result of the command.
|
|
58
67
|
# rubocop:disable Lint/RescueException
|
|
59
68
|
def trace_command(message, _operation_context, connection)
|
|
69
|
+
return yield if skip_tracing?(message)
|
|
70
|
+
|
|
60
71
|
# Commands should always be nested under their operation span, not directly under
|
|
61
72
|
# the transaction span. Don't pass with_parent to use automatic parent resolution
|
|
62
73
|
# from the currently active span (the operation span).
|
|
@@ -76,6 +87,22 @@ module Mongo
|
|
|
76
87
|
|
|
77
88
|
private
|
|
78
89
|
|
|
90
|
+
# Determines whether the command must not be traced. Sensitive auth
|
|
91
|
+
# commands carry credentials in their payloads (SCRAM proofs, cleartext
|
|
92
|
+
# passwords, etc.) and the OpenTelemetry spec requires drivers to skip
|
|
93
|
+
# command spans for them. Hello / legacy hello are also skipped to keep
|
|
94
|
+
# handshake traffic out of traces.
|
|
95
|
+
#
|
|
96
|
+
# @param message [ Mongo::Protocol::Message ] the command message.
|
|
97
|
+
#
|
|
98
|
+
# @return [ Boolean ] true when no command span should be created.
|
|
99
|
+
def skip_tracing?(message)
|
|
100
|
+
name = command_name(message)
|
|
101
|
+
return true if HELLO_COMMANDS.include?(name)
|
|
102
|
+
|
|
103
|
+
sensitive?(command_name: name, document: message.documents.first)
|
|
104
|
+
end
|
|
105
|
+
|
|
79
106
|
# Creates a span for a command.
|
|
80
107
|
#
|
|
81
108
|
# @param message [ Mongo::Protocol::Message ] the command message.
|
data/lib/mongo/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mongo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.23.
|
|
4
|
+
version: 2.23.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- The MongoDB Ruby Team
|
|
@@ -559,7 +559,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
559
559
|
- !ruby/object:Gem::Version
|
|
560
560
|
version: '0'
|
|
561
561
|
requirements: []
|
|
562
|
-
rubygems_version: 4.0.
|
|
562
|
+
rubygems_version: 4.0.12
|
|
563
563
|
specification_version: 4
|
|
564
564
|
summary: Ruby driver for MongoDB
|
|
565
565
|
test_files: []
|