baggage

package
v2.11.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Headers

type Headers map[string]string

Headers is a header map in authz convention – keys are lowercase.

type Prefixed

type Prefixed struct {
	// Header prefix, eg. "uberctx-" – in lower-case, as per envoy's authz
	// convention – (note that this differs from golang's conventions))
	Prefix string
}

Prefixed puts each flow label into a separate header. Header name is concatenation of Prefix and flow label name.

func (Prefixed) Extract

func (p Prefixed) Extract(headers Headers) flowlabel.FlowLabels

Extract extracts prefixed flow labels from headers.

func (Prefixed) Inject

func (p Prefixed) Inject(
	flowLabels flowlabel.FlowLabels,
	headers Headers,
) ([]*envoy_core.HeaderValueOption, error)

Inject emits instructions for envoy how to inject flow labels into headers supported by prefixed propagator.

type Propagator

type Propagator interface {
	// Extract extracts flow labels from headers
	//
	// The headers are expected to be in envoy's authz convention – with
	// lower-case keys
	Extract(headers Headers) flowlabel.FlowLabels

	// Inject emits instructions for envoy how to inject flow labels into
	// headers based on given flow labels and existing headers
	//
	// The returned list is expected to be put in
	// CheckResponse.OkHttpResponse.Headers, so that envoy will take care of
	// injecting appropriate headers.
	Inject(flowLabels flowlabel.FlowLabels, headers Headers) ([]*envoy_core.HeaderValueOption, error)
}

Propagator defines how to extract flow labels (baggage) from and put into headers

This interface is similar to go.opentelemetry.io/otel/propagation.TextMapPropagator: https://github.com/open-telemetry/opentelemetry-go/blob/v1.2.0/propagation/propagation.go#L91-L111 but is designed to use authz-compatible types and conventions.

type W3Baggage

type W3Baggage struct{}

W3Baggage handles baggage propagation in a single `baggage` header, as described in https://www.w3.org/TR/baggage/

All baggage items are mapped to flow labels 1:1. This could be tweaked in future: * we can use some prefixing/filtering, * alternatively, we could put _all_ flow labels as a _single_ baggage item (eg. Fn-flow).

func (W3Baggage) Extract

func (b W3Baggage) Extract(headers Headers) flowlabel.FlowLabels

Extract extracts flow labels from w3Baggage headers.

func (W3Baggage) Inject

func (b W3Baggage) Inject(
	flowLabels flowlabel.FlowLabels,
	headers Headers,
) ([]*envoy_core.HeaderValueOption, error)

Inject emits instructions for envoy how to inject flow labels into headers supported by baggage propagator.

Jump to

Keyboard shortcuts

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