instance

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregation

type Aggregation struct {
	Query   string             `json:"query"`
	Chart   string             `json:"chart"`
	Times   AggregationTimes   `json:"times"`
	Options AggregationOptions `json:"options"`
}

Aggregation is the structure of the data, which is required to run an aggregation.

type AggregationOptions

type AggregationOptions struct {
	SliceBy         string `json:"sliceBy"`
	SizeByOperation string `json:"sizeByOperation"`
	SizeByField     string `json:"sizeByField"`

	HorizontalAxisOperation string `json:"horizontalAxisOperation"`
	HorizontalAxisField     string `json:"horizontalAxisField"`
	HorizontalAxisOrder     string `json:"horizontalAxisOrder"`
	HorizontalAxisLimit     string `json:"horizontalAxisLimit"`

	VerticalAxisOperation string `json:"verticalAxisOperation"`
	VerticalAxisField     string `json:"verticalAxisField"`

	BreakDownBy        string   `json:"breakDownBy"`
	BreakDownByFields  []string `json:"breakDownByFields"`
	BreakDownByFilters []string `json:"breakDownByFilters"`
}

AggregationOptions is the structure of the options for an aggregation. It contains all the fields, which are required to build the query for the choosen chart type.

type AggregationTimes

type AggregationTimes struct {
	TimeEnd   int64 `json:"timeEnd"`
	TimeStart int64 `json:"timeStart"`
}

AggregationTimes is the structure, which defines the time interval for the aggregation.

type Bucket

type Bucket struct {
	Interval int64 `json:"interval"`
	Count    int64 `json:"count"`
}

Bucket is the struct which is used to represent the distribution of the returned rows for a logs query for the given time range.

type Config

type Config struct {
	Address             string   `json:"address"`
	Database            string   `json:"database"`
	Username            string   `json:"username"`
	Password            string   `json:"password"`
	WriteTimeout        string   `json:"writeTimeout"`
	ReadTimeout         string   `json:"readTimeout"`
	MaterializedColumns []string `json:"materializedColumns"`
}

Config is the structure of the configuration for a single klogs instance.

type FieldNumber

type FieldNumber struct {
	Key   []string
	Value []float64
}

FieldNumber is the struct for the nested fields for all JSON fields of a log line, which are containing a number.

type FieldString

type FieldString struct {
	Key   []string
	Value []string
}

FieldString is the struct for the nested fields for all JSON fields of a log line, which are containing a string.

type Fields

type Fields struct {
	String []string
	Number []string
}

Fields is the struct for cached fields, which can be of type number or string.

type Instance

type Instance interface {
	GetName() string

	GetFields(filter string, fieldType string) []string
	GetLogs(ctx context.Context, query, order, orderBy string, limit, timeStart, timeEnd int64) ([]map[string]any, []string, int64, int64, []Bucket, error)
	GetRawQueryResults(ctx context.Context, query string) ([][]any, []string, error)
	GetAggregation(ctx context.Context, aggregation Aggregation) ([]map[string]any, []string, error)
	// contains filtered or unexported methods
}

func New

func New(name string, options map[string]any) (Instance, error)

New returns a new klogs instance for the given configuration.

type MockInstance

type MockInstance struct {
	mock.Mock
}

MockInstance is an autogenerated mock type for the Instance type

func NewMockInstance

func NewMockInstance(t NewMockInstanceT) *MockInstance

NewMockInstance creates a new instance of MockInstance. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockInstance) GetAggregation

func (_m *MockInstance) GetAggregation(ctx context.Context, aggregation Aggregation) ([]map[string]interface{}, []string, error)

GetAggregation provides a mock function with given fields: ctx, aggregation

func (*MockInstance) GetFields

func (_m *MockInstance) GetFields(filter string, fieldType string) []string

GetFields provides a mock function with given fields: filter, fieldType

func (*MockInstance) GetLogs

func (_m *MockInstance) GetLogs(ctx context.Context, query string, order string, orderBy string, limit int64, timeStart int64, timeEnd int64) ([]map[string]interface{}, []string, int64, int64, []Bucket, error)

GetLogs provides a mock function with given fields: ctx, query, order, orderBy, limit, timeStart, timeEnd

func (*MockInstance) GetName

func (_m *MockInstance) GetName() string

GetName provides a mock function with given fields:

func (*MockInstance) GetRawQueryResults

func (_m *MockInstance) GetRawQueryResults(ctx context.Context, query string) ([][]interface{}, []string, error)

GetRawQueryResults provides a mock function with given fields: ctx, query

type NewMockInstanceT

type NewMockInstanceT interface {
	mock.TestingT
	Cleanup(func())
}

type Row

type Row struct {
	Timestamp    time.Time
	Cluster      string
	Namespace    string
	App          string
	Pod          string
	Container    string
	Host         string
	FieldsString FieldString
	FieldsNumber FieldNumber
	Log          string
}

Row is the struct which represents a single row in the logs table of ClickHouse.

type VisualizationRow

type VisualizationRow struct {
	Label string  `json:"label"`
	Value float64 `json:"value"`
}

VisualizationRow is the structure of a single row for a visualization.

Jump to

Keyboard shortcuts

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