Version: v0.6.0 Latest Latest

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

Go to latest
Published: Oct 11, 2021 License: MIT Imports: 11 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


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 {
	Name                string   `json:"name"`
	DisplayName         string   `json:"displayName"`
	Description         string   `json:"description"`
	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 ClickHouse 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 Instance

type Instance struct {
	Name string
	// contains filtered or unexported fields

Instance represents a single ClickHouse instance, which can be added via the configuration file.

func New

func New(config Config) (*Instance, error)

New returns a new ClickHouse instance for the given configuration.

func (*Instance) GetAggregation

func (i *Instance) GetAggregation(ctx context.Context, limit int64, groupBy, operation, operationField, order, query string, timeStart, timeEnd int64) ([]VisualizationRow, error)

GetAggregation build an aggregation query for the given parameters and returns the result as slice of label, value pairs.

func (*Instance) GetLogs

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

GetLogs parses the given query into the sql syntax, which is then run against the ClickHouse instance. The returned rows are converted into a document schema which can be used by our UI.

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