Documentation
¶
Index ¶
- Constants
- Variables
- func StringOrEmpty(val any, ok bool) string
- type Log
- func (l *Log) AttributeLen() int
- func (l *Log) BodyLen() int
- func (l *Log) Copy() *Log
- func (l *Log) ForEachAttribute(f func(string, any) error) error
- func (l *Log) ForEachBody(f func(string, any) error) error
- func (l *Log) ForEachResource(f func(string, any) error) error
- func (l *Log) Freeze()
- func (l *Log) GetAttributeValue(key string) (any, bool)
- func (l *Log) GetAttributes() map[string]any
- func (l *Log) GetBody() map[string]any
- func (l *Log) GetBodyValue(key string) (any, bool)
- func (l *Log) GetObservedTimestamp() uint64
- func (l *Log) GetResource() map[string]any
- func (l *Log) GetResourceValue(key string) (any, bool)
- func (l *Log) GetTimestamp() uint64
- func (l *Log) Reset()
- func (l *Log) ResourceLen() int
- func (l *Log) SetAttributeValue(key string, value any)
- func (l *Log) SetBodyValue(key string, value any)
- func (l *Log) SetObservedTimestamp(ts uint64)
- func (l *Log) SetResourceValue(key string, value any)
- func (l *Log) SetTimestamp(ts uint64)
- type LogBatch
- type LogLiteral
- type Sink
- type Source
- type Transformer
Constants ¶
const ( // Body map keys // BodyKeyMessage is the key for the unparsed message field of a log. BodyKeyMessage = "message" // Attributes map keys // AttributeDatabaseName is the name of the ADX database that the log should be sent to. AttributeDatabaseName = "adxmon_destination_database" // AttributeTableName is the name of the ADX table that the log should be sent to. AttributeTableName = "adxmon_destination_table" )
Variables ¶
var ( LogBatchPool = pool.NewGeneric(200, func(sz int) interface{} { return &LogBatch{ Logs: make([]*Log, 0, sz), } }) LogPool = pool.NewGeneric(1024, func(sz int) interface{} { return NewLog() }) )
Functions ¶
func StringOrEmpty ¶ added in v0.2.0
Types ¶
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log represents a single log entry It is not safe for concurrent updates It is safe to read from multiple goroutines after all modifications have been completed. Freeze is best effort and should be used to indicate that the log is no longer being modified.
func (*Log) AttributeLen ¶ added in v0.2.0
func (*Log) ForEachAttribute ¶ added in v0.2.0
func (*Log) ForEachBody ¶ added in v0.2.0
func (*Log) ForEachResource ¶ added in v0.2.0
func (*Log) GetAttributeValue ¶ added in v0.2.0
func (*Log) GetAttributes ¶ added in v0.2.0
GetAttributes returns a copy of the attributes map for read-only access This creates a shallow copy of the map elements. The map is safe to modify, but most elements are not.
func (*Log) GetBody ¶ added in v0.2.0
GetBody returns a copy of the body map for read-only access This creates a shallow copy of the map elements. The map is safe to modify, but most elements are not.
func (*Log) GetObservedTimestamp ¶ added in v0.2.0
func (*Log) GetResource ¶ added in v0.2.0
GetResource returns a copy of the resource map for read-only access This creates a shallow copy of the map elements. The map is safe to modify, but most elements are not.
func (*Log) GetResourceValue ¶ added in v0.2.0
func (*Log) GetTimestamp ¶ added in v0.2.0
func (*Log) ResourceLen ¶ added in v0.2.0
func (*Log) SetAttributeValue ¶ added in v0.2.0
func (*Log) SetBodyValue ¶ added in v0.2.0
func (*Log) SetObservedTimestamp ¶ added in v0.2.0
func (*Log) SetResourceValue ¶ added in v0.2.0
func (*Log) SetTimestamp ¶ added in v0.2.0
type LogBatch ¶
type LogBatch struct {
Logs []*Log
Ack func()
}
LogBatch represents a batch of logs
func (*LogBatch) AddLiterals ¶ added in v0.2.0
func (l *LogBatch) AddLiterals(literals []*LogLiteral)
type LogLiteral ¶ added in v0.2.0
type LogLiteral struct {
// Timestamp of the event in nanoseconds since the unix epoch
Timestamp uint64
// Timestamp when this event was ingested in nanoseconds since the unix epoch
ObservedTimestamp uint64
// Body of the log entry
Body map[string]any
// Attributes of the log entry, not included in the log body.
Attributes map[string]any
// Resource that has collected the log
Resource map[string]any
}
LogLiteral is a struct that is easily converted to Log.
func (*LogLiteral) ToLog ¶ added in v0.2.0
func (l *LogLiteral) ToLog() *Log
type Sink ¶
type Sink interface {
Open(context.Context) error
Send(context.Context, *LogBatch) error
Close() error
Name() string
}
Sink is a component that receives a LogBatch. Send is potentially called by multiple goroutines concurrently.