ctxtrace

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 10 Imported by: 0

README

Istio Trace Propagation via GRPC Inceptors

Go Report Card go-doc

This project will inject the istio tracing headers (which are actually B3 headers) into the context and propgate it via interceptors.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractHTTPToContext

func ExtractHTTPToContext(ctx context.Context, r *http.Request) context.Context

ExtractHTTPToContext extracts metadata from a normal http request and adds it to the context

func InjectDataIntoOutMetadata

func InjectDataIntoOutMetadata(ctx context.Context, data TraceData) metadata.MD

InjectDataIntoOutMetadata injects the given trace data into metadata fit for an outgoing context

func NewOutgoingContextWithData

func NewOutgoingContextWithData(ctx context.Context) context.Context

NewOutgoingContextWithData creates a new context with the metadata added

func StreamClientInterceptor

func StreamClientInterceptor() grpc.StreamClientInterceptor

StreamClientInterceptor propagates any user information from the context

func StreamServerInterceptor

func StreamServerInterceptor() grpc.StreamServerInterceptor

StreamServerInterceptor for propagating client information only on the first request on the stream

func UnaryClientInterceptor

func UnaryClientInterceptor() grpc.UnaryClientInterceptor

UnaryClientInterceptor propagates any user information from the context

func UnaryServerInterceptor

func UnaryServerInterceptor() grpc.UnaryServerInterceptor

UnaryServerInterceptor for propagating client information

Types

type TraceData

type TraceData struct {
	RequestID string
	TraceSpan *model.SpanContext
}

TraceData is a simple struct to hold both the RequestID and the B3 TraceSpan

func Extract

func Extract(ctx context.Context) TraceData

Extract extracts metadata from the context.

func ExtractHTTP

func ExtractHTTP(r *http.Request) (TraceData, error)

ExtractHTTP extracts metadata from a normal http request

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL