clickhouse

package
v0.73.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DatabaseStateTypeChoices added in v0.8.0

func DatabaseStateTypeChoices() []string

func OrderByTypeChoices added in v0.21.0

func OrderByTypeChoices() []string

func ServiceClickHouseQueryStatsLimit added in v0.21.0

func ServiceClickHouseQueryStatsLimit(limit int) [2]string

ServiceClickHouseQueryStatsLimit Limit for number of results

func ServiceClickHouseQueryStatsOffset added in v0.21.0

func ServiceClickHouseQueryStatsOffset(offset int) [2]string

ServiceClickHouseQueryStatsOffset Offset for retrieved results based on sort order

func ServiceClickHouseQueryStatsOrderByType added in v0.21.0

func ServiceClickHouseQueryStatsOrderByType(orderByType OrderByType) [2]string

ServiceClickHouseQueryStatsOrderByType Order in which to sort retrieved results

Types

type ClickHouseHandler

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

func NewHandler

func NewHandler(doer doer) ClickHouseHandler

func (*ClickHouseHandler) ServiceClickHouseCurrentQueries added in v0.11.0

func (h *ClickHouseHandler) ServiceClickHouseCurrentQueries(ctx context.Context, project string, serviceName string) ([]QueryOut, error)

func (*ClickHouseHandler) ServiceClickHouseDatabaseCreate

func (h *ClickHouseHandler) ServiceClickHouseDatabaseCreate(ctx context.Context, project string, serviceName string, in *ServiceClickHouseDatabaseCreateIn) error

func (*ClickHouseHandler) ServiceClickHouseDatabaseDelete

func (h *ClickHouseHandler) ServiceClickHouseDatabaseDelete(ctx context.Context, project string, serviceName string, database string) error

func (*ClickHouseHandler) ServiceClickHouseDatabaseList added in v0.8.0

func (h *ClickHouseHandler) ServiceClickHouseDatabaseList(ctx context.Context, project string, serviceName string) ([]DatabaseOut, error)

func (*ClickHouseHandler) ServiceClickHouseQuery added in v0.11.0

func (h *ClickHouseHandler) ServiceClickHouseQuery(ctx context.Context, project string, serviceName string, in *ServiceClickHouseQueryIn) (*ServiceClickHouseQueryOut, error)

func (*ClickHouseHandler) ServiceClickHouseQueryStats

func (h *ClickHouseHandler) ServiceClickHouseQueryStats(ctx context.Context, project string, serviceName string, query ...[2]string) ([]ServiceClickHouseQueryStatsOut, error)

func (*ClickHouseHandler) ServiceClickHouseTieredStorageSummary

func (h *ClickHouseHandler) ServiceClickHouseTieredStorageSummary(ctx context.Context, project string, serviceName string) (*ServiceClickHouseTieredStorageSummaryOut, error)

type DatabaseOut added in v0.8.0

type DatabaseOut struct {
	Engine   string            `json:"engine"`          // Database engine
	Name     string            `json:"name"`            // Database name
	Required bool              `json:"required"`        // Required database
	State    DatabaseStateType `json:"state,omitempty"` // Database state
}

type DatabaseStateType added in v0.8.0

type DatabaseStateType string
const (
	DatabaseStateTypeOk              DatabaseStateType = "ok"
	DatabaseStateTypePendingCreation DatabaseStateType = "pending_creation"
	DatabaseStateTypePendingRemoval  DatabaseStateType = "pending_removal"
)

type Handler

type Handler interface {
	// ServiceClickHouseCurrentQueries list active queries
	// GET /v1/project/{project}/service/{service_name}/clickhouse/query
	// https://api.aiven.io/doc/#tag/Service:_ClickHouse/operation/ServiceClickHouseCurrentQueries
	ServiceClickHouseCurrentQueries(ctx context.Context, project string, serviceName string) ([]QueryOut, error)

	// ServiceClickHouseDatabaseCreate create a database
	// POST /v1/project/{project}/service/{service_name}/clickhouse/db
	// https://api.aiven.io/doc/#tag/Service:_ClickHouse/operation/ServiceClickHouseDatabaseCreate
	ServiceClickHouseDatabaseCreate(ctx context.Context, project string, serviceName string, in *ServiceClickHouseDatabaseCreateIn) error

	// ServiceClickHouseDatabaseDelete delete a database
	// DELETE /v1/project/{project}/service/{service_name}/clickhouse/db/{database}
	// https://api.aiven.io/doc/#tag/Service:_ClickHouse/operation/ServiceClickHouseDatabaseDelete
	ServiceClickHouseDatabaseDelete(ctx context.Context, project string, serviceName string, database string) error

	// ServiceClickHouseDatabaseList list all databases
	// GET /v1/project/{project}/service/{service_name}/clickhouse/db
	// https://api.aiven.io/doc/#tag/Service:_ClickHouse/operation/ServiceClickHouseDatabaseList
	ServiceClickHouseDatabaseList(ctx context.Context, project string, serviceName string) ([]DatabaseOut, error)

	// ServiceClickHouseQuery execute an SQL query
	// POST /v1/project/{project}/service/{service_name}/clickhouse/query
	// https://api.aiven.io/doc/#tag/Service:_ClickHouse/operation/ServiceClickHouseQuery
	ServiceClickHouseQuery(ctx context.Context, project string, serviceName string, in *ServiceClickHouseQueryIn) (*ServiceClickHouseQueryOut, error)

	// ServiceClickHouseQueryStats return statistics on recent queries
	// GET /v1/project/{project}/service/{service_name}/clickhouse/query/stats
	// https://api.aiven.io/doc/#tag/Service:_ClickHouse/operation/ServiceClickHouseQueryStats
	ServiceClickHouseQueryStats(ctx context.Context, project string, serviceName string, query ...[2]string) ([]ServiceClickHouseQueryStatsOut, error)

	// ServiceClickHouseTieredStorageSummary get the ClickHouse tiered storage summary
	// GET /v1/project/{project}/service/{service_name}/clickhouse/tiered-storage/summary
	// https://api.aiven.io/doc/#tag/Service:_ClickHouse/operation/ServiceClickHouseTieredStorageSummary
	ServiceClickHouseTieredStorageSummary(ctx context.Context, project string, serviceName string) (*ServiceClickHouseTieredStorageSummaryOut, error)
}

type HourlyOut

type HourlyOut struct {
	EstimatedCost   *string `json:"estimated_cost,omitempty"` // The estimated cost in USD of tiered storage for this hour
	HourStart       string  `json:"hour_start"`               // Timestamp in ISO 8601 format, always in UTC
	PeakStoredBytes int     `json:"peak_stored_bytes"`        // Peak bytes stored on object storage at this hour
}

type MetaOut added in v0.11.0

type MetaOut struct {
	Name string `json:"name"` // Column name
	Type string `json:"type"` // Column type
}

type OrderByType added in v0.21.0

type OrderByType string
const (
	OrderByTypeCallsAsc       OrderByType = "calls:asc"
	OrderByTypeCallsDesc      OrderByType = "calls:desc"
	OrderByTypeMinTimeAsc     OrderByType = "min_time:asc"
	OrderByTypeMinTimeDesc    OrderByType = "min_time:desc"
	OrderByTypeMaxTimeAsc     OrderByType = "max_time:asc"
	OrderByTypeMaxTimeDesc    OrderByType = "max_time:desc"
	OrderByTypeMeanTimeAsc    OrderByType = "mean_time:asc"
	OrderByTypeMeanTimeDesc   OrderByType = "mean_time:desc"
	OrderByTypeP95TimeAsc     OrderByType = "p95_time:asc"
	OrderByTypeP95TimeDesc    OrderByType = "p95_time:desc"
	OrderByTypeStddevTimeAsc  OrderByType = "stddev_time:asc"
	OrderByTypeStddevTimeDesc OrderByType = "stddev_time:desc"
	OrderByTypeTotalTimeAsc   OrderByType = "total_time:asc"
	OrderByTypeTotalTimeDesc  OrderByType = "total_time:desc"
)

type QueryOut

type QueryOut struct {
	ClientName *string  `json:"client_name,omitempty"` // Client name, if set
	Database   *string  `json:"database,omitempty"`
	Elapsed    *float64 `json:"elapsed,omitempty"` // The time in seconds since request execution started
	Query      *string  `json:"query,omitempty"`   // The query text
	User       *string  `json:"user,omitempty"`    // The user who made the query
}

type ServiceClickHouseDatabaseCreateIn

type ServiceClickHouseDatabaseCreateIn struct {
	Database string `json:"database"` // Service database name
}

ServiceClickHouseDatabaseCreateIn ServiceClickHouseDatabaseCreateRequestBody

type ServiceClickHouseQueryIn added in v0.11.0

type ServiceClickHouseQueryIn struct {
	Database string `json:"database"` // Service database name
	Query    string `json:"query"`
}

ServiceClickHouseQueryIn ServiceClickHouseQueryRequestBody

type ServiceClickHouseQueryOut added in v0.11.0

type ServiceClickHouseQueryOut struct {
	Data    [][]any    `json:"data"`
	Meta    []MetaOut  `json:"meta"`
	Summary SummaryOut `json:"summary"` // Summary
}

ServiceClickHouseQueryOut ServiceClickHouseQueryResponse

type ServiceClickHouseQueryStatsOut added in v0.36.0

type ServiceClickHouseQueryStatsOut struct {
	Calls      *int     `json:"calls,omitempty"` // Number of calls
	Database   *string  `json:"database,omitempty"`
	MaxTime    *int     `json:"max_time,omitempty"`    // Maximum query duration in milliseconds
	MeanTime   *int     `json:"mean_time,omitempty"`   // Average query duration in milliseconds
	MinTime    *int     `json:"min_time,omitempty"`    // Minimum query duration in milliseconds
	P95Time    *int     `json:"p95_time,omitempty"`    // Query duration 95th percentile in milliseconds
	Query      *string  `json:"query,omitempty"`       // Normalized query
	Rows       *float64 `json:"rows,omitempty"`        // Average number of rows per call
	StddevTime *int     `json:"stddev_time,omitempty"` // Query duration standard deviation in milliseconds
	TotalTime  *int     `json:"total_time,omitempty"`  // Total duration of all calls in milliseconds
}

type ServiceClickHouseTieredStorageSummaryOut

type ServiceClickHouseTieredStorageSummaryOut struct {
	CurrentCost         string                 `json:"current_cost"`              // The current cost in USD of tiered storage since the beginning of the billing period
	ForecastedCost      string                 `json:"forecasted_cost"`           // The forecasted cost in USD of tiered storage in the billing period
	ForecastedRate      *string                `json:"forecasted_rate,omitempty"` // The rate on GBs/hour used to calculate the forecasted cost
	StorageUsageHistory StorageUsageHistoryOut `json:"storage_usage_history"`     // History of usage and cumulative costs in the billing period
	TotalStorageUsage   int                    `json:"total_storage_usage"`       // Total storage usage by tiered storage, in bytes
}

ServiceClickHouseTieredStorageSummaryOut ServiceClickHouseTieredStorageSummaryResponse

type StorageUsageHistoryOut

type StorageUsageHistoryOut struct {
	Hourly []HourlyOut `json:"hourly"` // History by hour
}

StorageUsageHistoryOut History of usage and cumulative costs in the billing period

type SummaryOut added in v0.11.0

type SummaryOut struct {
	ElapsedNs    *int `json:"elapsed_ns,omitempty"`    // Elapsed time in nanoseconds
	ReadBytes    *int `json:"read_bytes,omitempty"`    // Number of bytes read
	ReadRows     *int `json:"read_rows,omitempty"`     // Number of rows read
	ResultBytes  *int `json:"result_bytes,omitempty"`  // Number of bytes in the result
	ResultRows   *int `json:"result_rows,omitempty"`   // Number of rows in the result
	WrittenBytes *int `json:"written_bytes,omitempty"` // Number of bytes written
	WrittenRows  *int `json:"written_rows,omitempty"`  // Number of rows written
}

SummaryOut Summary

Jump to

Keyboard shortcuts

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