freddy 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49a24c63763b6d607d1b5ee60ca4f65211a212999ca5852637c6a567ed6b13d2
4
- data.tar.gz: da8e0b5d8818df0b054a66412c61b9b57f5648295b1a81f0e7f79b017cae66ba
3
+ metadata.gz: 5ccc6957f658f70ad21c03dbdd3a1477ae0e84cbb3c91c18b127fea5b02c2e67
4
+ data.tar.gz: d6f766526c1d60f8f324846cb92de6c284e3f22357545fc0590bba93ab8726e7
5
5
  SHA512:
6
- metadata.gz: 6323a6cb6f468a10c3395c318d3edb9f9de1de984b6f995786fceb17ca8b7a5b37adcc87649ade6caa7868da7671b09bf01d92365d9c46b9c0fa4b6a0a1e4db5
7
- data.tar.gz: c41436342bcb7523f236c4ecec8ba77c0d990fef21aaaff7e3ea9f56071e2797b84faa3266fb176e01d452c1d706e82825c673ac83ac1f4bb4d8ed94f59e5d3a
6
+ metadata.gz: 7b3a9b5de12182558c09cad3f029fec1ab221688a56c6473d6b7fe110d55ea3d0fcf6f31106798190f54ef4ba8a362928d82c983eca23c8a7b6c32cede406e18
7
+ data.tar.gz: 3f0e57546ad9671ec00381a4da2b12c2e574d4a2d807a9929d65d2f81887dd3318f94a7a3bc4a4a388b4745a9576ae3648acebe6ecd634b70a1d2e605a6072e1
@@ -35,12 +35,11 @@ class Freddy
35
35
  links = []
36
36
  links << OpenTelemetry::Trace::Link.new(producer_span_context) if producer_span_context.valid?
37
37
 
38
- # In general we should start a new trace here and just link two traces
39
- # together. But Zipkin (which we currently use) doesn't support links.
40
- # So even though the root trace could finish before anything here
41
- # starts executing, we'll continue with the root trace here as well.
42
- OpenTelemetry::Context.with_current(producer_context) do
38
+ root_span = Freddy.tracer.start_root_span(name, attributes: span_attributes, links: links, kind: kind)
39
+ OpenTelemetry::Trace.with_span(root_span) do
43
40
  Freddy.tracer.in_span(name, attributes: span_attributes, links: links, kind: kind, &block)
41
+ ensure
42
+ root_span.finish
44
43
  end
45
44
  else
46
45
  OpenTelemetry::Context.with_current(producer_context) do
@@ -60,7 +59,7 @@ class Freddy
60
59
  OpenTelemetry::SemanticConventions::Trace::MESSAGING_DESTINATION => @exchange,
61
60
  OpenTelemetry::SemanticConventions::Trace::MESSAGING_DESTINATION_KIND => destination_kind,
62
61
  OpenTelemetry::SemanticConventions::Trace::MESSAGING_RABBITMQ_ROUTING_KEY => @routing_key,
63
- OpenTelemetry::SemanticConventions::Trace::MESSAGING_OPERATION => 'receive'
62
+ OpenTelemetry::SemanticConventions::Trace::MESSAGING_OPERATION => 'process'
64
63
  }
65
64
 
66
65
  # There's no correlation_id when a message was sent using
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Freddy
4
- VERSION = '2.1.0'
4
+ VERSION = '2.2.0'
5
5
  end
@@ -106,11 +106,41 @@ describe 'Tracing' do
106
106
  end
107
107
  end
108
108
 
109
+ context 'when receiving a broadcast' do
110
+ let(:freddy) { Freddy.build(logger, config) }
111
+ let(:destination) { random_destination }
112
+
113
+ before do
114
+ freddy.tap_into(destination) do
115
+ @deliver_span = current_span_attributes
116
+ end
117
+ end
118
+
119
+ after do
120
+ freddy.close
121
+ end
122
+
123
+ it 'creates a new trace and links it with the sender' do
124
+ initiator_span = nil
125
+ Freddy.tracer.in_span('test') do
126
+ initiator_span = current_span_attributes
127
+ freddy.deliver(destination, {})
128
+ end
129
+ wait_for { @deliver_span }
130
+
131
+ expect(@deliver_span.fetch(:trace_id)).not_to eq(initiator_span.fetch(:trace_id))
132
+
133
+ link = @deliver_span.fetch(:links)[0]
134
+ expect(link.span_context.trace_id).to eq(initiator_span.fetch(:trace_id))
135
+ end
136
+ end
137
+
109
138
  def current_span_attributes
110
139
  {
111
140
  trace_id: current_span.context.trace_id,
112
141
  parent_id: current_span.parent_span_id,
113
- span_id: current_span.context.span_id
142
+ span_id: current_span.context.span_id,
143
+ links: current_span.links || []
114
144
  }
115
145
  end
116
146
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freddy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glia TechMovers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-07 00:00:00.000000000 Z
11
+ date: 2021-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -181,7 +181,7 @@ homepage: https://github.com/salemove/freddy
181
181
  licenses:
182
182
  - MIT
183
183
  metadata: {}
184
- post_install_message:
184
+ post_install_message:
185
185
  rdoc_options: []
186
186
  require_paths:
187
187
  - lib
@@ -196,8 +196,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
196
  - !ruby/object:Gem::Version
197
197
  version: '0'
198
198
  requirements: []
199
- rubygems_version: 3.1.4
200
- signing_key:
199
+ rubygems_version: 3.1.6
200
+ signing_key:
201
201
  specification_version: 4
202
202
  summary: API for inter-application messaging supporting acknowledgements and request-response
203
203
  test_files: