lib/opencensus/trace.rb in opencensus-0.2.2 vs lib/opencensus/trace.rb in opencensus-0.3.0

- old
+ new

@@ -122,20 +122,22 @@ # the `in_span` method. # # Will throw an exception if there is no current SpanContext. # # @param [String] name Name of the span + # @param [Symbol] kind Kind of span. Defaults to unspecified. # @param [Sampler] sampler Span-scoped sampler. If not provided, # defaults to the trace configuration's default sampler. # # @return [SpanBuilder] A SpanBuilder object that you can use to # set span attributes and create children. # - def start_span name, skip_frames: 0, sampler: nil + def start_span name, kind: nil, skip_frames: 0, sampler: nil context = span_context raise "No currently active span context" unless context - span = context.start_span name, skip_frames: skip_frames + 1, + span = context.start_span name, kind: kind, + skip_frames: skip_frames + 1, sampler: sampler self.span_context = span.context span end @@ -149,14 +151,16 @@ # be finished automatically at the end of the block. Within the block, # the thread-local SpanContext will be updated so calls to `start_span` # will create subspans. # # @param [String] name Name of the span + # @param [Symbol] kind Kind of span. Defaults to unspecified. # @param [Sampler] sampler Span-scoped sampler. If not provided, # defaults to the trace configuration's default sampler. # - def in_span name, skip_frames: 0, sampler: nil - span = start_span name, skip_frames: skip_frames + 1, sampler: sampler + def in_span name, kind: nil, skip_frames: 0, sampler: nil + span = start_span name, kind: kind, skip_frames: skip_frames + 1, + sampler: sampler begin yield span ensure end_span span end