Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 865 Bytes

README.md

File metadata and controls

26 lines (17 loc) · 865 Bytes

OpenTelemetry Hooks for Twirp

The oteltwirp package creates an OpenTelemetry Twirp hook to use in your server. Derived from twirp-opentracing and otelgrpc.

Installation

go get -u github.com/chengjiagan/twirp-opentelemetry

Server-side usage example

Where you are instantiating your Twirp server:

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

Client-side usage example

When instantiating your Twirp client:

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