Skip to content

twirp-ecosystem/twirp-opentracing

Repository files navigation

OpenTracing Hooks for Twirp

CI

The ottwirp package creates an OpenTracing Twirp hook to use in your server. Derived from grpc-opentracing.

Installation

go get -u github.com/twirp-ecosystem/twirp-opentracing

Server-side usage example

Where you are instantiating your Twirp server:

var tracer opentracing.Tracer = ...

...

hooks := NewOpenTracingHooks(tracer)
service := haberdasherserver.New()
server := WithTraceContext(haberdasher.NewHaberdasherServer(service, hooks), tracer)
log.Fatal(http.ListenAndServe(":8080", server))

Client-side usage example

When instantiating your Twirp client:

var tracer opentracing.Tracer = ...

...

client := haberdasher.NewHaberdasherProtobufClient(url, NewTraceHTTPClient(http.DefaultClient, tracer))