zipkin-ruby icon indicating copy to clipboard operation
zipkin-ruby copied to clipboard

got a NullSpan?

Open shuiiiiiimu opened this issue 9 years ago • 2 comments

here are my code,

use ZipkinTracer::RackHandler, {
  :service_name => 'demo',
  :service_port => '80',
  :sample_rate => 1,
  :log_tracing => true,
  :json_api_host => "http://localhost:9411/"
}
def get_repositories(_request, _call)
    project_id, query = _request.project_id, _request.q

    ZipkinTracer::TraceClient.local_component_span('local relay') do |ztc|
      ztc.record "relay.get_repositories"
      ztc.record_tag 'project_id', project_id
      ztc.record_tag 'query', query

      p ztc.inspect

      "result"
    end
  end

but, got a NullSpan

"#<ZipkinTracer::NullSpan:0x007f8eeb928750>"

How to solve it?

shuiiiiiimu avatar Sep 08 '16 13:09 shuiiiiiimu

Looks good to me. Maybe is a bug in the tracer. Let me take a look and come back to you later

jcarres-mdsol avatar Sep 09 '16 08:09 jcarres-mdsol

my app is base on sinatra framework

in app.rb ZipkinTracer::TraceClient.local_component_span that is ok, but not working inside the lib folder

Can provider a method like this?

def get_repositories(_request, _call)
  project_id, query = _request.project_id, _request.q

  ZipkinTracer::TraceClient.reconfig({
    :service_name => 'demo',
      :service_port => '80',
      :sample_rate => 1,
      :log_tracing => true,
      :json_api_host => "http://localhost:9411/"
  })

  ZipkinTracer::TraceClient.local_component_span('local relay') do |ztc|
    ztc.record "relay.get_repositories"
    ztc.record_tag 'project_id', project_id
    ztc.record_tag 'query', query

    p ztc.inspect

    "result"
  end
end

shuiiiiiimu avatar Sep 09 '16 10:09 shuiiiiiimu