correlation

package
v0.0.0-...-ee4996f Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 14

Documentation

Index

Constants

View Source
const (
	// RequestIDHeaderKey missing godoc
	RequestIDHeaderKey = "x-request-id"

	// TraceIDHeaderKey missing godoc
	TraceIDHeaderKey = "x-b3-traceid"

	// SpanIDHeaderKey missing godoc
	SpanIDHeaderKey = "x-b3-spanid"

	// ParentSpanIDHeaderKey missing godoc
	ParentSpanIDHeaderKey = "x-b3-parentspanid"
)
View Source
const HeadersContextKey contextKey = "CorrelationHeaders"

HeadersContextKey missing godoc

Variables

This section is empty.

Functions

func AddCorrelationIDsToContext

func AddCorrelationIDsToContext(ctx context.Context, correlationID, traceID, spanID, parentSpanID string) context.Context

AddCorrelationIDsToContext add all correlation IDs to the context

func AttachCorrelationIDToContext

func AttachCorrelationIDToContext() func(next http.Handler) http.Handler

AttachCorrelationIDToContext returns middleware that attaches all headers used for tracing in the current request.

func CorrelationIDForRequest

func CorrelationIDForRequest(request *http.Request) string

CorrelationIDForRequest returns the correlation ID for the current request

func CorrelationIDFromContext

func CorrelationIDFromContext(ctx context.Context) string

CorrelationIDFromContext returns correlation ID from the given context

func ParentSpanIDForRequest

func ParentSpanIDForRequest(request *http.Request) string

ParentSpanIDForRequest returns the parent span ID for the current request

func ParentSpanIDFromContext

func ParentSpanIDFromContext(ctx context.Context) string

ParentSpanIDFromContext returns parent span ID from the given context

func SaveCorrelationKeyValuePairToContext

func SaveCorrelationKeyValuePairToContext(ctx context.Context, key, value string) context.Context

SaveCorrelationKeyValuePairToContext saves the provided correlation key/value pair in the specified context

func SaveToContext

func SaveToContext(ctx context.Context, headers Headers) context.Context

SaveToContext saves the provided headers as correlation ID headers in the specified context

func SpanIDForRequest

func SpanIDForRequest(request *http.Request) string

SpanIDForRequest returns the span ID for the current request

func SpanIDFromContext

func SpanIDFromContext(ctx context.Context) string

SpanIDFromContext returns span ID from the given context

func TraceIDForRequest

func TraceIDForRequest(request *http.Request) string

TraceIDForRequest returns the trace ID for the current request

func TraceIDFromContext

func TraceIDFromContext(ctx context.Context) string

TraceIDFromContext returns trace ID from the given context

Types

type Headers

type Headers map[string]string

Headers missing godoc

func HeadersForRequest

func HeadersForRequest(request *http.Request) Headers

HeadersForRequest returns all http headers used for tracing of the passed request. If the request headers are not set, but are part of the context, they're set as headers as well. If the x-request-id header does not exists a new one is generated, and set as a header.

func HeadersFromContext

func HeadersFromContext(ctx context.Context) Headers

HeadersFromContext returns the headers for the provided context

Jump to

Keyboard shortcuts

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