The oteltwirp
package creates an OpenTelemetry Twirp hook to use in your server. Derived from twirp-opentracing and otelgrpc.
go get -u github.com/qonto/oteltwirp
Where you are instantiating your Twirp server:
import (
"github.com/qonto/oteltwirp"
...
)
hooks := oteltwirp.NewOpenTelemetryHooks()
service := haberdasherserver.New()
server := WithTraceContext(haberdasher.NewHaberdasherServer(service, hooks))
log.Fatal(http.ListenAndServe(":8080", server))
When instantiating your Twirp client:
client := haberdasher.NewHaberdasherProtobufClient(url, oteltwirp.NewTraceHTTPClient(http.DefaultClient))