Help us shape the future of Go! Take the 2026 Go Developer Survey

metastore

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStacktraceNotFound = errors.New("stacktrace not found")
	ErrLocationNotFound   = errors.New("location not found")
	ErrMappingNotFound    = errors.New("mapping not found")
	ErrFunctionNotFound   = errors.New("function not found")
)

Functions

func GetLocationsByIDs added in v0.5.0

func GetLocationsByIDs(ctx context.Context, s ProfileMetaStore, ids ...[]byte) (
	map[string]*Location,
	error,
)

func MakeFunctionKey

func MakeFunctionKey(f *pb.Function) []byte

func MakeLocationKey

func MakeLocationKey(l *Location) []byte

func MakeMappingKey

func MakeMappingKey(m *pb.Mapping) []byte

func UnsymbolizableMapping added in v0.5.0

func UnsymbolizableMapping(m *pb.Mapping) bool

UnsymbolizableMapping returns true if a mapping points to a binary for which locations can't be symbolized in principle, at least now. Examples are "[vdso]", [vsyscall]" and some others, see the code.

Types

type BadgerLogger added in v0.5.0

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

func (*BadgerLogger) Debugf added in v0.5.0

func (l *BadgerLogger) Debugf(f string, v ...interface{})

func (*BadgerLogger) Errorf added in v0.5.0

func (l *BadgerLogger) Errorf(f string, v ...interface{})

func (*BadgerLogger) Infof added in v0.5.0

func (l *BadgerLogger) Infof(f string, v ...interface{})

func (*BadgerLogger) Warningf added in v0.5.0

func (l *BadgerLogger) Warningf(f string, v ...interface{})

type BadgerMetastore added in v0.5.0

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

BadgerMetastore is an implementation of the metastore using the badger KV store.

func NewBadgerMetastore added in v0.5.0

func NewBadgerMetastore(
	logger log.Logger,
	reg prometheus.Registerer,
	tracer trace.Tracer,
	uuidGenerator UUIDGenerator,
) *BadgerMetastore

NewBadgerMetastore returns a new BadgerMetastore with using in-memory badger instance.

func (*BadgerMetastore) Close added in v0.5.0

func (m *BadgerMetastore) Close() error

Close closes the badger store.

func (*BadgerMetastore) CreateFunction added in v0.5.0

func (m *BadgerMetastore) CreateFunction(ctx context.Context, f *pb.Function) ([]byte, error)

CreateFunction creates a new function in the database.

func (*BadgerMetastore) CreateLocation added in v0.5.0

func (m *BadgerMetastore) CreateLocation(ctx context.Context, l *Location) ([]byte, error)

func (*BadgerMetastore) CreateLocationLines added in v0.5.0

func (m *BadgerMetastore) CreateLocationLines(ctx context.Context, locID []byte, lines []LocationLine) error

CreateLocationLines writes a set of lines related to a location to the database.

func (*BadgerMetastore) CreateMapping added in v0.5.0

func (m *BadgerMetastore) CreateMapping(ctx context.Context, mapping *pb.Mapping) ([]byte, error)

CreateMapping creates a new mapping in the database.

func (*BadgerMetastore) CreateStacktrace added in v0.6.0

func (m *BadgerMetastore) CreateStacktrace(ctx context.Context, key []byte, sample *pb.Sample) (uuid.UUID, error)

func (*BadgerMetastore) GetFunctionByKey added in v0.5.0

func (m *BadgerMetastore) GetFunctionByKey(ctx context.Context, key *pb.Function) (*pb.Function, error)

GetFunctionByKey returns the function for the given key.

func (*BadgerMetastore) GetFunctions added in v0.5.0

func (m *BadgerMetastore) GetFunctions(ctx context.Context) ([]*pb.Function, error)

GetFunctions returns all functions in the database.

func (*BadgerMetastore) GetFunctionsByIDs added in v0.5.0

func (m *BadgerMetastore) GetFunctionsByIDs(ctx context.Context, ids ...[]byte) (map[string]*pb.Function, error)

GetFunctionByID returns the function for the given ID.

func (*BadgerMetastore) GetLinesByLocationIDs added in v0.5.0

func (m *BadgerMetastore) GetLinesByLocationIDs(ctx context.Context, ids ...[]byte) (
	map[string][]*pb.Line,
	[][]byte,
	error,
)

GetLinesByLocationIDs returns the lines for the given location IDs.

func (*BadgerMetastore) GetLocationByKey added in v0.5.0

func (m *BadgerMetastore) GetLocationByKey(ctx context.Context, key *Location) (*pb.Location, error)

func (*BadgerMetastore) GetLocations added in v0.5.0

func (m *BadgerMetastore) GetLocations(ctx context.Context) ([]*pb.Location, [][]byte, error)

func (*BadgerMetastore) GetLocationsByIDs added in v0.5.0

func (m *BadgerMetastore) GetLocationsByIDs(ctx context.Context, ids ...[]byte) (
	map[string]*pb.Location,
	[][]byte,
	error,
)

func (*BadgerMetastore) GetMappingByKey added in v0.5.0

func (m *BadgerMetastore) GetMappingByKey(ctx context.Context, key *pb.Mapping) (*pb.Mapping, error)

GetMappingByKey returns the mapping for the given key.

func (*BadgerMetastore) GetMappingsByIDs added in v0.5.0

func (m *BadgerMetastore) GetMappingsByIDs(ctx context.Context, ids ...[]byte) (map[string]*pb.Mapping, error)

GetMappingsByIDs returns the mappings for the given IDs.

func (*BadgerMetastore) GetStacktraceByIDs added in v0.6.0

func (m *BadgerMetastore) GetStacktraceByIDs(ctx context.Context, ids ...[]byte) (map[string]*pb.Sample, error)

func (*BadgerMetastore) GetStacktraceByKey added in v0.6.0

func (m *BadgerMetastore) GetStacktraceByKey(ctx context.Context, key []byte) (uuid.UUID, error)

func (*BadgerMetastore) GetSymbolizableLocations added in v0.5.0

func (m *BadgerMetastore) GetSymbolizableLocations(ctx context.Context) ([]*pb.Location, [][]byte, error)

func (*BadgerMetastore) Ping added in v0.5.0

func (m *BadgerMetastore) Ping() error

Ping returns an error if the metastore is not available.

func (*BadgerMetastore) Symbolize added in v0.5.0

func (m *BadgerMetastore) Symbolize(ctx context.Context, l *Location) error

type FunctionKey

type FunctionKey struct {
	StartLine                  int64
	Name, SystemName, Filename string
}

func MakeSQLFunctionKey added in v0.5.0

func MakeSQLFunctionKey(f *pb.Function) FunctionKey

type FunctionStore

type FunctionStore interface {
	GetFunctionByKey(ctx context.Context, key *pb.Function) (*pb.Function, error)
	CreateFunction(ctx context.Context, f *pb.Function) ([]byte, error)
	GetFunctionsByIDs(ctx context.Context, ids ...[]byte) (map[string]*pb.Function, error)
	GetFunctions(ctx context.Context) ([]*pb.Function, error)
}

type InMemorySQLiteMetaStore

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

func NewInMemorySQLiteProfileMetaStore

func NewInMemorySQLiteProfileMetaStore(
	reg prometheus.Registerer,
	tracer trace.Tracer,
	name ...string,
) (*InMemorySQLiteMetaStore, error)

func (InMemorySQLiteMetaStore) Close

func (s InMemorySQLiteMetaStore) Close() error

func (InMemorySQLiteMetaStore) CreateFunction

func (s InMemorySQLiteMetaStore) CreateFunction(ctx context.Context, fn *pb.Function) ([]byte, error)

func (InMemorySQLiteMetaStore) CreateLocation

func (s InMemorySQLiteMetaStore) CreateLocation(ctx context.Context, l *Location) ([]byte, error)

func (InMemorySQLiteMetaStore) CreateLocationLines added in v0.5.0

func (s InMemorySQLiteMetaStore) CreateLocationLines(ctx context.Context, locID []byte, lines []LocationLine) error

func (InMemorySQLiteMetaStore) CreateMapping

func (s InMemorySQLiteMetaStore) CreateMapping(ctx context.Context, m *pb.Mapping) ([]byte, error)

func (InMemorySQLiteMetaStore) CreateStacktrace added in v0.6.0

func (i InMemorySQLiteMetaStore) CreateStacktrace(ctx context.Context, key []byte, sample *pb.Sample) (uuid.UUID, error)

func (InMemorySQLiteMetaStore) GetFunctionByKey

func (s InMemorySQLiteMetaStore) GetFunctionByKey(ctx context.Context, fkey *pb.Function) (*pb.Function, error)

func (InMemorySQLiteMetaStore) GetFunctions

func (s InMemorySQLiteMetaStore) GetFunctions(ctx context.Context) ([]*pb.Function, error)

func (InMemorySQLiteMetaStore) GetFunctionsByIDs added in v0.5.0

func (s InMemorySQLiteMetaStore) GetFunctionsByIDs(ctx context.Context, ids ...[]byte) (map[string]*pb.Function, error)

func (InMemorySQLiteMetaStore) GetLinesByLocationIDs added in v0.5.0

func (s InMemorySQLiteMetaStore) GetLinesByLocationIDs(ctx context.Context, ids ...[]byte) (map[string][]*pb.Line, [][]byte, error)

func (InMemorySQLiteMetaStore) GetLocationByKey

func (s InMemorySQLiteMetaStore) GetLocationByKey(ctx context.Context, lkey *Location) (*pb.Location, error)

func (InMemorySQLiteMetaStore) GetLocations

func (s InMemorySQLiteMetaStore) GetLocations(ctx context.Context) ([]*pb.Location, [][]byte, error)

func (InMemorySQLiteMetaStore) GetLocationsByIDs

func (s InMemorySQLiteMetaStore) GetLocationsByIDs(ctx context.Context, ids ...[]byte) (
	map[string]*pb.Location,
	[][]byte,
	error,
)

func (InMemorySQLiteMetaStore) GetMappingByKey

func (s InMemorySQLiteMetaStore) GetMappingByKey(ctx context.Context, mkey *pb.Mapping) (*pb.Mapping, error)

func (InMemorySQLiteMetaStore) GetMappingsByIDs

func (s InMemorySQLiteMetaStore) GetMappingsByIDs(ctx context.Context, ids ...[]byte) (map[string]*pb.Mapping, error)

func (InMemorySQLiteMetaStore) GetStacktraceByIDs added in v0.6.0

func (i InMemorySQLiteMetaStore) GetStacktraceByIDs(ctx context.Context, ids ...[]byte) (map[string]*pb.Sample, error)

func (InMemorySQLiteMetaStore) GetStacktraceByKey added in v0.6.0

func (i InMemorySQLiteMetaStore) GetStacktraceByKey(ctx context.Context, key []byte) (uuid.UUID, error)

func (InMemorySQLiteMetaStore) GetSymbolizableLocations

func (s InMemorySQLiteMetaStore) GetSymbolizableLocations(ctx context.Context) ([]*pb.Location, [][]byte, error)

func (InMemorySQLiteMetaStore) Ping

func (s InMemorySQLiteMetaStore) Ping() error

func (InMemorySQLiteMetaStore) Symbolize

func (s InMemorySQLiteMetaStore) Symbolize(ctx context.Context, l *Location) error

type Location

type Location struct {
	ID       uuid.UUID
	Address  uint64
	Mapping  *pb.Mapping
	Lines    []LocationLine
	IsFolded bool
}

func GetLocationByKey added in v0.5.0

func GetLocationByKey(ctx context.Context, s ProfileMetaStore, key *Location) (*Location, error)

func GetLocations added in v0.5.0

func GetLocations(ctx context.Context, s ProfileMetaStore) ([]*Location, error)

Only used in tests so not as important to be efficient.

func GetSymbolizableLocations added in v0.5.0

func GetSymbolizableLocations(ctx context.Context, s ProfileMetaStore) (
	[]*Location,
	error,
)

type LocationKey

type LocationKey struct {
	NormalizedAddress uint64
	MappingID         uuid.UUID
	Lines             string
	IsFolded          bool
}

func MakeSQLLocationKey added in v0.5.0

func MakeSQLLocationKey(l *Location) LocationKey

type LocationLine added in v0.4.0

type LocationLine struct {
	Line     int64
	Function *pb.Function
}

type LocationLineStore added in v0.5.0

type LocationLineStore interface {
	CreateLocationLines(ctx context.Context, locID []byte, lines []LocationLine) error
	GetLinesByLocationIDs(ctx context.Context, id ...[]byte) (map[string][]*pb.Line, [][]byte, error)
}

type LocationStore

type LocationStore interface {
	GetLocations(ctx context.Context) ([]*pb.Location, [][]byte, error)
	GetLocationByKey(ctx context.Context, key *Location) (*pb.Location, error)
	GetLocationsByIDs(ctx context.Context, id ...[]byte) (map[string]*pb.Location, [][]byte, error)
	CreateLocation(ctx context.Context, l *Location) ([]byte, error)
	Symbolize(ctx context.Context, location *Location) error
	GetSymbolizableLocations(ctx context.Context) ([]*pb.Location, [][]byte, error)
}

type MappingKey

type MappingKey struct {
	Size, Offset  uint64
	BuildIDOrFile string
}

func MakeSQLMappingKey added in v0.5.0

func MakeSQLMappingKey(m *pb.Mapping) MappingKey

type MappingStore

type MappingStore interface {
	GetMappingByKey(ctx context.Context, key *pb.Mapping) (*pb.Mapping, error)
	CreateMapping(ctx context.Context, m *pb.Mapping) ([]byte, error)
	GetMappingsByIDs(ctx context.Context, ids ...[]byte) (map[string]*pb.Mapping, error)
}

type OnDiskSQLiteMetaStore

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

func NewDiskProfileMetaStore

func NewDiskProfileMetaStore(
	reg prometheus.Registerer,
	tracer trace.Tracer,
	path ...string,
) (*OnDiskSQLiteMetaStore, error)

func (OnDiskSQLiteMetaStore) Close

func (s OnDiskSQLiteMetaStore) Close() error

func (OnDiskSQLiteMetaStore) CreateFunction

func (s OnDiskSQLiteMetaStore) CreateFunction(ctx context.Context, fn *pb.Function) ([]byte, error)

func (OnDiskSQLiteMetaStore) CreateLocation

func (s OnDiskSQLiteMetaStore) CreateLocation(ctx context.Context, l *Location) ([]byte, error)

func (OnDiskSQLiteMetaStore) CreateLocationLines added in v0.5.0

func (s OnDiskSQLiteMetaStore) CreateLocationLines(ctx context.Context, locID []byte, lines []LocationLine) error

func (OnDiskSQLiteMetaStore) CreateMapping

func (s OnDiskSQLiteMetaStore) CreateMapping(ctx context.Context, m *pb.Mapping) ([]byte, error)

func (OnDiskSQLiteMetaStore) CreateStacktrace added in v0.6.0

func (o OnDiskSQLiteMetaStore) CreateStacktrace(ctx context.Context, key []byte, sample *pb.Sample) (uuid.UUID, error)

func (OnDiskSQLiteMetaStore) GetFunctionByKey

func (s OnDiskSQLiteMetaStore) GetFunctionByKey(ctx context.Context, fkey *pb.Function) (*pb.Function, error)

func (OnDiskSQLiteMetaStore) GetFunctions

func (s OnDiskSQLiteMetaStore) GetFunctions(ctx context.Context) ([]*pb.Function, error)

func (OnDiskSQLiteMetaStore) GetFunctionsByIDs added in v0.5.0

func (s OnDiskSQLiteMetaStore) GetFunctionsByIDs(ctx context.Context, ids ...[]byte) (map[string]*pb.Function, error)

func (OnDiskSQLiteMetaStore) GetLinesByLocationIDs added in v0.5.0

func (s OnDiskSQLiteMetaStore) GetLinesByLocationIDs(ctx context.Context, ids ...[]byte) (map[string][]*pb.Line, [][]byte, error)

func (OnDiskSQLiteMetaStore) GetLocationByKey

func (s OnDiskSQLiteMetaStore) GetLocationByKey(ctx context.Context, lkey *Location) (*pb.Location, error)

func (OnDiskSQLiteMetaStore) GetLocations

func (s OnDiskSQLiteMetaStore) GetLocations(ctx context.Context) ([]*pb.Location, [][]byte, error)

func (OnDiskSQLiteMetaStore) GetLocationsByIDs

func (s OnDiskSQLiteMetaStore) GetLocationsByIDs(ctx context.Context, ids ...[]byte) (
	map[string]*pb.Location,
	[][]byte,
	error,
)

func (OnDiskSQLiteMetaStore) GetMappingByKey

func (s OnDiskSQLiteMetaStore) GetMappingByKey(ctx context.Context, mkey *pb.Mapping) (*pb.Mapping, error)

func (OnDiskSQLiteMetaStore) GetMappingsByIDs

func (s OnDiskSQLiteMetaStore) GetMappingsByIDs(ctx context.Context, ids ...[]byte) (map[string]*pb.Mapping, error)

func (OnDiskSQLiteMetaStore) GetStacktraceByIDs added in v0.6.0

func (o OnDiskSQLiteMetaStore) GetStacktraceByIDs(ctx context.Context, ids ...[]byte) (map[string]*pb.Sample, error)

func (OnDiskSQLiteMetaStore) GetStacktraceByKey added in v0.6.0

func (o OnDiskSQLiteMetaStore) GetStacktraceByKey(ctx context.Context, key []byte) (uuid.UUID, error)

func (OnDiskSQLiteMetaStore) GetSymbolizableLocations

func (s OnDiskSQLiteMetaStore) GetSymbolizableLocations(ctx context.Context) ([]*pb.Location, [][]byte, error)

func (OnDiskSQLiteMetaStore) Ping

func (s OnDiskSQLiteMetaStore) Ping() error

func (OnDiskSQLiteMetaStore) Symbolize

func (s OnDiskSQLiteMetaStore) Symbolize(ctx context.Context, l *Location) error

type ProfileMetaStore

type ProfileMetaStore interface {
	StacktraceStore
	LocationStore
	LocationLineStore
	FunctionStore
	MappingStore
	Close() error
	Ping() error
}

type RandomUUIDGenerator added in v0.5.0

type RandomUUIDGenerator struct{}

RandomUUIDGenerator returns a new random UUID.

func (*RandomUUIDGenerator) New added in v0.5.0

func (g *RandomUUIDGenerator) New() uuid.UUID

New returns a new UUID.

type RemoteMetaStore

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

func NewRemoteProfileMetaStore

func NewRemoteProfileMetaStore(addr string) (*RemoteMetaStore, error)

func (RemoteMetaStore) Close

func (s RemoteMetaStore) Close() error

func (RemoteMetaStore) CreateFunction

func (s RemoteMetaStore) CreateFunction(ctx context.Context, fn *pb.Function) ([]byte, error)

func (RemoteMetaStore) CreateLocation

func (s RemoteMetaStore) CreateLocation(ctx context.Context, l *Location) ([]byte, error)

func (RemoteMetaStore) CreateLocationLines added in v0.5.0

func (s RemoteMetaStore) CreateLocationLines(ctx context.Context, locID []byte, lines []LocationLine) error

func (RemoteMetaStore) CreateMapping

func (s RemoteMetaStore) CreateMapping(ctx context.Context, m *pb.Mapping) ([]byte, error)

func (RemoteMetaStore) CreateStacktrace added in v0.6.0

func (r RemoteMetaStore) CreateStacktrace(ctx context.Context, key []byte, sample *pb.Sample) (uuid.UUID, error)

func (RemoteMetaStore) GetFunctionByKey

func (s RemoteMetaStore) GetFunctionByKey(ctx context.Context, fkey *pb.Function) (*pb.Function, error)

func (RemoteMetaStore) GetFunctions

func (s RemoteMetaStore) GetFunctions(ctx context.Context) ([]*pb.Function, error)

func (RemoteMetaStore) GetFunctionsByIDs added in v0.5.0

func (s RemoteMetaStore) GetFunctionsByIDs(ctx context.Context, ids ...[]byte) (map[string]*pb.Function, error)

func (RemoteMetaStore) GetLinesByLocationIDs added in v0.5.0

func (s RemoteMetaStore) GetLinesByLocationIDs(ctx context.Context, ids ...[]byte) (map[string][]*pb.Line, [][]byte, error)

func (RemoteMetaStore) GetLocationByKey

func (s RemoteMetaStore) GetLocationByKey(ctx context.Context, lkey *Location) (*pb.Location, error)

func (RemoteMetaStore) GetLocations

func (s RemoteMetaStore) GetLocations(ctx context.Context) ([]*pb.Location, [][]byte, error)

func (RemoteMetaStore) GetLocationsByIDs

func (s RemoteMetaStore) GetLocationsByIDs(ctx context.Context, ids ...[]byte) (
	map[string]*pb.Location,
	[][]byte,
	error,
)

func (RemoteMetaStore) GetMappingByKey

func (s RemoteMetaStore) GetMappingByKey(ctx context.Context, mkey *pb.Mapping) (*pb.Mapping, error)

func (RemoteMetaStore) GetMappingsByIDs

func (s RemoteMetaStore) GetMappingsByIDs(ctx context.Context, ids ...[]byte) (map[string]*pb.Mapping, error)

func (RemoteMetaStore) GetStacktraceByIDs added in v0.6.0

func (r RemoteMetaStore) GetStacktraceByIDs(ctx context.Context, ids ...[]byte) (map[string]*pb.Sample, error)

func (RemoteMetaStore) GetStacktraceByKey added in v0.6.0

func (r RemoteMetaStore) GetStacktraceByKey(ctx context.Context, key []byte) (uuid.UUID, error)

func (RemoteMetaStore) GetSymbolizableLocations

func (s RemoteMetaStore) GetSymbolizableLocations(ctx context.Context) ([]*pb.Location, [][]byte, error)

func (RemoteMetaStore) Ping

func (s RemoteMetaStore) Ping() error

func (RemoteMetaStore) Symbolize

func (s RemoteMetaStore) Symbolize(ctx context.Context, l *Location) error

type StacktraceStore added in v0.6.0

type StacktraceStore interface {
	GetStacktraceByKey(ctx context.Context, key []byte) (uuid.UUID, error)
	GetStacktraceByIDs(ctx context.Context, ids ...[]byte) (map[string]*pb.Sample, error)
	CreateStacktrace(ctx context.Context, key []byte, sample *pb.Sample) (uuid.UUID, error)
}

type UUIDGenerator added in v0.5.0

type UUIDGenerator interface {
	New() uuid.UUID
}

UUIDGenerator returns new UUIDs.

func NewRandomUUIDGenerator added in v0.5.0

func NewRandomUUIDGenerator() UUIDGenerator

NewRandomUUIDGenerator returns a new random UUID generator.

Jump to

Keyboard shortcuts

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