logstorage

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package logstorage defines storage structure for logs storage.

Index

Constants

This section is empty.

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.

func NewConsumer

func NewConsumer(i Inserter) *Consumer

NewConsumer creates new Consumer.

func (*Consumer) ConsumeLogs

func (c *Consumer) ConsumeLogs(ctx context.Context, logs plog.Logs) error

ConsumeLogs implements otelreceiver.Consumer.

type Inserter

type Inserter interface {
	// InsertRecords inserts given records.
	InsertRecords(ctx context.Context, records []Record) error
	// InsertLogLabels insert given set of labels to the storage.
	InsertLogLabels(ctx context.Context, labels map[Label]struct{}) error
}

Inserter is a log storage insert interface.

type Label

type Label struct {
	Name  string `json:"name" yson:"name"`
	Value string `json:"value" yson:"value"`
	Type  int32  `json:"type" yson:"type"`
}

Label is a data structure for log label.

func (Label) YTSchema

func (Label) YTSchema() schema.Schema

YTSchema returns YTsaurus table schema for this structure.

type LabelsOptions

type LabelsOptions struct {
	// Start defines time range for search.
	//
	// Querier ignores parameter, if it is zero.
	Start otelstorage.Timestamp
	// End defines time range for search.
	//
	// Querier ignores parameter, if it is zero.
	End otelstorage.Timestamp
}

LabelsOptions defines options for Labels and 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)
}

Querier is a logs storage query interface.

type Record

type Record struct {
	Timestamp         otelstorage.Timestamp `json:"timestamp" yson:"timestamp"`
	ObservedTimestamp otelstorage.Timestamp `json:"observed_timestamp" yson:"observed_timestamp"`
	TraceID           otelstorage.TraceID   `json:"trace_id" yson:"trace_id"`
	SpanID            otelstorage.SpanID    `json:"span_id" yson:"span_id"`
	Flags             plog.LogRecordFlags   `json:"flags" yson:"flags"`
	SeverityText      string                `json:"severity_text" yson:"severity_text"`
	SeverityNumber    plog.SeverityNumber   `json:"severity_number" yson:"severity_number"`
	Body              string                `json:"body" yson:"body"`
	Attrs             otelstorage.Attrs     `json:"attrs" yson:"attrs"`

	ResourceAttrs otelstorage.Attrs `json:"resource_attrs" yson:"resource_attrs"`

	ScopeName    string            `json:"scope_name" yson:"scope_name"`
	ScopeVersion string            `json:"scope_version" yson:"scope_version"`
	ScopeAttrs   otelstorage.Attrs `json:"scope_attrs" yson:"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.

func (Record) YTSchema

func (Record) YTSchema() schema.Schema

YTSchema returns YTsaurus table schema for this structure.

Jump to

Keyboard shortcuts

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