Installation
1
2
| go get gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer
go get gopkg.in/DataDog/dd-trace-go.v1/profiler
|
Start tracer
1
2
3
4
5
6
7
8
| // "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
tracer.Start(
tracer.WithHostname(os.Getenv("DD_AGENT_HOST")),
tracer.WithService("service-a"),
tracer.WithEnv("environment"),
)
defer tracer.Stop()
|
Setup Middleware
go-chi/chi
1
2
3
4
5
6
| // "github.com/go-chi/chi/v5"
// "github.com/go-chi/chi/v5/middleware"
// chitrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/go-chi/chi.v5"
r := chi.NewRouter()
r.Use(chitrace.Middleware(chitrace.WithServiceName("service-a")))
|
Start Datadog Agent
Datadog Agentでホストのアプリケーションをtraceする
References