microscope_tracer 0.0.1 → 0.1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac35cf249a2fc36e0eedffc63588da82a962268d
|
4
|
+
data.tar.gz: 979f54c74c8df35bc27cc24eb9d1fef9c409d093
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0766b787e9b852ddcaf6056b7a8187be8951c8538cd907b09c5c0566ca2d6e353c9cebf4a3c0a781a3cdb03ceebb8e6713356cb3d83761c20b3112481291fede
|
7
|
+
data.tar.gz: 1215c431b60dcafb944b88a770a6b1f1a24b3f81f5f4d5a47b1762d99ad8732bd21fdf7825138529b269a1e525f2b8947829385a7c2da9b03bec602c219e1930
|
@@ -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,
|
8
|
-
@trace_logger = TraceLogger.new(
|
7
|
+
def initialize(app,io=$stdout)
|
8
|
+
@trace_logger = TraceLogger.new(io)
|
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,
|
10
|
+
def initialize(app,io = $stdout)
|
11
11
|
@app = app
|
12
|
-
@trace_logger = TraceLogger.new(
|
12
|
+
@trace_logger = TraceLogger.new(io)
|
13
13
|
end
|
14
14
|
|
15
15
|
def call(env)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module MicroscopeTracer
|
2
2
|
class TraceLogger
|
3
|
-
def initialize(
|
4
|
-
@
|
3
|
+
def initialize(io)
|
4
|
+
@io = io
|
5
5
|
end
|
6
6
|
|
7
7
|
def log_server_start(span)
|
@@ -25,7 +25,8 @@ class TraceLogger
|
|
25
25
|
def log(type,span,extras={})
|
26
26
|
fields = {type:type,traceId:span.trace_id,spanId:span.span_id,pspanId:span.parent_span_id}.merge(extras)
|
27
27
|
line = fields.map{ |k,v| if v then "#{k}=\"#{v}\"" else nil end }.compact.join(" ")
|
28
|
-
|
28
|
+
|
29
|
+
@io.puts(line)
|
29
30
|
end
|
30
31
|
end
|
31
32
|
end
|