hubstep 2.1.2 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hubstep/tracer.rb +39 -0
- data/lib/hubstep/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d172cddae9dfbe1db1be1dec6eaa5e8a034f75f
|
4
|
+
data.tar.gz: e5995cefaa791a0d5125c0889ad765caf52f6728
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3522d3e11684b7d0bb7339ac106b12760ab5d3736faf99692cfe73759b84b407547bf8abcb57da7110d4b509c4cd6ea89d6ffbe70b73c1bffad39cb1c13b1158
|
7
|
+
data.tar.gz: 83fd278795ff62b54bc274c8e1a7914b528963309d1a0cb83f5186265db90164daf2e2ab300f1f9337e70ec01c8e48743afd5188ccf29f0f20d222cd987010e1
|
data/lib/hubstep/tracer.rb
CHANGED
@@ -126,6 +126,32 @@ module HubStep
|
|
126
126
|
@tracer.flush if enabled?
|
127
127
|
end
|
128
128
|
|
129
|
+
# Inject a SpanContext into the given carrier
|
130
|
+
#
|
131
|
+
# span_context - A SpanContext
|
132
|
+
# format - A LightStep::Tracer format
|
133
|
+
# carrier - A Hash
|
134
|
+
#
|
135
|
+
# Example:
|
136
|
+
#
|
137
|
+
# tracer.span("request") do |span|
|
138
|
+
# carrier = {}
|
139
|
+
# tracer.inject(
|
140
|
+
# span.span_context,
|
141
|
+
# LightStep::Tracer::FORMAT_TEXT_MAP,
|
142
|
+
# carrier
|
143
|
+
# )
|
144
|
+
#
|
145
|
+
# client.request(data, headers: carrier)
|
146
|
+
# end
|
147
|
+
#
|
148
|
+
# Returns nil but mutates the carrier.
|
149
|
+
def inject(span_context, format, carrier)
|
150
|
+
return unless enabled?
|
151
|
+
|
152
|
+
@tracer.inject(span_context, format, carrier)
|
153
|
+
end
|
154
|
+
|
129
155
|
private
|
130
156
|
|
131
157
|
def default_transport
|
@@ -177,6 +203,10 @@ module HubStep
|
|
177
203
|
nil
|
178
204
|
end
|
179
205
|
|
206
|
+
def span_context
|
207
|
+
InertSpanContext.instance
|
208
|
+
end
|
209
|
+
|
180
210
|
def log(event: nil, timestamp: nil, **fields) # rubocop:disable Lint/UnusedMethodArgument
|
181
211
|
nil
|
182
212
|
end
|
@@ -184,6 +214,15 @@ module HubStep
|
|
184
214
|
def finish(end_time: nil)
|
185
215
|
end
|
186
216
|
end
|
217
|
+
|
218
|
+
# Mimics the interface and no-op behavior of LightStep::SpanContext. This
|
219
|
+
# is used when tracing is disabled.
|
220
|
+
class InertSpanContext
|
221
|
+
include Singleton
|
222
|
+
instance.freeze
|
223
|
+
|
224
|
+
attr_reader :id, :trace_id, :baggage
|
225
|
+
end
|
187
226
|
end
|
188
227
|
end
|
189
228
|
|
data/lib/hubstep/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hubstep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lightstep
|