clickhouse

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProfileTypeFromDBModel

func ProfileTypeFromDBModel(ptype ProfileType) (profile.ProfileType, error)

Types

type Config

type Config struct {
	DSN string

	SamplesWriterPoolSize int
}

func (*Config) CreateStorage

func (conf *Config) CreateStorage(logger *log.Logger) (*Storage, io.Closer, error)

func (*Config) RegisterFlags

func (conf *Config) RegisterFlags(f *flag.FlagSet)

type ProfileKey

type ProfileKey [12]byte

func NewProfileKey

func NewProfileKey(t time.Time) (pk ProfileKey)

func (*ProfileKey) Scan

func (pk *ProfileKey) Scan(src interface{}) error

func (ProfileKey) String

func (pk ProfileKey) String() string

func (ProfileKey) Value

func (pk ProfileKey) Value() (driver.Value, error)

type ProfileType

type ProfileType uint8
const (
	TypeCPU          ProfileType = 1
	TypeHeap         ProfileType = 2
	TypeBlock        ProfileType = 3
	TypeMutex        ProfileType = 4
	TypeGoroutine    ProfileType = 5
	TypeThreadcreate ProfileType = 6

	TypeOther ProfileType = 100
)

Profile types supported by ClickHouse writer. Must match with values defined in `pprof_profiles.profile_type` SQL enum.

func ProfileTypeToDBModel

func ProfileTypeToDBModel(ptype profile.ProfileType) (ProfileType, error)

type ProfilesWriter

type ProfilesWriter interface {
	WriteProfile(ctx context.Context, pk ProfileKey, ptype ProfileType, createdAt time.Time, params *storage.WriteProfileParams) error
}

func NewProfilesWriter

func NewProfilesWriter(logger *log.Logger, db *sql.DB) ProfilesWriter

type ProfilesWriterWrapper

type ProfilesWriterWrapper func(ProfilesWriter) ProfilesWriter

type SamplesWriter

type SamplesWriter interface {
	WriteSamples(ctx context.Context, pk ProfileKey, samples []*pprofProfile.Sample, sampleTypes []*pprofProfile.ValueType) error
}

func NewSamplesWriter

func NewSamplesWriter(logger *log.Logger, db *sql.DB) SamplesWriter

type Storage

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

func NewStorage

func NewStorage(logger *log.Logger, db *sql.DB, profilesWriter ProfilesWriter, samplesWriter SamplesWriter) (*Storage, error)

func (*Storage) FindProfileIDs

func (st *Storage) FindProfileIDs(ctx context.Context, params *storage.FindProfilesParams) (pids []profile.ID, err error)

func (*Storage) FindProfiles

func (st *Storage) FindProfiles(ctx context.Context, params *storage.FindProfilesParams) (metas []profile.Meta, err error)

func (*Storage) ListProfiles

func (st *Storage) ListProfiles(ctx context.Context, pid []profile.ID) (storage.ProfileList, error)

func (*Storage) ListServices

func (st *Storage) ListServices(ctx context.Context) (services []string, err error)

func (*Storage) WriteProfile

func (st *Storage) WriteProfile(ctx context.Context, params *storage.WriteProfileParams, r io.Reader) (profile.Meta, error)

Jump to

Keyboard shortcuts

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