andym

andym

Sending tracing data to datadog from an ecs container

hi everyone, i have an aws ecs fargate container running and i’m trying to send tracing information to datadog (i’m using phoenix + liveview). to do that i’m using the spandex library GitHub - spandex-project/spandex: A platform agnostic tracing library · GitHub along with the datadog adapter GitHub - spandex-project/spandex_datadog: A datadog adapter for the `spandex` library. · GitHub. i have also configured the sidecar container for datadog as per the documentation. the monitoring data from the datadog agent running on ecs reaches datadog just fine, however the custom tracing information from my application does not reach datadog. this is the configuration i have in my code

application.ex

    spandex_opts = [
      host: "localhost",
      port: 8126,
      batch_size: 10,
      sync_threshold: 100,
      http: HTTPoison
    ]
    children = [
      # Start the Telemetry supervisor
      {SpandexDatadog.ApiServer, spandex_opts},
      App.Telemetry,
      # Start the PubSub system
      {Phoenix.PubSub, name: App.PubSub},
      # Start the Endpoint (http/https)
      App.Endpoint
    ]

config.exs

config :app, app.Endpoint,
  url: [host: "localhost"],
  render_errors: [view: app.ErrorView, accepts: ~w(html json), layout: false],
  pubsub_server: app.PubSub,
  live_view: [signing_salt: "dyhFo42f"]

config :app, app.Tracer,
  service: :app,
  adapter: SpandexDatadog.Adapter,
  disabled?: false,
  env: "PROD"

Now in one of the controller i just have the following to make sure the data is going accross

MansionWeb.Tracer.start_trace("about_us")
MansionWeb.Tracer.update_span(service: :mansion, type: :web)
    app.Tracer.start_span("span1")
    app.Tracer.update_span(service: :app, type: :web)
    app.Tracer.finish_span()

    app.Tracer.finish_span()
    app.Tracer.finish_trace()

however this trace information never makes it to the actual datadog traces.

First Post!

imsoulfly

imsoulfly

Hello,

have you checked that the api_server.ex module was able to actually send the traces to the sidecar instance?
SpandexDatadog has an undocumented config setting called verbose? that allows some debugging of what the api_server is doing.
Here is the related code: github link

Last Post!

andym

andym

thanks everyone for your replies, i finally got it working, and i can see the traces now. if anyone else is facing a similar problem amongst other things it was primarily because of the phoenix spandex, it was causing some version conflicts and httppoison was missing.

Where Next?

Popular in Questions Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

Other popular topics Top

greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44139 214
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New

We're in Beta

About us Mission Statement