Documentation
¶
Index ¶
- func ExtractTraceContext(r *http.Request) (traceID, spanID string)
- func FormatDuration(d time.Duration) string
- func InjectTraceHeaders(ctx context.Context, req *http.Request)
- func RequestMetadata(r *http.Request) map[string]any
- func ResponseMetadata(resp *http.Response, duration time.Duration) map[string]any
- func StatusCodeCategory(code int) string
- func TracingHTTPClient(spanName string) *http.Client
- func TracingMiddleware(client *opik.Client, traceName string) func(http.Handler) http.Handler
- type TracingRoundTripper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractTraceContext ¶
ExtractTraceContext extracts trace context from HTTP request headers. Returns the trace ID and span ID if present.
func FormatDuration ¶
FormatDuration formats a duration for display.
func InjectTraceHeaders ¶
InjectTraceHeaders adds trace context headers to an HTTP request. This can be used for distributed tracing across services.
func RequestMetadata ¶
RequestMetadata extracts common metadata from an HTTP request.
func ResponseMetadata ¶
ResponseMetadata creates metadata from an HTTP response.
func StatusCodeCategory ¶
StatusCodeCategory returns a category string for the status code.
func TracingHTTPClient ¶
TracingHTTPClient returns an http.Client with tracing enabled.
Types ¶
type TracingRoundTripper ¶
type TracingRoundTripper struct {
// contains filtered or unexported fields
}
TracingRoundTripper wraps an http.RoundTripper to automatically create spans for outgoing requests.
func NewTracingRoundTripper ¶
func NewTracingRoundTripper(transport http.RoundTripper, spanName string) *TracingRoundTripper
NewTracingRoundTripper creates a new TracingRoundTripper. If transport is nil, http.DefaultTransport is used.