clickhouse

package
v0.5.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClickhouseQueryLogSchema

type ClickhouseQueryLogSchema struct {
	QueryType                  string    `db:"type"`
	EventTimeMicroseconds      time.Time `db:"event_time_microseconds"`
	QueryStartTimeMicroseconds time.Time `db:"query_start_time_microseconds"`

	// Performance Information
	QueryDurationMs  uint64 `db:"query_duration_ms"`
	PeakThreadsUsage uint64 `db:"peak_threads_usage"`

	// IO Information
	ReadRows  uint64 `db:"read_rows"`
	ReadBytes uint64 `db:"read_bytes"`

	WrittenRows  uint64 `db:"written_rows"`
	WrittenBytes uint64 `db:"written_bytes"`

	ResultRows  uint64 `db:"result_rows"`
	ResultBytes uint64 `db:"result_bytes"`

	// Query Information
	MemoryUsage            uint64   `db:"memory_usage"`
	CurrentDatabase        string   `db:"current_database"`
	Query                  string   `db:"normalized_query"`
	NormalizedQueryHash    uint64   `db:"normalized_query_hash"`
	QueryKind              string   `db:"query_kind"`
	Databases              []string `db:"databases"`
	Tables                 []string `db:"tables"`
	Columns                []string `db:"columns"`
	Partitions             []string `db:"partitions"`
	Projections            []string `db:"projections"`
	Views                  []string `db:"views"`
	UsedFunctions          []string `db:"used_functions"`
	UsedAggregateFunctions []string `db:"used_aggregate_functions"`
	ExceptionCode          int32    `db:"exception_code"`
	Exception              string   `db:"exception"`
	StackTrace             string   `db:"stack_trace"`

	// Server Information
	Hostname string `db:"hostname"`

	// Client Information
	InitialUser                       string    `db:"initial_user"`
	InitialQueryId                    string    `db:"initial_query_id"`
	InitialAddress                    *net.IP   `db:"initial_address"`
	InitialPort                       uint16    `db:"initial_port"`
	InitialQueryStartTimeMicroseconds time.Time `db:"initial_query_start_time_microseconds"`
	OsUser                            string    `db:"os_user"`
	ClientHostname                    string    `db:"client_hostname"`
	ClientName                        string    `db:"client_name"`
	ClientRevision                    uint32    `db:"client_revision"`
	ClientRevisionMajor               uint32    `db:"client_version_major"`
	ClientRevisionMinor               uint32    `db:"client_version_minor"`
	ClientRevisionPatch               uint32    `db:"client_version_patch"`
	DistributedDepth                  uint64    `db:"distributed_depth"`

	// HTTP Client Information
	HttpMethod    uint8  `db:"http_method"`
	HttpUserAgent string `db:"http_user_agent"`
	HttpReferer   string `db:"http_referer"`
	ForwardedFor  string `db:"forwarded_for"`

	// Script Information
	ScriptQueryNumber uint32 `db:"script_query_number"`
	ScriptLineNumber  uint32 `db:"script_line_number"`
}

type ClickhouseScrapper

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

func NewClickhouseScrapper

func NewClickhouseScrapper(ctx context.Context, conf ClickhouseScrapperConf) (*ClickhouseScrapper, error)

func (*ClickhouseScrapper) Close

func (e *ClickhouseScrapper) Close() error

func (*ClickhouseScrapper) DialectType added in v0.1.8

func (e *ClickhouseScrapper) DialectType() string

func (*ClickhouseScrapper) Executor

func (*ClickhouseScrapper) FetchQueryLogs

func (s *ClickhouseScrapper) FetchQueryLogs(
	ctx context.Context,
	from, to time.Time,
	obfuscator querylogs.QueryObfuscator,
) (querylogs.QueryLogIterator, error)

func (*ClickhouseScrapper) IsPermissionError added in v0.1.1

func (e *ClickhouseScrapper) IsPermissionError(err error) bool

func (*ClickhouseScrapper) QueryCatalog

func (e *ClickhouseScrapper) QueryCatalog(ctx context.Context) ([]*scrapper.CatalogColumnRow, error)

func (*ClickhouseScrapper) QueryCustomMetrics

func (e *ClickhouseScrapper) QueryCustomMetrics(ctx context.Context, sql string, args ...any) ([]*scrapper.CustomMetricsRow, error)

func (*ClickhouseScrapper) QueryDatabases

func (e *ClickhouseScrapper) QueryDatabases(ctx context.Context) ([]*scrapper.DatabaseRow, error)

func (*ClickhouseScrapper) QuerySegments

func (e *ClickhouseScrapper) QuerySegments(ctx context.Context, sql string, args ...any) ([]*scrapper.SegmentRow, error)

func (*ClickhouseScrapper) QuerySqlDefinitions

func (e *ClickhouseScrapper) QuerySqlDefinitions(ctx context.Context) ([]*scrapper.SqlDefinitionRow, error)

func (*ClickhouseScrapper) QueryTableMetrics

func (e *ClickhouseScrapper) QueryTableMetrics(ctx context.Context, lastMetricsFetchTime time.Time) ([]*scrapper.TableMetricsRow, error)

func (*ClickhouseScrapper) QueryTables

func (e *ClickhouseScrapper) QueryTables(ctx context.Context) ([]*scrapper.TableRow, error)

func (*ClickhouseScrapper) SqlDialect added in v0.1.8

func (e *ClickhouseScrapper) SqlDialect() sqldialect.Dialect

func (*ClickhouseScrapper) ValidateConfiguration

func (e *ClickhouseScrapper) ValidateConfiguration(ctx context.Context) ([]string, error)

type ClickhouseScrapperConf

type ClickhouseScrapperConf struct {
	dwhexecclickhouse.ClickhouseConf
	DatabaseName string
}

Jump to

Keyboard shortcuts

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