segment

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const ProfileIDLabelName = "profile_id"

Variables

This section is empty.

Functions

func AppSegmentKey added in v0.23.0

func AppSegmentKey(appName string) string

func FromTreeToDictKey added in v0.0.37

func FromTreeToDictKey(k string) string

FromTreeToDictKey returns app name from tree key k: given tree key "foo{}:0:1234567890", the call returns "foo".

Before tags support, segment key form (i.e. app name + tags: foo{key=value}) has been used to reference a dictionary (trie).

func ParseTreeKey added in v0.2.5

func ParseTreeKey(k string) (time.Time, int, error)

ParseTreeKey retrieves tree time and depth level from the given key.

func TreeKey added in v0.2.5

func TreeKey(k string, depth int, unixTime int64) string

Types

type Addon

type Addon struct {
	Depth int
	T     time.Time
}

type Key added in v0.0.37

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

func NewKey added in v0.0.37

func NewKey(labels map[string]string) *Key

func ParseKey added in v0.0.37

func ParseKey(name string) (*Key, error)

func (*Key) Add added in v0.0.38

func (k *Key) Add(key, value string)

func (*Key) AppName added in v0.0.37

func (k *Key) AppName() string

func (*Key) Clone added in v0.3.0

func (k *Key) Clone() *Key

func (*Key) DictKey added in v0.0.37

func (k *Key) DictKey() string

func (*Key) HasProfileID added in v0.9.0

func (k *Key) HasProfileID() bool

func (*Key) Labels added in v0.0.37

func (k *Key) Labels() map[string]string

func (*Key) Match added in v0.2.1

func (k *Key) Match(q *flameql.Query) bool

Match reports whether the key matches the query.

func (*Key) Normalized added in v0.0.37

func (k *Key) Normalized() string

func (*Key) ProfileID added in v0.12.0

func (k *Key) ProfileID() (string, bool)

func (*Key) SegmentKey added in v0.0.37

func (k *Key) SegmentKey() string

func (*Key) TreeKey added in v0.0.37

func (k *Key) TreeKey(depth int, t time.Time) string

type ParserState added in v0.0.37

type ParserState int

type RetentionPolicy added in v0.2.5

type RetentionPolicy struct {
	AbsoluteTime time.Time
	Levels       map[int]time.Time

	ExemplarsRetentionTime time.Time
	// contains filtered or unexported fields
}

func NewRetentionPolicy added in v0.2.5

func NewRetentionPolicy() *RetentionPolicy

func (RetentionPolicy) LowerTimeBoundary added in v0.2.5

func (r RetentionPolicy) LowerTimeBoundary() time.Time

func (*RetentionPolicy) SetAbsolutePeriod added in v0.2.5

func (r *RetentionPolicy) SetAbsolutePeriod(period time.Duration) *RetentionPolicy

func (*RetentionPolicy) SetExemplarsRetentionPeriod added in v0.14.0

func (r *RetentionPolicy) SetExemplarsRetentionPeriod(period time.Duration) *RetentionPolicy

func (*RetentionPolicy) SetLevelPeriod added in v0.2.5

func (r *RetentionPolicy) SetLevelPeriod(level int, period time.Duration) *RetentionPolicy

func (*RetentionPolicy) SetLevels added in v0.14.0

func (r *RetentionPolicy) SetLevels(levels ...time.Duration) *RetentionPolicy

type Segment

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

func Deserialize

func Deserialize(r io.Reader) (*Segment, error)

func FromBytes

func FromBytes(p []byte) (*Segment, error)

func New

func New() *Segment

func (*Segment) AggregationType added in v0.0.30

func (s *Segment) AggregationType() metadata.AggregationType

func (*Segment) Bytes

func (s *Segment) Bytes() ([]byte, error)

func (*Segment) DeleteNodesBefore added in v0.2.5

func (s *Segment) DeleteNodesBefore(t *RetentionPolicy) (bool, error)

func (*Segment) Get

func (s *Segment) Get(st, et time.Time, cb func(depth int, samples, writes uint64, t time.Time, r *big.Rat))

func (*Segment) GetContext added in v0.7.2

func (s *Segment) GetContext(ctx context.Context, st, et time.Time, cb func(depth int, samples, writes uint64, t time.Time, r *big.Rat))

func (*Segment) Put

func (s *Segment) Put(st, et time.Time, samples uint64, cb func(depth int, t time.Time, r *big.Rat, addons []Addon)) error

TODO: simplify arguments TODO: validate st < et

func (*Segment) SampleRate

func (s *Segment) SampleRate() uint32

func (*Segment) Serialize

func (s *Segment) Serialize(w io.Writer) error

func (*Segment) SetMetadata

func (s *Segment) SetMetadata(spyName string, sampleRate uint32, units metadata.Units, aggregationType metadata.AggregationType)

TODO: this should be refactored

func (*Segment) SpyName

func (s *Segment) SpyName() string

func (*Segment) StartTime added in v0.0.33

func (s *Segment) StartTime() time.Time

func (*Segment) Units added in v0.0.30

func (s *Segment) Units() metadata.Units

func (*Segment) Visualize

func (s *Segment) Visualize()

This is here for debugging

func (*Segment) WalkNodesToDelete added in v0.2.5

func (s *Segment) WalkNodesToDelete(t *RetentionPolicy, cb func(depth int, t time.Time) error) (bool, error)

type Timeline

type Timeline struct {
	StartTime int64    `json:"startTime"`
	Samples   []uint64 `json:"samples"`

	DurationDeltaNormalized int64 `json:"durationDelta"`

	// Watermarks map contains down-sampling watermarks (Unix timestamps)
	// describing resolution levels of the timeline.
	//
	// Resolution in seconds is calculated as 10^k, where k is the map key.
	// Meaning that any range within these 10^k seconds contains not more
	// than one sample. Any sub-range less than 10^k shows down-sampled data.
	//
	// Given the map:
	//  1: 1635508310
	//  2: 1635507500
	//  3: 1635506200
	//
	// This should be read as follows:
	//  1. Data after 1635508310 is as precise as possible (10s resolution),
	//     down-sampling was not applied.
	//  2. Data before 1635508310 has resolution 100s
	//  3. Data before 1635507500 has resolution 1000s
	//  4. Data before 1635506200 has resolution 10000s
	Watermarks map[int]int64 `json:"watermarks"`
	// contains filtered or unexported fields
}

func GenerateTimeline

func GenerateTimeline(st, et time.Time) *Timeline

func (*Timeline) PopulateTimeline

func (tl *Timeline) PopulateTimeline(s *Segment)

type TmpltVars

type TmpltVars struct {
	Data string
}

Jump to

Keyboard shortcuts

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