Skip to content

Commit 00ed560

Browse files
Merge branch 'main' into jruby-10
2 parents 68b7144 + 67743b2 commit 00ed560

File tree

6 files changed

+50
-4
lines changed

6 files changed

+50
-4
lines changed

instrumentation/dalli/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release History: opentelemetry-instrumentation-dalli
22

3+
### v0.27.3 / 2025-05-27
4+
5+
* FIXED: Compact Dalli attributes
6+
37
### v0.27.2 / 2025-04-30
48

59
* FIXED: Do not pollute the `OpenTelemetry::Instrumentation` namespace

instrumentation/dalli/lib/opentelemetry/instrumentation/dalli/patches/server.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ def request(op, *args) # rubocop:disable Naming/MethodParameterName
1515
attributes = {
1616
'db.system' => 'memcached',
1717
'db.operation' => operation,
18-
'net.peer.name' => hostname,
19-
'net.peer.port' => port
18+
'net.peer.name' => hostname
2019
}
20+
attributes['net.peer.port'] = port if port
21+
2122
if config[:db_statement] == :include
2223
attributes['db.statement'] = Utils.format_command(operation, args)
2324
elsif config[:db_statement] == :obfuscate

instrumentation/dalli/lib/opentelemetry/instrumentation/dalli/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
module OpenTelemetry
88
module Instrumentation
99
module Dalli
10-
VERSION = '0.27.2'
10+
VERSION = '0.27.3'
1111
end
1212
end
1313
end

instrumentation/dalli/test/opentelemetry/instrumentation/dalli/instrumentation_test.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,24 @@
142142
_(span.name).must_equal 'gat'
143143
_(span.attributes['db.statement']).must_equal 'gat foo 0'
144144
end
145+
146+
it 'supports unix domain socket' do
147+
dalli.version
148+
exporter.reset
149+
150+
server = dalli.instance_variable_get(:@ring).servers.first
151+
server.stub(:hostname, '/tmp/memcached.sock') do
152+
server.stub(:port, nil) do
153+
dalli.set('foo', 'bar')
154+
155+
puts exporter.finished_spans
156+
_(exporter.finished_spans.size).must_equal 1
157+
_(span.name).must_equal 'set'
158+
_(span.attributes).wont_include 'net.peer.port'
159+
_(span.attributes['net.peer.name']).must_equal '/tmp/memcached.sock'
160+
end
161+
end
162+
end
145163
end
146164
end
147165

instrumentation/rake/lib/opentelemetry/instrumentation/rake/patches/task.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ def tracer
2929
end
3030

3131
def force_flush
32-
OpenTelemetry.tracer_provider.force_flush if ::Rake.application.top_level_tasks.include?(name)
32+
top_level_task_names = ::Rake.application.top_level_tasks.map { |t| t.split('[').first }
33+
34+
if top_level_task_names.include?(name)
35+
OpenTelemetry.tracer_provider.force_flush
36+
end
3337
end
3438
end
3539
end

instrumentation/rake/test/opentelemetry/instrumentation/rake/patches/task_test.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,25 @@
5656
_(execute_span.parent_span_id).must_equal(invoke_span.span_id)
5757
end
5858

59+
describe 'with a task argument' do
60+
it 'should call force_flush on OpenTelemetry.tracer_provider' do
61+
mock = Minitest::Mock.new
62+
mock.expect(:force_flush, nil)
63+
mock.expect(:force_flush, nil)
64+
65+
Rake::Task.define_task("#{task_name}[:arg]")
66+
task_string = "#{task_name}[test_arg]"
67+
68+
Rake.application.instance_eval { @top_level_tasks = [task_string] }
69+
70+
OpenTelemetry.stub(:tracer_provider, mock) do
71+
Rake.application.invoke_task(task_string)
72+
end
73+
74+
mock.verify
75+
end
76+
end
77+
5978
describe 'with a prerequisite task' do
6079
before do
6180
Rake::Task.define_task(prerequisite_task_name)

0 commit comments

Comments
 (0)