microscope_tracer 0.1.0 → 0.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
  SHA1:
3
- metadata.gz: ac35cf249a2fc36e0eedffc63588da82a962268d
4
- data.tar.gz: 979f54c74c8df35bc27cc24eb9d1fef9c409d093
3
+ metadata.gz: 0513168a35953e75573826931f13ea725e1bb031
4
+ data.tar.gz: 199ff8b305362fb00214dad9456e42f771f2d0c9
5
5
  SHA512:
6
- metadata.gz: 0766b787e9b852ddcaf6056b7a8187be8951c8538cd907b09c5c0566ca2d6e353c9cebf4a3c0a781a3cdb03ceebb8e6713356cb3d83761c20b3112481291fede
7
- data.tar.gz: 1215c431b60dcafb944b88a770a6b1f1a24b3f81f5f4d5a47b1762d99ad8732bd21fdf7825138529b269a1e525f2b8947829385a7c2da9b03bec602c219e1930
6
+ metadata.gz: 316b085faa1c8794713baad2e80fd746f7309c4b0eccfe4862398cdbc8d980818cae1b85c05026c0c438c4dac6c69c484010cc46ca5d39c1cef1e24fefbd6f39
7
+ data.tar.gz: 21e25b771482e95a9b87eafea23d6ff088df6df93a905a29c305cb3747decd30eb0ffdc20ffe96256df00422fdb0e9eb7f448cf23b959ffe74ded1df7fa093ce
@@ -4,8 +4,8 @@ require 'microscope_tracer/trace_logger'
4
4
 
5
5
  module MicroscopeTracer
6
6
  class FaradayMiddleware < Faraday::Middleware
7
- def initialize(app,io=$stdout)
8
- @trace_logger = TraceLogger.new(io)
7
+ def initialize(app,service_name)
8
+ @trace_logger = TraceLogger.new(service_name)
9
9
  super(app)
10
10
  end
11
11
 
@@ -7,9 +7,9 @@ require 'microscope_tracer/trace_logger'
7
7
  module MicroscopeTracer
8
8
 
9
9
  class RackMiddleware
10
- def initialize(app,io = $stdout)
10
+ def initialize(app,service_name)
11
11
  @app = app
12
- @trace_logger = TraceLogger.new(io)
12
+ @trace_logger = TraceLogger.new(service_name)
13
13
  end
14
14
 
15
15
  def call(env)
@@ -1,7 +1,11 @@
1
1
  module MicroscopeTracer
2
2
  class TraceLogger
3
- def initialize(io)
4
- @io = io
3
+ def initialize(service_name)
4
+ @service_name = service_name
5
+
6
+ # hardcoded for now
7
+ @log_prefix = "MICROSCOPE: "
8
+ @io = $stdout
5
9
  end
6
10
 
7
11
  def log_server_start(span)
@@ -23,10 +27,10 @@ class TraceLogger
23
27
  end
24
28
 
25
29
  def log(type,span,extras={})
26
- fields = {type:type,traceId:span.trace_id,spanId:span.span_id,pspanId:span.parent_span_id}.merge(extras)
30
+ fields = {service:@service_name,type:type,traceId:span.trace_id,spanId:span.span_id,pspanId:span.parent_span_id}.merge(extras)
27
31
  line = fields.map{ |k,v| if v then "#{k}=\"#{v}\"" else nil end }.compact.join(" ")
28
32
 
29
- @io.puts(line)
33
+ @io.puts(@log_prefix + line)
30
34
  end
31
35
  end
32
36
  end
@@ -1,3 +1,3 @@
1
1
  module MicroscopeTracer
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: microscope_tracer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Hodgson