Documentation ¶
Overview ¶
Package chtracker provides Clickhouse query tracker.
Index ¶
- type QueryReport
- type SetupOptions
- type TrackedQuery
- type Tracker
- func (t *Tracker[Q]) Flush(ctx context.Context) error
- func (t *Tracker[Q]) HTTPClient() *http.Client
- func (t *Tracker[Q]) Report(ctx context.Context, ...) error
- func (t *Tracker[Q]) TracerProvider() trace.TracerProvider
- func (t *Tracker[Q]) Track(ctx context.Context, meta Q, cb func(context.Context, Q) error) (rerr error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type QueryReport ¶
type QueryReport struct { DurationNanos int64 `json:"duration_nanos,omitempty" yaml:"duration_nanos,omitempty"` Query string `json:"query,omitempty" yaml:"query,omitempty"` ReadBytes int64 `json:"read_bytes,omitempty" yaml:"read_bytes,omitempty"` ReadRows int64 `json:"read_rows,omitempty" yaml:"read_rows,omitempty"` MemoryUsage int64 `json:"memory_usage,omitempty" yaml:"memory_usage,omitempty"` ReceivedRows int64 `json:"recevied_rows,omitempty" yaml:"recevied_rows,omitempty"` }
QueryReport is a Clickhouse query stats retrieved from trace.
type SetupOptions ¶
type SetupOptions struct { // Trace enables tracing. Trace bool // TempoAddr sets URL to Tempo API to retrieve traces. TempoAddr string }
SetupOptions defines options for Setup.
type TrackedQuery ¶
TrackedQuery stores info about tracked query.
type Tracker ¶
type Tracker[Q any] struct { // contains filtered or unexported fields }
Tracker is a query tracker.
func (*Tracker[Q]) HTTPClient ¶
HTTPClient returns instrumented HTTP client to use.
func (*Tracker[Q]) Report ¶
func (t *Tracker[Q]) Report(ctx context.Context, cb func(context.Context, TrackedQuery[Q], []QueryReport, error) error) error
Report iterates over tracked queries.
func (*Tracker[Q]) TracerProvider ¶
func (t *Tracker[Q]) TracerProvider() trace.TracerProvider
TracerProvider returns tracer provider to use.
Click to show internal directories.
Click to hide internal directories.