Documentation ¶
Index ¶
- type Aggregation
- type AggregationOptions
- type AggregationTimes
- type Bucket
- type Config
- type FieldNumber
- type FieldString
- type Fields
- type Instance
- func (i *Instance) GetAggregation(ctx context.Context, aggregation Aggregation) ([]map[string]interface{}, []string, error)
- func (i *Instance) GetFields(filter string, fieldType string) []string
- func (i *Instance) GetLogs(ctx context.Context, query, order, orderBy string, ...) ([]map[string]interface{}, []string, int64, int64, []Bucket, error)
- func (i *Instance) GetRawQueryResults(ctx context.Context, query string) ([][]interface{}, []string, error)
- type Row
- type VisualizationRow
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 ¶
AggregationTimes is the structure, which defines the time interval for the aggregation.
type Bucket ¶
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 klogs instance.
type FieldNumber ¶
FieldNumber is the struct for the nested fields for all JSON fields of a log line, which are containing a number.
type FieldString ¶
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 klogs instance, which can be added via the configuration file.
func (*Instance) GetAggregation ¶
func (i *Instance) GetAggregation(ctx context.Context, aggregation Aggregation) ([]map[string]interface{}, []string, error)
GetAggregation returns the data for the given aggregation. To get the data we have to build the aggregation query. Then we can reuse the parseLogsQuery function from getting the logs, to build the WHERE statement. Finally we are running the query and parsing all rows into a map with the column names as keys and the value of each row.
func (*Instance) GetFields ¶
GetFields returns all cahced fields which are containing the filter term. The cached fields are refreshed every 24.
func (*Instance) GetLogs ¶
func (i *Instance) GetLogs(ctx context.Context, query, order, orderBy string, limit, 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.
func (*Instance) GetRawQueryResults ¶
func (i *Instance) GetRawQueryResults(ctx context.Context, query string) ([][]interface{}, []string, error)
GetRawQueryResults returns all rows for the user provided SQL query. This function should only be used by other plugins. If users should be able to directly access a Clickhouse instance you can expose the instance using the SQL plugin.
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 ¶
VisualizationRow is the structure of a single row for a visualization.