clickhouse

package
v0.0.0-...-f240d8d Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TableSlowReport  string = "slow_report"
	TableErrorReport string = "error_report"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Authentication

type Authentication struct {
	PlainText *PlainTextConfig `mapstructure:",squash"`
	TLS       *TLSConfig       `mapstructure:"tls"`
}

func (*Authentication) ConfigureAuthentication

func (config *Authentication) ConfigureAuthentication(opts *clickhouse.Options) error

type ByLimitBuilder

type ByLimitBuilder struct {
	// contains filtered or unexported fields
}

func NewByLimitBuilder

func NewByLimitBuilder() *ByLimitBuilder

func (*ByLimitBuilder) GroupBy

func (builder *ByLimitBuilder) GroupBy(keys ...string) *ByLimitBuilder

func (*ByLimitBuilder) Limit

func (builder *ByLimitBuilder) Limit(limit int) *ByLimitBuilder

func (*ByLimitBuilder) Offset

func (builder *ByLimitBuilder) Offset(offset int) *ByLimitBuilder

func (*ByLimitBuilder) OrderBy

func (builder *ByLimitBuilder) OrderBy(key string, asc bool) *ByLimitBuilder

func (*ByLimitBuilder) String

func (builder *ByLimitBuilder) String() string

type ClickhouseAPI

type ClickhouseAPI struct {
	Parts []PartFromSLOResult
	// contains filtered or unexported fields
}

func NewClickhouseAPI

func NewClickhouseAPI(cfg *ClickhouseConfig) (*ClickhouseAPI, error)

func (*ClickhouseAPI) EnrichSLOGroup

func (cAPI *ClickhouseAPI) EnrichSLOGroup(groups []model.SLOGroup, entryURI string, startNano int64, endNano int64, stepDuration time.Duration)

EnrichSLOGroup implements handler.SLOGroupHandler.

func (*ClickhouseAPI) QueryTimeSeriesRootCauseCount

func (c *ClickhouseAPI) QueryTimeSeriesRootCauseCount(index string, entryUri *string, startTime int64, endTime int64, step time.Duration) (model.RootCauseCountTimeSeries, error)

func (*ClickhouseAPI) SearchSLOResult

func (c *ClickhouseAPI) SearchSLOResult(
	entryURL string,
	startMS int64,
	endMS int64,
	pageParam *api.PageParam,
	duration time.Duration,
	skipInactiveEntry bool,
	skipHealthyEntry bool,
	options ...api.SortByOption,
) (result []*model.SLOResult, count int, err error)

func (*ClickhouseAPI) StoreSLOResult

func (c *ClickhouseAPI) StoreSLOResult(results []*model.SLOResult, startTSMillis int64, step time.Duration)

type ClickhouseConfig

type ClickhouseConfig struct {
	Authentication   Authentication `mapstructure:",squash"`
	Endpoints        []string       `mapstructure:"endpoint"`
	Compression      string         `mapstructure:"compression"`
	Cluster          string         `mapstructure:"cluster"`
	Table            string         `mapstructure:"table"`
	MaxExecutionTime int            `mapstructure:"max_execution_time"`
	DialTimeout      time.Duration  `mapstructure:"dial_timeout"`
	MaxOpenConns     int            `mapstructure:"max_open_conns"`
	MaxIdleConns     int            `mapstructure:"max_idle_conns"`
	ConnMaxLifetime  time.Duration  `mapstructure:"conn_max_life_time"`
	BlockBufferSize  uint8          `mapstructure:"block_buffer_size"`

	BufferNumLayers int `mapstructure:"buffer_num_layers"`
	BufferMinTime   int `mapstructure:"buffer_min_time"`
	BufferMaxTime   int `mapstructure:"buffer_max_time"`
	BufferMinRows   int `mapstructure:"buffer_min_rows"`
	BufferMaxRows   int `mapstructure:"buffer_max_rows"`
	BufferMinBytes  int `mapstructure:"buffer_min_bytes"`
	BufferMaxBytes  int `mapstructure:"buffer_max_bytes"`
}

type FieldBuilder

type FieldBuilder struct {
	// contains filtered or unexported fields
}

func NewFieldBuilder

func NewFieldBuilder() *FieldBuilder

func (*FieldBuilder) Alias

func (builder *FieldBuilder) Alias(key string, alias string) *FieldBuilder

func (*FieldBuilder) Fields

func (builder *FieldBuilder) Fields(keys ...string) *FieldBuilder

func (*FieldBuilder) String

func (builder *FieldBuilder) String() string

type PartFromSLOResult

type PartFromSLOResult func(result *model.SLOResult, index int, step string, indexTimestamp int64) string

type PlainTextConfig

type PlainTextConfig struct {
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Database string `mapstructure:"database"`
}

func (*PlainTextConfig) ConfigurePlaintext

func (plainTextConfig *PlainTextConfig) ConfigurePlaintext(opts *clickhouse.Options) error

type QueryBuilder

type QueryBuilder struct {
	// contains filtered or unexported fields
}

func NewQueryBuilder

func NewQueryBuilder() *QueryBuilder

func (*QueryBuilder) Between

func (builder *QueryBuilder) Between(key string, from uint64, to uint64) *QueryBuilder

func (*QueryBuilder) Equals

func (builder *QueryBuilder) Equals(key string, value interface{}) *QueryBuilder

func (*QueryBuilder) EqualsNotEmpty

func (builder *QueryBuilder) EqualsNotEmpty(key string, value string) *QueryBuilder

func (*QueryBuilder) Statement

func (builder *QueryBuilder) Statement(where string) *QueryBuilder

func (*QueryBuilder) String

func (builder *QueryBuilder) String() string

type SLORecordVO

type SLORecordVO struct {
	EntryUri                 string    `ch:"entryUri"`
	EntryService             string    `ch:"entryService"`
	Alias                    string    `ch:"alias"`
	StartTime                int64     `ch:"startTime"`
	EndTime                  int64     `ch:"endTime"`
	RequestCount             int64     `ch:"requestCount"`
	Status                   string    `ch:"status"`
	SLOsType                 []string  `ch:"SLOs.type"`
	SLOsMultiple             []float64 `ch:"SLOs.multiple"`
	SLOsExpectedValue        []float64 `ch:"SLOs.expectedValue"`
	SLOsSource               []string  `ch:"SLOs.source"`
	SLOsCurrentValue         []float64 `ch:"SLOs.currentValue"`
	SLOsStatus               []string  `ch:"SLOs.status"`
	SlowRootCauseCountKey    []string  `ch:"slowRootCauseCount.key"`
	SlowRootCauseCountValue  []uint32  `ch:"slowRootCauseCount.value"`
	ErrorRootCauseCountKey   []string  `ch:"errorRootCauseCount.key"`
	ErrorRootCauseCountValue []uint32  `ch:"errorRootCauseCount.value"`
	Step                     string    `ch:"step"`
	IndexTimestamp           int64     `ch:"indexTimestamp"`
}

type TLSConfig

type TLSConfig struct {
	// Enable TLS
	Enable bool `mapstructure:"enabled"`
	// Path to the CA cert. For a client this verifies the server certificate.
	CAFile string `mapstructure:"ca_file"`
	// Path to the TLS cert to use for TLS required connections. (optional)
	CertFile string `mapstructure:"cert_file"`
	// Path to the TLS key to use for TLS required connections. (optional)
	KeyFile string `mapstructure:"key_file"`
	// InsecureSkipVerify will enable TLS but not verify the certificate
	InsecureSkipVerify bool `mapstructure:"insecure_skip_verify"`
	// MinVersion sets the minimum TLS version that is acceptable.
	// If not set, TLS 1.2 will be used. (optional)
	MinVersion string `mapstructure:"min_version"`
	// MaxVersion sets the maximum TLS version that is acceptable.
	// If not set, refer to crypto/tls for defaults. (optional)
	MaxVersion string `mapstructure:"max_version"`
}

TLSConfig is the interface used to configure a tcp client or server from a `Config`

func (*TLSConfig) LoadTLSConfig

func (c *TLSConfig) LoadTLSConfig() (*tls.Config, error)

Jump to

Keyboard shortcuts

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