redis-stream 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/lib/redis/stream/client.rb +2 -1
- data/lib/redis/stream/version.rb +1 -1
- data/redis-stream.gemspec +1 -1
- metadata +4 -5
- data/lib/redis/stream/tracer/zipkin_tracer.rb +0 -75
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12a0fad9e74538a076401cd2dc1e27a58c75369d72eb179d8d03a4454141c3a7
|
4
|
+
data.tar.gz: 399575ac314cbc13e19d25ffb3970576598b7194395192571861b7a0f92a15b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d843bdd4be24eecf5eef0d0f326e3405c2f0e2829d4c545f8e4b13f7d2acf30fc3f8436a4bb010713e6c9e85217b4ddfdf5769cb98bbb05308e33102d09b8140
|
7
|
+
data.tar.gz: 53cca2ee28d14c21e0f3220d72f2d0fa9c241da2e5aac7f2015c69688637163a8132072be6cf20e878adfc7741fb05ee76b2a811f63f2cdf3804be97cf7944e8
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
redis-stream (0.4.
|
4
|
+
redis-stream (0.4.4)
|
5
5
|
moneta (~> 1.2)
|
6
6
|
multi_json (~> 1.14)
|
7
7
|
redis (= 4.1.3)
|
@@ -15,7 +15,7 @@ GEM
|
|
15
15
|
moneta (1.2.1)
|
16
16
|
multi_json (1.14.1)
|
17
17
|
opentracing (0.5.0)
|
18
|
-
rake (
|
18
|
+
rake (13.0.1)
|
19
19
|
redis (4.1.3)
|
20
20
|
zipkin (1.6.1)
|
21
21
|
json
|
@@ -28,7 +28,7 @@ PLATFORMS
|
|
28
28
|
DEPENDENCIES
|
29
29
|
bundler (~> 2.0)
|
30
30
|
minitest (~> 5.0)
|
31
|
-
rake (~>
|
31
|
+
rake (~> 13.0)
|
32
32
|
redis-stream!
|
33
33
|
|
34
34
|
BUNDLED WITH
|
data/lib/redis/stream/client.rb
CHANGED
@@ -219,7 +219,7 @@ class Redis
|
|
219
219
|
payload = nil
|
220
220
|
|
221
221
|
unless @cache.nil?
|
222
|
-
if options
|
222
|
+
if options.include?("cache_key")
|
223
223
|
cache_key = @cache.build_key(data)
|
224
224
|
if @cache.include?(cache_key)
|
225
225
|
if data && data.include?('from_cache') && data['from_cache'].eql?(0)
|
@@ -240,6 +240,7 @@ class Redis
|
|
240
240
|
|
241
241
|
end
|
242
242
|
else
|
243
|
+
@logger.info("#{@consumer_id} - fetching from cache with key #{cache_key}")
|
243
244
|
@cache[options["cache_key"]] = data
|
244
245
|
end
|
245
246
|
|
data/lib/redis/stream/version.rb
CHANGED
data/redis-stream.gemspec
CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.require_paths = ["lib"]
|
38
38
|
|
39
39
|
spec.add_development_dependency "bundler", "~> 2.0"
|
40
|
-
spec.add_development_dependency "rake", "~>
|
40
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
41
41
|
spec.add_development_dependency "minitest", "~> 5.0"
|
42
42
|
spec.add_dependency "redis", "4.1.3"
|
43
43
|
spec.add_dependency "moneta", "~> 1.2"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-stream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mehmet Celik
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02
|
11
|
+
date: 2020-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -133,7 +133,6 @@ files:
|
|
133
133
|
- lib/redis/stream/group.rb
|
134
134
|
- lib/redis/stream/inspect.rb
|
135
135
|
- lib/redis/stream/state.rb
|
136
|
-
- lib/redis/stream/tracer/zipkin_tracer.rb
|
137
136
|
- lib/redis/stream/type.rb
|
138
137
|
- lib/redis/stream/version.rb
|
139
138
|
- redis-stream.gemspec
|
@@ -1,75 +0,0 @@
|
|
1
|
-
require 'socket'
|
2
|
-
require 'zipkin-tracer'
|
3
|
-
|
4
|
-
module ZipkinTracer
|
5
|
-
class RedisStreamHandler
|
6
|
-
def initialize(stream, config = nil)
|
7
|
-
@stream = stream
|
8
|
-
|
9
|
-
@config = Config.new(nil, config)
|
10
|
-
@tracer = TracerFactory.new.tracer(@config) rescue nil
|
11
|
-
end
|
12
|
-
|
13
|
-
def trace(topic, span=nil)
|
14
|
-
if @tracer.nil? || @tracer.class.name.eql?("Trace::NullSender")
|
15
|
-
yield nil if block_given?
|
16
|
-
else
|
17
|
-
trace_id = trace_id_from_span(span)
|
18
|
-
TraceContainer.with_trace_id(trace_id) do
|
19
|
-
trace_id = trace_id.next_id unless span.nil?
|
20
|
-
@tracer.with_new_span(trace_id, topic) do |new_span|
|
21
|
-
new_span.kind = Trace::Span::Kind::CLIENT
|
22
|
-
new_span.record("Session")
|
23
|
-
new_span.record_tag('group', @stream.group)
|
24
|
-
new_span.record_tag('stream',@stream.stream)
|
25
|
-
new_span.record_tag('client', @stream.name)
|
26
|
-
|
27
|
-
yield new_span if block_given?
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
rescue Exception => e
|
32
|
-
@stream.logger.error(e.message)
|
33
|
-
return nil
|
34
|
-
end
|
35
|
-
|
36
|
-
def trace_error(msg, span = nil)
|
37
|
-
if @tracer.nil? || @tracer.class.name.eql?("Trace::NullSender")
|
38
|
-
yield nil if block_given?
|
39
|
-
else
|
40
|
-
span.record_tag(Trace::Span::Tag::ERROR, msg)
|
41
|
-
yield span if block_given?
|
42
|
-
end
|
43
|
-
rescue Exception => e
|
44
|
-
@stream.logger.error(e.message)
|
45
|
-
return nil
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
def trace_id_from_span(span=nil)
|
50
|
-
if span.nil?
|
51
|
-
span_id = TraceGenerator.new.generate_id
|
52
|
-
trace_id = TraceGenerator.new.generate_id_from_span_id(span_id)
|
53
|
-
parent_span_id = nil
|
54
|
-
sampled = false
|
55
|
-
flags = 0
|
56
|
-
shared = false
|
57
|
-
else
|
58
|
-
span_h = span.to_h
|
59
|
-
span_id = span_h[:id]
|
60
|
-
trace_id = span_h[:traceId]
|
61
|
-
parent_span_id = span_h[:parent_span_id]
|
62
|
-
sampled = false
|
63
|
-
flags = 0
|
64
|
-
shared = true
|
65
|
-
end
|
66
|
-
|
67
|
-
Trace::TraceId.new(trace_id, parent_span_id, span_id, sampled, flags, shared)
|
68
|
-
rescue Exception => e
|
69
|
-
@stream.logger.error(e.message)
|
70
|
-
return nil
|
71
|
-
end
|
72
|
-
|
73
|
-
|
74
|
-
end
|
75
|
-
end
|