Tracer Version(s)
2.28.0
Ruby Version(s)
ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +PRISM [arm64-darwin24]
Relevent Library and Version(s)
dalli 5.0.0
Bug Report
Dalli 5.0.0 removed the binary protocol entirely, including the Dalli::Protocol::Binary class. The dalli integration's dalli_class method references this class for dalli >= 3.0.0, which causes a NameError at instrumentation time
:
https://github.com/DataDog/dd-trace-rb/blob/v2.28.0/lib/datadog/tracing/contrib/dalli/integration.rb#L33-L38
def self.dalli_class
if version >= DALLI_PROTOCOL_BINARY_VERSION
::Dalli::Protocol::Binary # Removed in dalli 5.0.0
else
::Dalli::Server
end
end
Dalli 5.0.0 removed the binary protocol and SASL authentication in petergoldstein/dalli#1064 (merged 2026-02-06). It now only supports the meta protocol (Dalli::Protocol::Meta). S
ee: https://github.com/petergoldstein/dalli/blob/main/5.0-Upgrade.md
Suggested Fixes
There are two possible approaches:
-
Full support (preferred): Update dalli_class to target Dalli::Protocol::Meta for dalli >= 5.0.0, since it replaces Dalli::Protocol::Binary as the class that implements the request method. The Instrumentation module pr
epends request, so this should work if the interface is compatible.
DALLI_META_ONLY_VERSION = Gem::Version.new('5.0.0')
def self.dalli_class
if version >= DALLI_META_ONLY_VERSION
::Dalli::Protocol::Meta
elsif version >= DALLI_PROTOCOL_BINARY_VERSION
::Dalli::Protocol::Binary
else
::Dalli::Server
end
end
-
Quick fix: Add a MAXIMUM_VERSION to compatible? to exclude dalli 5.0+ until full support is implemented. This would cause the integration to gracefully skip instrumentation rather than raising a NameError.
MINIMUM_VERSION = Gem::Version.new('2.0.0')
MAXIMUM_VERSION = Gem::Version.new('5.0.0')
def self.compatible?
super && version >= MINIMUM_VERSION && version < MAXIMUM_VERSION
end
Note: PR #5331 (automated dependency update) also bumps dalli to 5.0.0 in lockfiles and its CI is failing for the same reason.
Reproduction Code
# Gemfile
gem 'dalli', '~> 5.0.0'
gem 'datadog', '~> 2.28'
# reproduce.rb
require 'dalli'
require 'datadog'
puts "dalli version: #{Dalli::VERSION}"
puts "datadog version: #{Datadog::VERSION::STRING}"
puts "Dalli::Protocol::Binary defined? #{defined?(Dalli::Protocol::Binary) || 'no'}"
Datadog.configure do |c|
c.tracing.instrument :dalli
end
$ bundle exec ruby reproduce.rb
dalli version: 5.0.0
datadog version: 2.28.0
Dalli::Protocol::Binary defined? no
E, [...] ERROR -- datadog: [datadog] (...) Failed to apply Datadog::Tracing::Contrib::Dalli::Patcher patch.
Cause: uninitialized constant Dalli::Protocol::Binary
Location: .../datadog-2.28.0/lib/datadog/tracing/contrib/dalli/integration.rb:35:in
'Datadog::Tracing::Contrib::Dalli::Integration.dalli_class'
Configuration Block
No response
Error Logs
With DD_TRACE_DEBUG=true:
E, [2026-02-13T15:03:23.811996 #37394] ERROR -- datadog: [datadog] (.../gems/datadog-2.28.0/lib/datadog/tracing/contrib/patcher.rb:54:in 'Datadog::Tracing::Contrib::Patcher::CommonMethods#on_patch_error') Failed to apply Datadog::Tracing::Contrib::Dalli::Patcher patch. Cause: uninitialized constant Dalli::Protocol::Binary Location: .../gems/datadog-2.28.0/lib/datadog/tracing/contrib/dalli/integration.rb:35:in 'Datadog::Tracing::Contrib::Dalli::Integration.dalli_class'
No other dalli-related debug output is produced. The error is logged once during initialization and dalli instrumentation is silently skipped.
Operating System
Darwin FV3FYM96WW 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:45 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6030 arm64
How does Datadog help you?
No response
Tracer Version(s)
2.28.0
Ruby Version(s)
ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +PRISM [arm64-darwin24]
Relevent Library and Version(s)
dalli 5.0.0
Bug Report
Dalli 5.0.0 removed the binary protocol entirely, including the
Dalli::Protocol::Binaryclass. The dalli integration'sdalli_classmethod references this class for dalli >= 3.0.0, which causes aNameErrorat instrumentation time:
https://github.com/DataDog/dd-trace-rb/blob/v2.28.0/lib/datadog/tracing/contrib/dalli/integration.rb#L33-L38
Dalli 5.0.0 removed the binary protocol and SASL authentication in petergoldstein/dalli#1064 (merged 2026-02-06). It now only supports the meta protocol (
Dalli::Protocol::Meta). See: https://github.com/petergoldstein/dalli/blob/main/5.0-Upgrade.md
Suggested Fixes
There are two possible approaches:
Full support (preferred): Update
dalli_classto targetDalli::Protocol::Metafor dalli >= 5.0.0, since it replacesDalli::Protocol::Binaryas the class that implements therequestmethod. TheInstrumentationmodule prepends
request, so this should work if the interface is compatible.Quick fix: Add a
MAXIMUM_VERSIONtocompatible?to exclude dalli 5.0+ until full support is implemented. This would cause the integration to gracefully skip instrumentation rather than raising aNameError.Note: PR #5331 (automated dependency update) also bumps dalli to 5.0.0 in lockfiles and its CI is failing for the same reason.
Reproduction Code
Configuration Block
No response
Error Logs
With
DD_TRACE_DEBUG=true:No other dalli-related debug output is produced. The error is logged once during initialization and dalli instrumentation is silently skipped.
Operating System
Darwin FV3FYM96WW 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:45 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6030 arm64
How does Datadog help you?
No response