datadog.NewExporter(datadog.Options{Service: "my-app"}) if err != nil { log.Fatal(err) } defer exporter.Stop() trace.RegisterExporter(exporter) // For demoing purposes, always sample. trace.ApplyConfig(trace.Config{ DefaultSampler: trace.AlwaysSample(), }) ctx, span := trace.StartSpan(context.Background(), "/foo") bar(ctx) span.End() } https://github.com/DataDog/opencensus-go-exporter-datadog/blob/master/examples/trace/main.go