contexts

package
v0.0.0-...-68f06ca Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Activity_HttpHeaderPrefix          string = "X-Activity-"
	Activity_DiagnosticResourceCloudId string = "resourceId"
	Activity_ResourceCloudId           string = "operatingResourceId"
	Activity_OperationName             string = "operationName"
	Activity_Location                  string = "location"
	Activity_CorrelationId             string = "correlationId"
	Activity_Properties                string = "properties"
	Activity_EdgeLocation              string = "edgeLocation"

	Activity_Props_CallerId      string = "callerId"
	Activity_Props_ResourceK8SId string = "operatingResourceK8SId"

	OTEL_Activity_DiagnosticResourceCloudId string = "resourceId"
	OTEL_Activity_ResourceCloudId           string = "operatingResourceId"
	OTEL_Activity_OperationName             string = "operationName"
	OTEL_Activity_Location                  string = "location"
	OTEL_Activity_CorrelationId             string = "correlationId"
	OTEL_Activity_Properties                string = "properties"
	OTEL_Activity_Props_CallerId            string = "callerId"
	OTEL_Activity_Props_ResourceK8SId       string = "operatingResourceK8SId"
	OTEL_Activity_Props_EdgeLocation        string = "edgeLocation"
)
View Source
const (
	Diagnostics_HttpHeaderPrefix     string = "X-Diagnostics-"
	Diagnostics_CorrelationId        string = "correlationId"
	Diagnostics_ResourceCloudId      string = "resourceId"
	Diagnostics_TraceContext         string = "traceContext"
	Diagnostics_TraceContext_TraceId string = "traceId"
	Diagnostics_TraceContext_SpanId  string = "spanId"

	OTEL_Diagnostics_CorrelationId        string = "correlationId"
	OTEL_Diagnostics_ResourceCloudId      string = "resourceId"
	OTEL_Diagnostics_TraceContext         string = "traceContext"
	OTEL_Diagnostics_TraceContext_TraceId string = "traceId"
	OTEL_Diagnostics_TraceContext_SpanId  string = "spanId"
)

Variables

This section is empty.

Functions

func ActivityLogContextEquals

func ActivityLogContextEquals(a, b *ActivityLogContext) bool

func ClearActivityLogContextFromMetadata

func ClearActivityLogContextFromMetadata(metadata map[string]string)

func ClearDiagnosticLogContextFromMetadata

func ClearDiagnosticLogContextFromMetadata(metadata map[string]string)

func ClearResourceIdAndCorrelationIdFromDiagnosticLogContext

func ClearResourceIdAndCorrelationIdFromDiagnosticLogContext(parent *context.Context)

func ClearTraceAndSpanFromDiagnosticLogContext

func ClearTraceAndSpanFromDiagnosticLogContext(parent *context.Context)

func ConstructHttpHeaderKeyForActivityLogContext

func ConstructHttpHeaderKeyForActivityLogContext(key string) string

func ConstructHttpHeaderKeyForDiagnosticsLogContext

func ConstructHttpHeaderKeyForDiagnosticsLogContext(key string) string

func DiagnosticLogContextEquals

func DiagnosticLogContextEquals(d1 *DiagnosticLogContext, d2 *DiagnosticLogContext) bool

func GenerateCorrelationIdToParentContextIfMissing

func GenerateCorrelationIdToParentContextIfMissing(parent context.Context) context.Context

func InheritActivityLogContextFromOriginalContext

func InheritActivityLogContextFromOriginalContext(original context.Context, parent context.Context) context.Context

func InheritDiagnosticLogContextFromOriginalContext

func InheritDiagnosticLogContextFromOriginalContext(orignal context.Context, parent context.Context) context.Context

func IsActivityLogContextPropertiesHeader

func IsActivityLogContextPropertiesHeader(key string) bool

func OverrideActivityLogContextToCurrentContext

func OverrideActivityLogContextToCurrentContext(newActCtx *ActivityLogContext, parent context.Context) context.Context

func OverrideDiagnosticLogContextToCurrentContext

func OverrideDiagnosticLogContextToCurrentContext(newDiagCtx *DiagnosticLogContext, parent context.Context) context.Context

func PatchActivityLogContextToCurrentContext

func PatchActivityLogContextToCurrentContext(newActCtx *ActivityLogContext, parent context.Context) context.Context

func PatchCorrelationIdToParentContextIfMissing

func PatchCorrelationIdToParentContextIfMissing(parent context.Context, correlationId string) context.Context

func PatchDiagnosticLogContextToCurrentContext

func PatchDiagnosticLogContextToCurrentContext(newDiagCtx *DiagnosticLogContext, parent context.Context) context.Context

func PopulateResourceIdAndCorrelationIdToDiagnosticLogContext

func PopulateResourceIdAndCorrelationIdToDiagnosticLogContext(correlationId string, resourceCloudId string, parent context.Context) context.Context

func PopulateTraceAndSpanToDiagnosticLogContext

func PopulateTraceAndSpanToDiagnosticLogContext(traceId string, spanId string, parent context.Context) context.Context

func PropagateActivityLogContextToHttpRequestHeader

func PropagateActivityLogContextToHttpRequestHeader(req *http.Request)

func PropagateActivityLogContextToMetadata

func PropagateActivityLogContextToMetadata(ctx context.Context, metadata map[string]string)

func PropagateDiagnosticLogContextToHttpRequestHeader

func PropagateDiagnosticLogContextToHttpRequestHeader(req *http.Request)

func PropagteDiagnosticLogContextToMetadata

func PropagteDiagnosticLogContextToMetadata(ctx context.Context, metadata map[string]string)

func TraceContextEquals

func TraceContextEquals(t1 *TraceContext, t2 *TraceContext) bool

Types

type ActivityLogContext

type ActivityLogContext struct {
	// contains filtered or unexported fields
}

ActivityLogContext is a context that holds activity information.

func NewActivityLogContext

func NewActivityLogContext(diagnosticResourceCloudId, resourceCloudId, cloudLocation, edgeLocation, operationName, correlationId, callerId, resourceK8SId string) *ActivityLogContext

func ParseActivityLogContextFromHttpRequestHeader

func ParseActivityLogContextFromHttpRequestHeader(ctx *fasthttp.RequestCtx) *ActivityLogContext

func ParseActivityLogContextFromMetadata

func ParseActivityLogContextFromMetadata(metadata map[string]string) *ActivityLogContext

func (*ActivityLogContext) Deadline

func (ctx *ActivityLogContext) Deadline() (deadline time.Time, ok bool)

Deadline returns the time when work done on behalf of this context

func (*ActivityLogContext) DeepCopy

func (ctx *ActivityLogContext) DeepCopy() *ActivityLogContext

func (ActivityLogContext) DeepEquals

func (ctx ActivityLogContext) DeepEquals(other ActivityLogContext) bool

func (*ActivityLogContext) Done

func (ctx *ActivityLogContext) Done() <-chan struct{}

Done returns a channel that's closed when work done on behalf of this context should be canceled.

func (*ActivityLogContext) Err

func (a *ActivityLogContext) Err() error

Err returns an error if this context has been canceled or timed out.

func (*ActivityLogContext) FromMap

func (ctx *ActivityLogContext) FromMap(m map[string]interface{})

func (*ActivityLogContext) GetCallerId

func (ctx *ActivityLogContext) GetCallerId() string

func (*ActivityLogContext) GetCloudLocation

func (ctx *ActivityLogContext) GetCloudLocation() string

func (*ActivityLogContext) GetCorrelationId

func (ctx *ActivityLogContext) GetCorrelationId() string

func (*ActivityLogContext) GetDiagnosticResourceCloudId

func (ctx *ActivityLogContext) GetDiagnosticResourceCloudId() string

func (*ActivityLogContext) GetEdgeLocation

func (ctx *ActivityLogContext) GetEdgeLocation() string

func (*ActivityLogContext) GetOperationName

func (ctx *ActivityLogContext) GetOperationName() string

func (*ActivityLogContext) GetProperties

func (ctx *ActivityLogContext) GetProperties() map[string]interface{}

func (*ActivityLogContext) GetProperty

func (ctx *ActivityLogContext) GetProperty(key string) interface{}

func (*ActivityLogContext) GetResourceCloudId

func (ctx *ActivityLogContext) GetResourceCloudId() string

func (*ActivityLogContext) GetResourceK8SId

func (ctx *ActivityLogContext) GetResourceK8SId() string

func (ActivityLogContext) MarshalJSON

func (ctx ActivityLogContext) MarshalJSON() ([]byte, error)

func (*ActivityLogContext) SetCallerId

func (ctx *ActivityLogContext) SetCallerId(callerId string)

func (*ActivityLogContext) SetCloudLocation

func (ctx *ActivityLogContext) SetCloudLocation(cloudLocation string)

func (*ActivityLogContext) SetCorrelationId

func (ctx *ActivityLogContext) SetCorrelationId(correlationId string)

func (*ActivityLogContext) SetDiagnosticResourceCloudId

func (ctx *ActivityLogContext) SetDiagnosticResourceCloudId(diagnosticResourceCloudId string)

func (*ActivityLogContext) SetEdgeLocation

func (ctx *ActivityLogContext) SetEdgeLocation(edgeLocation string)

func (*ActivityLogContext) SetOperationName

func (ctx *ActivityLogContext) SetOperationName(operationName string)

func (*ActivityLogContext) SetProperties

func (ctx *ActivityLogContext) SetProperties(properties map[string]interface{})

func (*ActivityLogContext) SetProperty

func (ctx *ActivityLogContext) SetProperty(key string, value interface{})

func (*ActivityLogContext) SetResourceCloudId

func (ctx *ActivityLogContext) SetResourceCloudId(resourceCloudId string)

func (*ActivityLogContext) SetResourceK8SId

func (ctx *ActivityLogContext) SetResourceK8SId(resourceK8SId string)

func (ActivityLogContext) String

func (ctx ActivityLogContext) String() string

func (*ActivityLogContext) ToMap

func (ctx *ActivityLogContext) ToMap() map[string]interface{}

func (*ActivityLogContext) UnmarshalJSON

func (ctx *ActivityLogContext) UnmarshalJSON(data []byte) error

func (*ActivityLogContext) Value

func (ctx *ActivityLogContext) Value(key interface{}) interface{}

Value returns the value associated with this context for key, or nil if no value is associated with key.

type ActivityLogContextDecorator

type ActivityLogContextDecorator struct {
}

func (*ActivityLogContextDecorator) Decorate

func (d *ActivityLogContextDecorator) Decorate(entry *logrus.Entry, folding bool) *logrus.Entry

type ContextKey

type ContextKey string
const (
	// DiagnosticLogContextKey is the key for the diagnostic log context.
	DiagnosticLogContextKey ContextKey = "diagnostics"
	// ActivityLogContextKey is the key for the activity log context.
	ActivityLogContextKey ContextKey = "activity"
)

type DiagnosticLogContext

type DiagnosticLogContext struct {
	// contains filtered or unexported fields
}

DiagnosticLogContext is a context that holds diagnostic information.

func NewDiagnosticLogContext

func NewDiagnosticLogContext(correlationId, resourceCloudId, traceId, spanId string) *DiagnosticLogContext

func ParseDiagnosticLogContextFromHttpRequestHeader

func ParseDiagnosticLogContextFromHttpRequestHeader(ctx *fasthttp.RequestCtx) *DiagnosticLogContext

func ParseDiagnosticLogContextFromMetadata

func ParseDiagnosticLogContextFromMetadata(metadata map[string]string) *DiagnosticLogContext

func (*DiagnosticLogContext) Deadline

func (ctx *DiagnosticLogContext) Deadline() (deadline time.Time, ok bool)

Deadline returns the time when work done on behalf of this context

func (*DiagnosticLogContext) DeepCopy

func (ctx *DiagnosticLogContext) DeepCopy() *DiagnosticLogContext

func (DiagnosticLogContext) DeepEquals

func (ctx DiagnosticLogContext) DeepEquals(other DiagnosticLogContext) bool

func (*DiagnosticLogContext) Done

func (ctx *DiagnosticLogContext) Done() <-chan struct{}

Done returns a channel that's closed when work done on behalf of this context should be canceled.

func (*DiagnosticLogContext) Err

func (a *DiagnosticLogContext) Err() error

Err returns an error if this context has been canceled or timed out.

func (*DiagnosticLogContext) FromMap

func (ctx *DiagnosticLogContext) FromMap(m map[string]interface{})

func (*DiagnosticLogContext) GetCorrelationId

func (ctx *DiagnosticLogContext) GetCorrelationId() string

func (*DiagnosticLogContext) GetResourceId

func (ctx *DiagnosticLogContext) GetResourceId() string

func (*DiagnosticLogContext) GetSpanId

func (ctx *DiagnosticLogContext) GetSpanId() string

func (*DiagnosticLogContext) GetTraceContext

func (ctx *DiagnosticLogContext) GetTraceContext() TraceContext

func (*DiagnosticLogContext) GetTraceId

func (ctx *DiagnosticLogContext) GetTraceId() string

func (DiagnosticLogContext) MarshalJSON

func (ctx DiagnosticLogContext) MarshalJSON() ([]byte, error)

func (*DiagnosticLogContext) SetCorrelationId

func (ctx *DiagnosticLogContext) SetCorrelationId(correlationId string)

func (*DiagnosticLogContext) SetResourceId

func (ctx *DiagnosticLogContext) SetResourceId(resourceCloudId string)

func (*DiagnosticLogContext) SetSpanId

func (ctx *DiagnosticLogContext) SetSpanId(spanId string)

func (*DiagnosticLogContext) SetTraceContext

func (ctx *DiagnosticLogContext) SetTraceContext(traceContext TraceContext)

func (*DiagnosticLogContext) SetTraceId

func (ctx *DiagnosticLogContext) SetTraceId(traceId string)

func (DiagnosticLogContext) String

func (ctx DiagnosticLogContext) String() string

func (*DiagnosticLogContext) ToMap

func (ctx *DiagnosticLogContext) ToMap() map[string]interface{}

func (*DiagnosticLogContext) UnmarshalJSON

func (ctx *DiagnosticLogContext) UnmarshalJSON(data []byte) error

func (*DiagnosticLogContext) Value

func (ctx *DiagnosticLogContext) Value(key interface{}) interface{}

Value returns the value associated with this context for key, or nil if no value is associated with key.

type DiagnosticLogContextDecorator

type DiagnosticLogContextDecorator struct {
}

func (*DiagnosticLogContextDecorator) Decorate

func (d *DiagnosticLogContextDecorator) Decorate(entry *logrus.Entry, folding bool) *logrus.Entry

type LogContextDecorator

type LogContextDecorator interface {
	// AddFields adds fields to the log entry.
	Decorate(entry *logrus.Entry, folding bool) *logrus.Entry
}

LogContextDecorator is a decorator that parse the context and add to the log entry.

type TraceContext

type TraceContext struct {
	// contains filtered or unexported fields
}

func (*TraceContext) DeepCopy

func (ctx *TraceContext) DeepCopy() *TraceContext

func (TraceContext) DeepEquals

func (ctx TraceContext) DeepEquals(other TraceContext) bool

func (TraceContext) MarshalJSON

func (ctx TraceContext) MarshalJSON() ([]byte, error)

func (TraceContext) String

func (ctx TraceContext) String() string

func (*TraceContext) UnmarshalJSON

func (ctx *TraceContext) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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