spandex-project / spandex

A platform agnostic tracing library
MIT License
333 stars 53 forks source link

Tracing Broadway Processes #137

Closed samullen closed 2 years ago

samullen commented 2 years ago

We're slowly adding Spandex into our system, and it's worked great for most things. Thanks for that. We are, however, having difficulty getting it to work in conjunction with Broadway. I'm assuming it's a misunderstanding on my part.

The error we see in HoneyBadger is as follows:

Tried to start a trace over top of another trace: extend_cert.

It doesn't have a dump to go with it.

Our Broadway module looks something like this:

defmodule Background.ExtendCert do
  use Broadway
  use Spandex.Decorators

  alias TFSpandex.Tracer

  def start_link(_opts) do
    ...
  end

  @decorate trace(tracer: TFSpandex.Tracer, service: :some_service)
  def handle_message(:default, %Message{data: payload} = message, _context) do
    ...
  end

  @decorate span(tracer: TFSpandex.Tracer, service: :some_service)
  def some_func() do
    ...
  end
end

I've also tried using Tracer.start_trace, but came up with similar results.

I've also considered that DataDog may just not like tracing anything that doesn't have an HTTP request associated with it.

Thanks

samullen commented 2 years ago

Figured out what the problem. It's unrelated to the library. Sorry for troubling you.