title: APM Tracing with Datadog in Go
body: <p>I have built a demo REST API in Go with MongoDB as the datastore, with Gin as the HTTP framework. I have followed all of the instructions on the Datadog website, however, am getting traces with little to no information. All that is traced is <code>http.request</code>. On the Datadog blog there is a screenshot with a Go trace (see below).<a href="https://i.stack.imgur.com/BiK49.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BiK49.png" alt="Datadog Example" /></a></p>
  <p>Here is what I'm seeing - there is no trace of the MongoDB Query performed in the request.</p>
  <p><a href="https://i.stack.imgur.com/6Im7n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6Im7n.png" alt="Sample Trace" /></a></p>
  <p>Is there some other configuration or manual reporting that I have to do?</p>
  <p>I am initiating the Datadog tracer with the following in my main function:</p>
  <pre><code>rules := []tracer.SamplingRule{tracer.RateRule(1)}
  
  tracer.Start(
      tracer.WithSamplingRules(rules),
      tracer.WithService(&quot;Go Mongo&quot;),
      tracer.WithEnv(&quot;dev&quot;),
  )
  
  defer tracer.Stop()
  </code></pre>
  <p>Full code is available at: <a href="https://github.com/NG235/go-mongo" rel="nofollow noreferrer">https://github.com/NG235/go-mongo</a></p>
  <p>Thanks.</p>