Documentation
¶
Index ¶
- Constants
- func BuildWhereClause(conditions []string, allArgs []interface{}) (string, []interface{})
- func CreateTableSQL(database, table string) string
- func InsertSQL(database, table string) string
- func LabelMatchersToSQL(matchers []*labels.Matcher) (string, []interface{}, error)
- func ProfileTypeFilter(qp profile.QueryParts) (string, []interface{})
- func QueryToFilters(query string, startNanos, endNanos int64) (string, []interface{}, profile.QueryParts, error)
- func TimeRangeFilter(startNanos, endNanos int64) (string, []interface{})
- type Client
- func (c *Client) Close() error
- func (c *Client) Config() Config
- func (c *Client) Conn() driver.Conn
- func (c *Client) Database() string
- func (c *Client) EnsureSchema(ctx context.Context) error
- func (c *Client) Exec(ctx context.Context, query string, args ...interface{}) error
- func (c *Client) FullTableName() string
- func (c *Client) PrepareBatch(ctx context.Context, query string) (driver.Batch, error)
- func (c *Client) Query(ctx context.Context, query string, args ...interface{}) (driver.Rows, error)
- func (c *Client) Table() string
- type Config
- type Ingester
- type LineInfo
- type Querier
- func (q *Querier) GetProfileMetadataLabels(ctx context.Context, query string, start, end time.Time) ([]string, error)
- func (q *Querier) GetProfileMetadataMappings(ctx context.Context, query string, start, end time.Time) ([]string, error)
- func (q *Querier) HasProfileData(ctx context.Context) (bool, error)
- func (q *Querier) Labels(ctx context.Context, match []string, start, end time.Time, profileType string) ([]string, error)
- func (q *Querier) ProfileTypes(ctx context.Context, start, end time.Time) ([]*pb.ProfileType, error)
- func (q *Querier) QueryMerge(ctx context.Context, query string, start, end time.Time, ...) (profile.Profile, error)
- func (q *Querier) QueryRange(ctx context.Context, query string, startTime, endTime time.Time, ...) ([]*pb.MetricsSeries, error)
- func (q *Querier) QuerySingle(ctx context.Context, query string, t time.Time, invertCallStacks bool) (profile.Profile, error)
- func (q *Querier) Values(ctx context.Context, labelName string, match []string, start, end time.Time, ...) ([]string, error)
- type StacktraceData
Constants ¶
const ( ColName = "name" ColSampleType = "sample_type" ColSampleUnit = "sample_unit" ColPeriodType = "period_type" ColPeriodUnit = "period_unit" ColPeriod = "period" ColDuration = "duration" ColTimestamp = "timestamp" ColTimeNanos = "time_nanos" ColValue = "value" ColLabels = "labels" // Stacktrace nested columns. ColStacktraceAddress = "stacktrace.address" ColStacktraceMappingStart = "stacktrace.mapping_start" ColStacktraceMappingLimit = "stacktrace.mapping_limit" ColStacktraceMappingOffset = "stacktrace.mapping_offset" ColStacktraceMappingFile = "stacktrace.mapping_file" ColStacktraceMappingBuildID = "stacktrace.mapping_build_id" ColStacktraceLineNumber = "stacktrace.line_number" ColStacktraceFunctionName = "stacktrace.function_name" ColStacktraceFunctionSystemName = "stacktrace.function_system_name" ColStacktraceFunctionFilename = "stacktrace.function_filename" ColStacktraceFunctionStartLine = "stacktrace.function_start_line" )
Column names matching the profile schema.
Variables ¶
This section is empty.
Functions ¶
func BuildWhereClause ¶
BuildWhereClause combines multiple filter conditions into a single WHERE clause.
func CreateTableSQL ¶
CreateTableSQL returns the SQL statement to create the profile data table. The schema uses: - JSON type for dynamic labels (native ClickHouse support for dynamic columns). - Nested type for stacktrace data with explicit columns for each location field.
func LabelMatchersToSQL ¶
LabelMatchersToSQL converts Prometheus label matchers to SQL WHERE clause conditions.
func ProfileTypeFilter ¶
func ProfileTypeFilter(qp profile.QueryParts) (string, []interface{})
ProfileTypeFilter generates SQL WHERE clause conditions for profile type filtering.
func QueryToFilters ¶
func QueryToFilters(query string, startNanos, endNanos int64) (string, []interface{}, profile.QueryParts, error)
QueryToFilters converts a query string and time range to SQL filter components.
func TimeRangeFilter ¶
TimeRangeFilter generates SQL WHERE clause conditions for time range filtering.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a wrapper around the ClickHouse connection.
func NewClient ¶
NewClient creates a new ClickHouse client with the given configuration. It first connects without a database to ensure the database can be created, then reconnects with the database specified.
func (*Client) EnsureSchema ¶
EnsureSchema creates the table if it doesn't exist. Note: The database is already created in NewClient.
func (*Client) FullTableName ¶
FullTableName returns the fully qualified table name (database.table).
func (*Client) PrepareBatch ¶
PrepareBatch prepares a batch for insertion.
type Config ¶
type Config struct {
Address string
Database string
Username string
Password string
Table string
Secure bool
}
Config holds ClickHouse connection configuration.
type Ingester ¶
type Ingester struct {
// contains filtered or unexported fields
}
Ingester implements the ingester.Ingester interface for ClickHouse.
func NewIngester ¶
NewIngester creates a new ClickHouse ingester.
type LineInfo ¶
type LineInfo struct {
LineNumber int64
FunctionStartLine int64
FunctionName string
FunctionSystemName string
FunctionFilename string
}
LineInfo holds decoded line/function information from an encoded location.
type Querier ¶
type Querier struct {
// contains filtered or unexported fields
}
Querier implements the query.Querier interface for ClickHouse.
func NewQuerier ¶
func NewQuerier( client *Client, logger log.Logger, tracer trace.Tracer, mem memory.Allocator, sym symbolizer.SymbolizationClient, ) *Querier
NewQuerier creates a new ClickHouse querier.
func (*Querier) GetProfileMetadataLabels ¶
func (q *Querier) GetProfileMetadataLabels( ctx context.Context, query string, start, end time.Time, ) ([]string, error)
GetProfileMetadataLabels returns unique label names for the given query.
func (*Querier) GetProfileMetadataMappings ¶
func (q *Querier) GetProfileMetadataMappings( ctx context.Context, query string, start, end time.Time, ) ([]string, error)
GetProfileMetadataMappings returns unique mapping files for the given query.
func (*Querier) HasProfileData ¶
HasProfileData checks if there is any profile data in the store.
func (*Querier) Labels ¶
func (q *Querier) Labels( ctx context.Context, match []string, start, end time.Time, profileType string, ) ([]string, error)
Labels returns the unique label names within the given time range.
func (*Querier) ProfileTypes ¶
func (q *Querier) ProfileTypes( ctx context.Context, start, end time.Time, ) ([]*pb.ProfileType, error)
ProfileTypes returns the available profile types within the given time range.
func (*Querier) QueryMerge ¶
func (q *Querier) QueryMerge( ctx context.Context, query string, start, end time.Time, aggregateByLabels []string, invertCallStacks bool, functionToFilterBy string, ) (profile.Profile, error)
QueryMerge executes a merge query over a time range.
func (*Querier) QueryRange ¶
func (q *Querier) QueryRange( ctx context.Context, query string, startTime, endTime time.Time, step time.Duration, limit uint32, sumBy []string, ) ([]*pb.MetricsSeries, error)
QueryRange executes a range query and returns time series data. It aggregates samples by timestamp bucket and labels in ClickHouse, returning one row per unique labelset with an array of time series samples.
type StacktraceData ¶
type StacktraceData struct {
Addresses []uint64
MappingStarts []uint64
MappingLimits []uint64
MappingOffsets []uint64
MappingFiles []string
MappingBuildIDs []string
LineNumbers []int64
FunctionNames []string
FunctionSystemNames []string
FunctionFilenames []string
FunctionStartLines []int64
}
StacktraceData holds the extracted stacktrace information for a single sample.