Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Distributed tracing: customizing trace id; tracing all requests

distributedtracing

#1

I am interested in tracing at least between-system boundaries of all distributed transactions. From what I can tell currently, only a random sample of transactions are traced. How can I modify the behavior?

Also, operations that go through our jobs system are not being tied together. How can I pick up the trace id and store it with the job, and then pick it up and apply it when the job is executed?


#2

Hey @ghowe the way you expand tracing may be different depending on the agent recording data, could you expand on the agents you are utilising at the moment?


#3

We use Rails, with background jobs using Sidekiq and Redis.

I am looking for:

  • how I can carry the trace through the background jobs that were triggered. It would suffice if there was a way for me to manually pick up the trace id, store it with the bg job data, and record the trace record myself (although something more automatic would obviously be preferred); and
  • 100% recording of HTTP requests in/out and bg job creation/execution. SQL executed would also be useful.

#4

@ghowe Thanks for following up with us. At this time, there’s not a way to configure the likelihood that a request will be traced.

You’d be able to manually trace Sidekiq by doing something along the lines of the following.

Where you create the job and call perform_async, create and pass in distributed tracing information:

payload = ::NewRelic::Agent::DistributedTracing.create_distributed_trace_payload
YourJobClass.perform_async(:your, :other, :parameters, payload.http_safe)

In your job class, direct the Ruby agent to record the incoming distributed trace information:

class YourJobClass
  def perform(some, awesome, parameters, payload)
    ::NewRelic::Agent::DistributedTracing.accept_distributed_trace_payload(payload)
  end
end

Let us know if you have any questions.