freddy 2.2.1 → 2.2.2

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: 9c7e04742f9d67bcdce9f6bf6335d4ff12a1ac684a6059cffaeee00e44002426
4
- data.tar.gz: 2bb02e320d0b0458a182105a82931f48681a27b4f995c789cd6e7a655f3b9251
3
+ metadata.gz: 445e69f7be1822b3d6f8703086134081d944758ca5013c1d0e24331ec0d3e6b3
4
+ data.tar.gz: 9d918d1713c809253187727bd4adfa84584171abc07921e97429a8f8381a4ab6
5
5
  SHA512:
6
- metadata.gz: 3666fe665db677115174ae5d3d864cf3f67beccad3b5d7832be9497cece4296c516086b62af4c1b90514a67c69663dd56d9238ea02903880b6c9b8fb0fa26859
7
- data.tar.gz: 14578870d95999f972b7638f0ad5a6d80ea3d326a0d1f565ea6a673bb9f9133a316b00f11506fec3ec6d13db94d157cbd70aea1023f20664d4532365dd3d8982
6
+ metadata.gz: b76ebf99d84beea8fdb5e6557f780ab5ef0932cc177329e5524da4cf2a073ef8376e42f2c127614a60bd97566d3e460541d1c6a3e1a8ebe6f915e008b51e2577
7
+ data.tar.gz: 618367f3bb21b08a68d914c6f011b128764730a3555c7a46bd610703df13547b81aa4f09bc075058168b91fa5e9a72206de49ea6442d7c6cc1ae95ccf7901570
@@ -25,7 +25,7 @@ class Freddy
25
25
  end
26
26
 
27
27
  def in_span(force_follows_from: false, &block)
28
- name = "#{@exchange}.#{@routing_key} receive"
28
+ name = "#{@exchange}.#{@routing_key} process"
29
29
  kind = OpenTelemetry::Trace::SpanKind::CONSUMER
30
30
  producer_context = OpenTelemetry.propagation.extract(@metadata[:headers] || {})
31
31
 
@@ -36,8 +36,9 @@ class Freddy
36
36
  links << OpenTelemetry::Trace::Link.new(producer_span_context) if producer_span_context.valid?
37
37
 
38
38
  root_span = Freddy.tracer.start_root_span(name, attributes: span_attributes, links: links, kind: kind)
39
+
39
40
  OpenTelemetry::Trace.with_span(root_span) do
40
- Freddy.tracer.in_span(name, attributes: span_attributes, links: links, kind: kind, &block)
41
+ block.call
41
42
  ensure
42
43
  root_span.finish
43
44
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Freddy
4
- VERSION = '2.2.1'
4
+ VERSION = '2.2.2'
5
5
  end
@@ -1,7 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Tracing' do
4
- let(:logger) { spy }
4
+ let(:exporter) { SPAN_EXPORTER }
5
+
6
+ before do
7
+ exporter.reset
8
+ end
5
9
 
6
10
  context 'when receiving a traced request' do
7
11
  let(:freddy) { Freddy.build(logger, config) }
@@ -128,6 +132,13 @@ describe 'Tracing' do
128
132
  end
129
133
  wait_for { @deliver_span }
130
134
 
135
+ expect(exporter.finished_spans.map(&:name))
136
+ .to match([
137
+ /\.\w+ send/,
138
+ 'test',
139
+ /freddy-topic\.\w+ process/
140
+ ])
141
+
131
142
  expect(@deliver_span.fetch(:trace_id)).not_to eq(initiator_span.fetch(:trace_id))
132
143
 
133
144
  link = @deliver_span.fetch(:links)[0]
data/spec/spec_helper.rb CHANGED
@@ -11,6 +11,13 @@ require 'freddy'
11
11
  require 'logger'
12
12
  require 'hamster/experimental/mutable_set'
13
13
 
14
+ SPAN_EXPORTER = OpenTelemetry::SDK::Trace::Export::InMemorySpanExporter.new
15
+ span_processor = OpenTelemetry::SDK::Trace::Export::SimpleSpanProcessor.new(SPAN_EXPORTER)
16
+
17
+ OpenTelemetry::SDK.configure do |c|
18
+ c.add_span_processor(span_processor)
19
+ end
20
+
14
21
  Thread.abort_on_exception = true
15
22
 
16
23
  RSpec.configure do |config|
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.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glia TechMovers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-15 00:00:00.000000000 Z
11
+ date: 2021-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler