hashicorp-demoapp / product-api-go

Products API written in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Jaeger instrumentation

DerekStrickland opened this issue · comments

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.

I believe this PR resolves this issue, right?