Skip to content

Latest commit

 

History

History
36 lines (22 loc) · 916 Bytes

README.md

File metadata and controls

36 lines (22 loc) · 916 Bytes

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))