Closed zachdaniel closed 7 years ago
how should be type
passed in? because at the moment config :spandex
doesn't accept service type, should it be fetched from config :spandex, :datadog, services: []
? Docs are also not so clear whenever in services we should put application => type
or service => type
I would assume it should be service, no?
I'm 99% sure that we want to fetch it from the services config. We only have one application in datadog, but from what I can tell an application is like a whole new complete top level entity. With that in mind, we can clarify the documentation WRT to service creation. We can also add a wiki page specific to datadog to highlight how the configs and context added to spans map to the visual elements in APM, as that can be very confusing.
As for actually creating the services at startup, we do it but I honestly don't even know what creating the services in datadog does. Until spans are sent for it, they aren't shown anyway.
I'll try to get some more info from datadog slack channel then ;) Btw. do you mind explaining how does tracing works here? especially start & storage would be awesome. Sorry for trouble :beers:
Best, Leszek
No problem :)
The datadog adapter stores traces in the process dictionary (a sort of intentionally undocumented part of an erlang process). Its the same place that Logger.metadata is stored. It can be accessed via Process.put
and Process.get
. We store a stack of spans in stack
and whenever a span is completed, via Spandex.finish_span
(done for us by the decorator), we pop the span off of the list, notate the duration, and place that span in another list called spans
. Once we receive a finish_trace
we send those traces to the configured host.
so this also implies that if someone uses GenServer/Stage each handle_*
will be new trace, same with Flow
, makes sense :)
just in case I started working on this issue ;)
Currently the only thing that uses the configured defaults are the plugs, not the actual trace/span constructors. We should resolve that so that people using things like the
traced
decorator or manually constructing traces can take advantage of setting defaults.