Documentation
¶
Overview ¶
Package logstorage defines storage structure for logs storage.
Index ¶
Constants ¶
View Source
const ( LabelTraceID = "trace_id" LabelSpanID = "span_id" LabelSeverity = "level" LabelBody = "msg" LabelServiceName = "service_name" // resource.service.name LabelServiceNamespace = "service_namespace" // resource.service.namespace LabelServiceInstanceID = "service_instance_id" // resource.service.instance.id )
Labels to use where prometheus compatible labels are required, e.g. loki.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer consumes given logs and inserts them using given Inserter.
type Inserter ¶
type Inserter interface {
// RecordWriter creates a new batch.
RecordWriter(ctx context.Context) (RecordWriter, error)
}
Inserter is a log storage insert interface.
type LabelsOptions ¶
type LabelsOptions struct {
// Start defines time range for search.
//
// Querier ignores parameter, if it is zero.
Start time.Time
// End defines time range for search.
//
// Querier ignores parameter, if it is zero.
End time.Time
// Selector that selects the streams to match.
Query logql.Selector
}
LabelsOptions defines options for [Querier.LabelNames] and [Querier.LabelValues] methods.
type Querier ¶
type Querier interface {
// LabelNames returns all available label names.
LabelNames(ctx context.Context, opts LabelsOptions) ([]string, error)
// LabelValues returns all available label values for given label.
LabelValues(ctx context.Context, labelName string, opts LabelsOptions) (iterators.Iterator[Label], error)
// Series returns all available log series.
Series(ctx context.Context, opts SeriesOptions) (Series, error)
}
Querier is a logs storage query interface.
type Record ¶
type Record struct {
Timestamp otelstorage.Timestamp `json:"timestamp"`
ObservedTimestamp otelstorage.Timestamp `json:"observed_timestamp"`
TraceID otelstorage.TraceID `json:"trace_id"`
SpanID otelstorage.SpanID `json:"span_id"`
Flags plog.LogRecordFlags `json:"flags"`
SeverityText string `json:"severity_text"`
SeverityNumber plog.SeverityNumber `json:"severity_number"`
Body string `json:"body"`
Attrs otelstorage.Attrs `json:"attrs"`
ResourceAttrs otelstorage.Attrs `json:"resource_attrs"`
ScopeName string `json:"scope_name"`
ScopeVersion string `json:"scope_version"`
ScopeAttrs otelstorage.Attrs `json:"scope_attrs"`
}
Record is a log record.
func NewRecordFromOTEL ¶
func NewRecordFromOTEL( res pcommon.Resource, scope pcommon.InstrumentationScope, record plog.LogRecord, ) Record
NewRecordFromOTEL creates new Record.
type RecordWriter ¶ added in v0.15.0
type RecordWriter interface {
// Add adds record to the batch.
Add(record Record) error
// Submit sends batch.
Submit(ctx context.Context) error
// Close frees resources.
//
// Callers should call [RecordWriter.Close] regardless if they called [RecordWriter.Submit] or not.
Close() error
}
RecordWriter represents a log record batch.
type SeriesOptions ¶ added in v0.13.0
type SeriesOptions struct {
// Start defines time range for search.
//
// Querier ignores parameter, if it is zero.
Start time.Time
// End defines time range for search.
//
// Querier ignores parameter, if it is zero.
End time.Time
// Selectors defines a list of matchers to filter series.
Selectors []logql.Selector
}
SeriesOptions defines options for [Querier.Series] method.
Click to show internal directories.
Click to hide internal directories.