Datadog tracing + Opencensus tracing
Opened this issue · 1 comments
LiHaoTan commented
Does Datadog tracing and Opencensus tracing work well together? For example, take the following code:
import (
"context"
"log"
datadog "github.com/DataDog/opencensus-go-exporter-datadog"
opencensustrace "go.opencensus.io/trace"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
)
func main() {
exporter, err := datadog.NewExporter(datadog.Options{Service: "my-app"})
if err != nil {
log.Fatal(err)
}
defer exporter.Stop()
opencensustrace.RegisterExporter(exporter)
opencensustrace.ApplyConfig(opencensustrace.Config{
DefaultSampler: opencensustrace.AlwaysSample(),
})
span, ctx := tracer.StartSpanFromContext(context.Background(), "/foo")
datadogSpan(ctx)
openCensusSpan(ctx)
span.Finish()
}
func datadogSpan(ctx context.Context) {
span, ctx := tracer.StartSpanFromContext(ctx, "datadogSpan")
defer span.Finish()
}
func openCensusSpan(ctx context.Context) {
ctx, span := opencensustrace.StartSpan(ctx, "opencensusSpan")
defer span.End()
}
Will the datadog span and opencensus span have the same trace id?
benjbaron commented
I have the opencensusSpan
that shows in Datadog under the /foo
resource but the datadogSpan
does not have a parent trace. I will relay this issue to https://github.com/DataDog/opencensus-go-exporter-datadog.