hashicorp-demoapp / product-api-go

Products API written in Go
Mozilla Public License 2.0
41 stars 26 forks source link

Add Jaeger instrumentation #7

Open DerekStrickland opened 3 years ago

DerekStrickland commented 3 years ago

The API needs to be instrumented with Jaeger.

First, a function will be added to initialize a GlobalTracer. The function will be called on startup and the configured tracer will be available as a singleton via the opentracing.GlobalTracer() accessor function.

Next, a tracerMiddleware function, similar to the isAuthorizedMiddleware function, will be added and all HTTP handlers will add this function to the middleware chain. The function will wrap each HTTP call in a span that will be captured by Jaeger.

Additionally, the HTTP client will be modified so that all client requests add the jaeger-debug-id header which should allow for tracing across tiers. Consumers of the HTTP client will need to be updated, and will also need to initialize a GlobalTracer on startup.

im2nguyen commented 1 year ago

I believe this PR resolves this issue, right?