contrib/connectrpc.com/connect
Those integration are enabled by having the
following import in the project’s orchestrion.tool.go file:
import (
_ "github.com/DataDog/orchestrion"
_ "github.com/DataDog/dd-trace-go/contrib/connectrpc.com/connect/v2" // integration
//...
)Connect is an RPC framework built on Protocol Buffers and net/http.
Details & Caveats
- Clients generated by protoc-gen-connect-go v1.13.0 or later are instrumented through
connect.WithClientOptions. Versions v1.7.0 to v1.12.x emit that call only for methods with anidempotency_leveloption, and older versions never emit it. Directconnect.NewClientcalls need aconnect.WithClientOptions(...)argument, orconnecttrace.NewClientInterceptor()added manually. - Handler constructors called with explicit type arguments, such as
connect.NewUnaryHandler[Req, Res](...), are not matched: let Go infer the type arguments, or add the interceptor manually. - The interceptor is appended last, so it is the innermost one: RPCs rejected by earlier interceptors, or before the interceptor chain runs (for example while decoding a unary request), produce no server span.
- Handlers created by helper libraries such as
grpchealthandgrpcreflectare instrumented too.
Client
All of
- Call to
connect.WithClientOptions - Not
- Import path
connectrpc.com/connect
Replace the expression using the template:
// Using the following synthetic imports:
import (
connect "connectrpc.com/connect"
connecttrace "github.com/DataDog/dd-trace-go/contrib/connectrpc.com/connect/v2"
)connect.WithClientOptions({{ . }}, connect.WithInterceptors(connecttrace.NewClientInterceptor()))Handler
All of
- One of
- Call to
connect.NewUnaryHandler - Call to
connect.NewClientStreamHandler - Call to
connect.NewServerStreamHandler - Call to
connect.NewBidiStreamHandler - Call to
connect.NewUnaryHandlerSimple
- Not
- Import path
connectrpc.com/connect
Replace the expression using the template:
// Using the following synthetic imports:
import (
connect "connectrpc.com/connect"
connecttrace "github.com/DataDog/dd-trace-go/contrib/connectrpc.com/connect/v2"
){{- if .AST.Ellipsis -}}
{{ .AST.Fun }}({{ index .AST.Args 0 }}, {{ index .AST.Args 1 }}, connect.WithHandlerOptions({{ index .AST.Args 2 }}...), connect.WithInterceptors(connecttrace.NewServerInterceptor()))
{{- else -}}
{{ .AST.Fun }}({{ range .AST.Args }}{{ . }}, {{ end }}connect.WithInterceptors(connecttrace.NewServerInterceptor()))
{{- end -}}