freddy 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/publish.yml +22 -0
- data/README.md +4 -0
- data/lib/freddy/delivery.rb +1 -1
- data/lib/freddy/tracing.rb +11 -1
- data/lib/freddy/version.rb +1 -1
- data/spec/integration/tracing_spec.rb +8 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6be4b4b6d953f837c24d9c55f990e4e75872c13e6c11007d8f61ed335681faa2
|
4
|
+
data.tar.gz: 863042876b2ed673001cd53f296567ad91420864b96cbed5ed02fb6fd7820b22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 002f901659f670dc1561db4ddc97d10e5a9d9b689369897628f1844fa0ffc65f759493fe96bc7541f6b7c204427bb584133fa3b306e19752b133a42b1b077a52
|
7
|
+
data.tar.gz: d2383b11b79800aabf6a0f0fe52a51f900a12c5ebcf17e64be8ca5e31243bd183dadb662e17c14416b0ee3e7d5ad26cbe00e067f7c39b709133a019082358fe8
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: Publish Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
with:
|
14
|
+
fetch-depth: 2
|
15
|
+
|
16
|
+
|
17
|
+
- name: Release Gem
|
18
|
+
uses: discourse/publish-rubygems-action@b55d7b91b55e61752dc6cbc2972f8e16fe6c1a02
|
19
|
+
env:
|
20
|
+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
21
|
+
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
|
22
|
+
RELEASE_COMMAND: rake release
|
data/README.md
CHANGED
@@ -11,6 +11,10 @@ logger = Logger.new(STDOUT)
|
|
11
11
|
freddy = Freddy.build(logger, host: 'localhost', port: 5672, user: 'guest', pass: 'guest')
|
12
12
|
```
|
13
13
|
|
14
|
+
## Releasing a new version
|
15
|
+
|
16
|
+
A new version is created when a change is merged into the master branch that changes the version number in `freddy.gemspec`. A Github Action will create a tag for the version and push the `.gem` file to [rubygems.org](https://rubygems.org)
|
17
|
+
|
14
18
|
## Supported message queues
|
15
19
|
|
16
20
|
These message queues have been tested and are working with Freddy. Other queues can be added easily:
|
data/lib/freddy/delivery.rb
CHANGED
@@ -25,7 +25,7 @@ class Freddy
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def in_span(force_follows_from: false, &block)
|
28
|
-
name = "#{@exchange
|
28
|
+
name = "#{Tracing.span_destination(@exchange, @routing_key)} process"
|
29
29
|
kind = OpenTelemetry::Trace::SpanKind::CONSUMER
|
30
30
|
producer_context = OpenTelemetry.propagation.extract(@metadata[:headers] || {})
|
31
31
|
|
data/lib/freddy/tracing.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
class Freddy
|
4
4
|
module Tracing
|
5
|
+
RESPONSE_QUEUE_PREFIX = 'amq.gen-'
|
6
|
+
|
5
7
|
# NOTE: Make sure you finish the span youself.
|
6
8
|
def self.span_for_produce(exchange, routing_key, payload, correlation_id: nil, timeout_in_seconds: nil)
|
7
9
|
destination = exchange.name
|
@@ -23,12 +25,20 @@ class Freddy
|
|
23
25
|
end
|
24
26
|
|
25
27
|
Freddy.tracer.start_span(
|
26
|
-
"
|
28
|
+
"#{span_destination(destination, routing_key)} send",
|
27
29
|
kind: OpenTelemetry::Trace::SpanKind::PRODUCER,
|
28
30
|
attributes: attributes
|
29
31
|
)
|
30
32
|
end
|
31
33
|
|
34
|
+
def self.span_destination(destination, routing_key)
|
35
|
+
if routing_key.to_s.start_with?(RESPONSE_QUEUE_PREFIX)
|
36
|
+
"#{destination}.(response queue)"
|
37
|
+
else
|
38
|
+
"#{destination}.#{routing_key}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
32
42
|
def self.inject_tracing_information_to_properties!(properties)
|
33
43
|
properties[:headers] ||= {}
|
34
44
|
OpenTelemetry.propagation.inject(properties[:headers])
|
data/lib/freddy/version.rb
CHANGED
@@ -52,6 +52,14 @@ describe 'Tracing' do
|
|
52
52
|
expect(current_receiver.fetch(:span_id)).not_to be_nil
|
53
53
|
expect(current_receiver.fetch(:span_id)).not_to eq(trace_initiator.fetch(:span_id))
|
54
54
|
end
|
55
|
+
|
56
|
+
it 'replaces generated queue names with (response queue)' do
|
57
|
+
freddy.deliver_with_response(destination, {})
|
58
|
+
names = exporter.finished_spans.map(&:name)
|
59
|
+
|
60
|
+
expect(names.any? { |name| name.include?('amq.gen-') }).to eq(false)
|
61
|
+
expect(names.any? { |name| name.include?('(response queue)') }).to eq(true)
|
62
|
+
end
|
55
63
|
end
|
56
64
|
|
57
65
|
context 'when receiving a nested traced request' do
|
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.
|
4
|
+
version: 2.2.3
|
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-
|
11
|
+
date: 2021-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -130,6 +130,7 @@ extensions: []
|
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
132
|
- ".github/workflows/ci.yml"
|
133
|
+
- ".github/workflows/publish.yml"
|
133
134
|
- ".gitignore"
|
134
135
|
- ".rspec"
|
135
136
|
- ".rubocop.yml"
|
@@ -196,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
197
|
- !ruby/object:Gem::Version
|
197
198
|
version: '0'
|
198
199
|
requirements: []
|
199
|
-
rubygems_version: 3.
|
200
|
+
rubygems_version: 3.1.6
|
200
201
|
signing_key:
|
201
202
|
specification_version: 4
|
202
203
|
summary: API for inter-application messaging supporting acknowledgements and request-response
|