storage

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProfileNotFound = errors.New("profile not found")
)

Functions

func BuildTimeKey

func BuildTimeKey(datetime time.Time) []byte

func CompareKey

func CompareKey(k, max []byte) bool

func Intersect

func Intersect(slice1, slice2 []string) []string

Intersect 交集

func Union

func Union(slice1, slice2 []string) []string

Union 并集

Types

type Label

type Label struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type LabelFilter

type LabelFilter struct {
	Label
	// contains filtered or unexported fields
}

func (LabelFilter) Policy

func (f LabelFilter) Policy(slice1, slice2 []string) []string

type ProfileMeta

type ProfileMeta struct {
	ProfileID      string  `json:"profile_id"`
	ProfileType    string  `json:"profile_type"`
	SampleType     string  `json:"sample_type"`
	TargetName     string  `json:"target_name"`
	Instance       string  `json:"instance"`
	SampleTypeUnit string  `json:"sample_type_unit"`
	Value          int64   `json:"value"`
	Timestamp      int64   `json:"timestamp"`
	Duration       int64   `json:"duration"`
	Labels         []Label `json:"labels"`
}

func (*ProfileMeta) Decode

func (meta *ProfileMeta) Decode(v []byte) error

func (*ProfileMeta) Encode

func (meta *ProfileMeta) Encode() ([]byte, error)

type ProfileMetaByTarget

type ProfileMetaByTarget struct {
	Key          string         `json:"key"`
	ProfileMetas []*ProfileMeta `json:"profile_metas"`
}

type Store

type Store interface {
	// GetProfile Get profile binaries by profile id, return profile binaries
	GetProfile(id string) (string, []byte, error)

	// SaveProfile Save profile,return profile id
	// data: binary profile data
	// ttl: profile expiration time
	SaveProfile(name string, data []byte, ttl time.Duration) (string, error)

	// SaveProfileMeta Save profile meta data
	SaveProfileMeta(metas []*ProfileMeta, ttl time.Duration) error

	// ListProfileMeta Get profile mete data list
	ListProfileMeta(sampleType string, startTime, endTime time.Time, filters ...LabelFilter) ([]*ProfileMetaByTarget, error)

	// ListSampleType Get collected sample types list (heap_alloc_objects ,heap_alloc_space ,heap_inuse_objects ,heap_inuse_space...)
	ListSampleType() ([]string, error)

	// ListTarget  Get collection target list
	ListTarget() ([]string, error)

	// ListLabel  Get collection target labels list
	ListLabel() ([]Label, error)

	// Release Store
	Release()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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