context

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextBuilder

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

func NewContextBuilder

func NewContextBuilder(parent context.Context) *ContextBuilder

func (*ContextBuilder) Build

func (b *ContextBuilder) Build() *EnhancedContext

func (*ContextBuilder) WithComponent

func (b *ContextBuilder) WithComponent(service, component, operation string) *ContextBuilder

func (*ContextBuilder) WithDeadline

func (b *ContextBuilder) WithDeadline(deadline time.Time) *ContextBuilder

func (*ContextBuilder) WithMetadata

func (b *ContextBuilder) WithMetadata(key string, value interface{}) *ContextBuilder

func (*ContextBuilder) WithRequestID

func (b *ContextBuilder) WithRequestID(requestID string) *ContextBuilder

func (*ContextBuilder) WithTag

func (b *ContextBuilder) WithTag(key, value string) *ContextBuilder

func (*ContextBuilder) WithTimeout

func (b *ContextBuilder) WithTimeout(timeout time.Duration) *ContextBuilder

func (*ContextBuilder) WithTrace

func (b *ContextBuilder) WithTrace(traceID, spanID string) *ContextBuilder

func (*ContextBuilder) WithUser

func (b *ContextBuilder) WithUser(userID, sessionID, tenantID string) *ContextBuilder

type ContextMetrics

type ContextMetrics struct {
	CreatedAt time.Time

	OperationCount atomic.Int64

	ErrorCount atomic.Int64

	CancellationTime time.Duration

	MaxDepth atomic.Int32

	ChildContexts atomic.Int32
}

type ContextMiddleware

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

func NewContextMiddleware

func NewContextMiddleware(serviceName, componentName string) *ContextMiddleware

func (*ContextMiddleware) Handler

func (m *ContextMiddleware) Handler(next func(*EnhancedContext)) func(context.Context)

type EnhancedContext

type EnhancedContext struct {
	context.Context
	// contains filtered or unexported fields
}

func Background

func Background() *EnhancedContext

func FromContext

func FromContext(ctx context.Context) (*EnhancedContext, bool)

func MustFromContext

func MustFromContext(ctx context.Context) *EnhancedContext

func TODO

func TODO() *EnhancedContext

func WithEnhancedContext

func WithEnhancedContext(ctx context.Context) *EnhancedContext

func (*EnhancedContext) AddError

func (c *EnhancedContext) AddError(err error)

func (*EnhancedContext) CancelReason

func (c *EnhancedContext) CancelReason() string

func (*EnhancedContext) CancelWithReason

func (c *EnhancedContext) CancelWithReason(reason string)

func (*EnhancedContext) CancelledAt

func (c *EnhancedContext) CancelledAt() time.Time

func (*EnhancedContext) ComponentName

func (c *EnhancedContext) ComponentName() string

func (*EnhancedContext) Duration

func (c *EnhancedContext) Duration() time.Duration

func (*EnhancedContext) GetAllMetadata

func (c *EnhancedContext) GetAllMetadata() map[string]interface{}

func (*EnhancedContext) GetAllTags

func (c *EnhancedContext) GetAllTags() map[string]string

func (*EnhancedContext) GetErrors

func (c *EnhancedContext) GetErrors() []error

func (*EnhancedContext) GetMetadata

func (c *EnhancedContext) GetMetadata(key string) (interface{}, bool)

func (*EnhancedContext) GetMetrics

func (c *EnhancedContext) GetMetrics() *ContextMetrics

func (*EnhancedContext) GetTag

func (c *EnhancedContext) GetTag(key string) (string, bool)

func (*EnhancedContext) HasErrors

func (c *EnhancedContext) HasErrors() bool

func (*EnhancedContext) IncrementOperationCount

func (c *EnhancedContext) IncrementOperationCount()

func (*EnhancedContext) IsExpired

func (c *EnhancedContext) IsExpired() bool

func (*EnhancedContext) OperationName

func (c *EnhancedContext) OperationName() string

func (*EnhancedContext) RemainingTime

func (c *EnhancedContext) RemainingTime() time.Duration

func (*EnhancedContext) RequestID

func (c *EnhancedContext) RequestID() string

func (*EnhancedContext) ServiceName

func (c *EnhancedContext) ServiceName() string

func (*EnhancedContext) SessionID

func (c *EnhancedContext) SessionID() string

func (*EnhancedContext) SetMetadata

func (c *EnhancedContext) SetMetadata(key string, value interface{})

func (*EnhancedContext) SetTag

func (c *EnhancedContext) SetTag(key, value string)

func (*EnhancedContext) SpanID

func (c *EnhancedContext) SpanID() string

func (*EnhancedContext) StartTime

func (c *EnhancedContext) StartTime() time.Time

func (*EnhancedContext) String

func (c *EnhancedContext) String() string

func (*EnhancedContext) TenantID

func (c *EnhancedContext) TenantID() string

func (*EnhancedContext) ToMap

func (c *EnhancedContext) ToMap() map[string]interface{}

func (*EnhancedContext) TraceID

func (c *EnhancedContext) TraceID() string

func (*EnhancedContext) UserID

func (c *EnhancedContext) UserID() string

func (*EnhancedContext) WithChildOperation

func (c *EnhancedContext) WithChildOperation(componentName, operationName string) *EnhancedContext

func (*EnhancedContext) WithChildSpan

func (c *EnhancedContext) WithChildSpan(operationName string) *EnhancedContext

Jump to

Keyboard shortcuts

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