dalli 5.0.2 → 5.0.3
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/CHANGELOG.md +20 -0
- data/README.md +14 -0
- data/lib/dalli/client.rb +3 -3
- data/lib/dalli/instrumentation.rb +12 -2
- data/lib/dalli/socket.rb +9 -4
- data/lib/dalli/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: e67adaead94f1a41b7ef5554434e3d88742bdf6f80d6c6a7a8552ce325e4e212
|
|
4
|
+
data.tar.gz: 51924b636e902895274ef517305e501a79c3480a440f0be83110eb17a7c88c25
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b36ce658adf751963219ac3a32b14680a19fdc029be2dfc575429d17e5efd6ef2dbf377610b3f3d05dc5a13824c4bb5df8477b94973e5d210f887743f6e3886a
|
|
7
|
+
data.tar.gz: db34b04265de2c8911aae1ce20618e01375b08d769b81d965fca64e3ddd2c358b8a69ed885a821de46fe9d46d4a8f83c98f60f776a52fe8443c28ca631cfa9c6
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
Dalli Changelog
|
|
2
2
|
=====================
|
|
3
3
|
|
|
4
|
+
Unreleased
|
|
5
|
+
==========
|
|
6
|
+
|
|
7
|
+
5.0.3
|
|
8
|
+
==========
|
|
9
|
+
|
|
10
|
+
Performance:
|
|
11
|
+
|
|
12
|
+
- Eliminate double array allocation in `Client#perform` (#1093)
|
|
13
|
+
- Changed method signature from `perform(*all_args)` with destructuring to `perform(op, key, *args)`, letting Ruby decompose arguments directly without intermediate array allocations
|
|
14
|
+
- Reduces benchmark time by ~39% across all Dalli operations (get, set, delete, etc.)
|
|
15
|
+
- Thanks to Sam Obeid for this contribution
|
|
16
|
+
|
|
17
|
+
Features:
|
|
18
|
+
|
|
19
|
+
- Support `connect_timeout:` keyword argument with `resolv-replace` >= 0.2.0, which now correctly forwards keyword arguments through its `TCPSocket` patch (#1096)
|
|
20
|
+
|
|
21
|
+
- Add `Dalli::Instrumentation.disable!` to allow disabling OpenTelemetry instrumentation at runtime (#1088)
|
|
22
|
+
- Also exposes `Dalli::Instrumentation.tracer=` for setting a custom tracer
|
|
23
|
+
|
|
4
24
|
5.0.2
|
|
5
25
|
==========
|
|
6
26
|
|
data/README.md
CHANGED
|
@@ -90,6 +90,20 @@ Exceptions are automatically recorded on spans with error status. When an operat
|
|
|
90
90
|
2. The span status is set to error with the exception message
|
|
91
91
|
3. The exception is re-raised to the caller
|
|
92
92
|
|
|
93
|
+
### Disabling Instrumentation
|
|
94
|
+
|
|
95
|
+
To disable instrumentation at runtime (e.g., in tests or specific environments):
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
Dalli::Instrumentation.disable!
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
You can also assign a custom tracer directly:
|
|
102
|
+
|
|
103
|
+
```ruby
|
|
104
|
+
Dalli::Instrumentation.tracer = my_custom_tracer
|
|
105
|
+
```
|
|
106
|
+
|
|
93
107
|
### Zero Overhead
|
|
94
108
|
|
|
95
109
|
When OpenTelemetry is not present, there is zero overhead - the tracing code checks once at startup and bypasses all instrumentation logic entirely when the SDK is not loaded.
|
data/lib/dalli/client.rb
CHANGED
|
@@ -650,11 +650,11 @@ module Dalli
|
|
|
650
650
|
# a particular memcached instance becomes unreachable, or the
|
|
651
651
|
# operation times out.
|
|
652
652
|
##
|
|
653
|
-
|
|
653
|
+
# rubocop:disable Naming/MethodParameterName
|
|
654
|
+
def perform(op, key, *args)
|
|
655
|
+
# rubocop:enable Naming/MethodParameterName
|
|
654
656
|
return yield if block_given?
|
|
655
657
|
|
|
656
|
-
op, key, *args = all_args
|
|
657
|
-
|
|
658
658
|
key = key.to_s
|
|
659
659
|
key = @key_manager.validate_key(key)
|
|
660
660
|
|
|
@@ -61,13 +61,14 @@ module Dalli
|
|
|
61
61
|
# Uses the library name 'dalli' and current Dalli::VERSION.
|
|
62
62
|
#
|
|
63
63
|
# @return [OpenTelemetry::Trace::Tracer, nil] the tracer or nil if OTel unavailable
|
|
64
|
-
# rubocop:disable ThreadSafety/ClassInstanceVariable
|
|
64
|
+
# rubocop:disable ThreadSafety/ClassInstanceVariable, ThreadSafety/ClassAndModuleAttributes
|
|
65
65
|
def tracer
|
|
66
66
|
return @tracer if defined?(@tracer)
|
|
67
67
|
|
|
68
68
|
@tracer = (OpenTelemetry.tracer_provider.tracer('dalli', Dalli::VERSION) if defined?(OpenTelemetry))
|
|
69
69
|
end
|
|
70
|
-
|
|
70
|
+
|
|
71
|
+
attr_writer :tracer
|
|
71
72
|
|
|
72
73
|
# Returns true if instrumentation is enabled (OpenTelemetry SDK is available).
|
|
73
74
|
#
|
|
@@ -76,6 +77,15 @@ module Dalli
|
|
|
76
77
|
!tracer.nil?
|
|
77
78
|
end
|
|
78
79
|
|
|
80
|
+
# Disable instrumentation.
|
|
81
|
+
#
|
|
82
|
+
# @return [nil]
|
|
83
|
+
def disable!
|
|
84
|
+
@tracer = nil
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# rubocop:enable ThreadSafety/ClassInstanceVariable, ThreadSafety/ClassAndModuleAttributes
|
|
88
|
+
|
|
79
89
|
# Wraps a block with a span if instrumentation is enabled.
|
|
80
90
|
#
|
|
81
91
|
# Creates a client span with the given name and attributes merged with
|
data/lib/dalli/socket.rb
CHANGED
|
@@ -106,14 +106,19 @@ module Dalli
|
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
# Detect and cache whether TCPSocket supports the connect_timeout: keyword argument.
|
|
109
|
-
# Returns
|
|
110
|
-
#
|
|
109
|
+
# Returns true for an unmodified TCPSocket on Ruby 3.0+, or for resolv-replace >= 0.2.0
|
|
110
|
+
# which forwards keyword arguments through its patch.
|
|
111
|
+
# Returns false when monkey-patched by gems like socksify or resolv-replace < 0.2.0.
|
|
111
112
|
# rubocop:disable ThreadSafety/ClassInstanceVariable
|
|
112
113
|
def self.supports_connect_timeout?
|
|
113
114
|
return @supports_connect_timeout if defined?(@supports_connect_timeout)
|
|
114
115
|
|
|
115
|
-
@supports_connect_timeout = RUBY_VERSION >= '3.0' &&
|
|
116
|
-
::TCPSocket.instance_method(:initialize).parameters
|
|
116
|
+
@supports_connect_timeout = RUBY_ENGINE == 'ruby' && RUBY_VERSION >= '3.0' &&
|
|
117
|
+
::TCPSocket.instance_method(:initialize).parameters.then do |params|
|
|
118
|
+
params == TCPSOCKET_NATIVE_PARAMETERS || params.any? do |type, _|
|
|
119
|
+
type == :keyrest
|
|
120
|
+
end
|
|
121
|
+
end
|
|
117
122
|
end
|
|
118
123
|
# rubocop:enable ThreadSafety/ClassInstanceVariable
|
|
119
124
|
|
data/lib/dalli/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dalli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.0.
|
|
4
|
+
version: 5.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter M. Goldstein
|
|
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
88
|
version: '0'
|
|
89
89
|
requirements: []
|
|
90
|
-
rubygems_version: 4.0.
|
|
90
|
+
rubygems_version: 4.0.10
|
|
91
91
|
specification_version: 4
|
|
92
92
|
summary: High performance memcached client for Ruby
|
|
93
93
|
test_files: []
|