|
11 | 11 | 'bus_class_proxy' => 'QueueBus::Driver' |
12 | 12 | } |
13 | 13 | end |
| 14 | + let(:tracer) { Datadog::Tracing } |
14 | 15 |
|
15 | 16 | it 'uses the class_proxy_class as the resource name' do |
16 | | - expect(Datadog.tracer) |
| 17 | + expect(tracer) |
17 | 18 | .to receive(:trace) |
18 | 19 | .with('queue-bus.worker', hash_including(resource: 'QueueBus::Driver')) |
19 | 20 | subject.call(attrs) |
|
27 | 28 | end |
28 | 29 |
|
29 | 30 | it 'sends the service name' do |
30 | | - expect(Datadog.tracer) |
| 31 | + expect(tracer) |
31 | 32 | .to receive(:trace) |
32 | 33 | .with('queue-bus.worker', hash_including(service: name)) |
33 | 34 | subject.call(attrs) |
|
40 | 41 | end |
41 | 42 |
|
42 | 43 | it 'includes the event in the resource' do |
43 | | - expect(Datadog.tracer) |
| 44 | + expect(tracer) |
44 | 45 | .to receive(:trace) |
45 | 46 | .with('queue-bus.worker', |
46 | 47 | hash_including(resource: a_string_matching(/event=my_event/))) |
|
54 | 55 | end |
55 | 56 |
|
56 | 57 | it 'includes the sub key in the resource name' do |
57 | | - expect(Datadog.tracer) |
| 58 | + expect(tracer) |
58 | 59 | .to receive(:trace) |
59 | 60 | .with('queue-bus.worker', |
60 | 61 | hash_including(resource: a_string_matching(/sub=my_subscription/))) |
|
69 | 70 |
|
70 | 71 | it 'includes all attributes that start with bus_' do |
71 | 72 | span = spy('span') |
72 | | - expect(Datadog.tracer).to receive(:trace).and_yield(span) |
| 73 | + expect(tracer).to receive(:trace).and_yield(span) |
73 | 74 | subject.call(attrs) |
74 | 75 | expect(span).to have_received(:set_tag).with('queue-bus.bus_class_proxy', 'QueueBus::Driver') |
75 | 76 | expect(span).to have_received(:set_tag).with('queue-bus.bus_field', 'my_field') |
|
83 | 84 |
|
84 | 85 | it 'includes all attributes that start with bus_' do |
85 | 86 | span = spy('span') |
86 | | - expect(Datadog.tracer).to receive(:trace).and_yield(span) |
| 87 | + expect(tracer).to receive(:trace).and_yield(span) |
87 | 88 | subject.call(attrs) |
88 | 89 | expect(span).to have_received(:set_tag).with('queue-bus.bus_class_proxy', 'QueueBus::Driver') |
89 | 90 | expect(span).not_to have_received(:set_tag).with('queue-bus.user_id', 1234) |
|
0 commit comments