wool

package
v0.0.53 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 14 Imported by: 8

README

Observability

Wool

Wrapper Over Open-Telemetry is accurate and has a meaningful acronym. Yarn, fiber, we are in the "context" space.

Goal of this package is to provide a Canvas that satisfies the following requirements:

Requirement:

  • context.Context based
  • opentelemetry support with flexible backend
  • logger support as Events (where opentelemetry is going) with flexible backend

Documentation

Index

Constants

View Source
const KeyInContext = ContextKey("wool")
View Source
const LogEvent = "log"

Variables

This section is empty.

Functions

func SetLogExporter

func SetLogExporter(handler LogHandler)

func ToAttributes

func ToAttributes(agent *configurations.Agent) []attribute.KeyValue

func WithTelemetry

func WithTelemetry() bool

Types

type Agent

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

func NewAgent

func NewAgent(agent *configurations.Agent) *Agent

func (*Agent) Name

func (a *Agent) Name() string

func (*Agent) Resource

func (a *Agent) Resource() *resource.Resource

type Context

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

func Get

func Get(ctx context.Context) *Context

func (*Context) Close

func (c *Context) Close()

func (*Context) Context

func (c *Context) Context() context.Context

func (*Context) Info

func (c *Context) Info(msg string, fields ...*LogField)

func (*Context) Name

func (c *Context) Name() string

type ContextKey

type ContextKey string

type Log

type Log struct {
	Message string
	Fields  []*LogField
}

func (*Log) AtLevel

func (l *Log) AtLevel(debug Loglevel) *Log

func (*Log) Event

func (l *Log) Event() trace.SpanStartEventOption

type LogField

type LogField struct {
	Key   string
	Level Loglevel
	Value any
}

func DebugField

func DebugField(key string, value string) *LogField

func Field

func Field(key string, value any) *LogField

type LogHandler

type LogHandler func(msg *Log)

type Loglevel

type Loglevel int
const (
	DEBUG Loglevel = iota
	INFO
)

type Resourceful

type Resourceful interface {
	Resource() *resource.Resource
	Name() string
}

type Wool

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

Wool keeping track

func CLI

func CLI(ctx context.Context) *Wool

func New

func New(ctx context.Context, who Resourceful) *Wool

func (*Wool) Context

func (w *Wool) Context() *Context

func (*Wool) Done

func (w *Wool) Done()

func (*Wool) NewContext

func (w *Wool) NewContext() context.Context

Directories

Path Synopsis
adapters
log

Jump to

Keyboard shortcuts

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