internal

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuntimeGolang = "golang"

	CategoryCPU    = "cpu"
	CategoryMemory = "memory"
	CategoryTime   = "time"

	TypeCPUUsage         = "cpu-usage"
	TypeMemoryAllocation = "memory-allocations"
	TypeBlockingCalls    = "blocking-calls"

	UnitSample      = "sample"
	UnitMillisecond = "millisecond"
	UnitMicrosecond = "microsecond"
	UnitNanosecond  = "nanosecond"
	UnitByte        = "byte"
	UnitKilobyte    = "kilobyte"
	UnitPercent     = "percent"
)
View Source
const (
	DefaultMaxBufferedProfiles = 100
)

Variables

View Source
var (
	IncludeProfilerFrames = false
)

Functions

func GenerateUUID

func GenerateUUID() string

func NoopSendProfiles

func NoopSendProfiles([]AgentProfile) error

NoopSendProfiles is the default function to be called by Recorded to send collected profiles

Types

type AgentCallSite added in v1.13.2

type AgentCallSite struct {
	MethodName  string          `json:"method_name"`
	FileName    string          `json:"file_name"`
	FileLine    int64           `json:"file_line"`
	Measurement float64         `json:"measurement"`
	NumSamples  int64           `json:"num_samples"`
	Children    []AgentCallSite `json:"children"`
}

AgentCallSite is a presenter type used to serialize a call site to JSON format supported by Instana profile sensor

func NewAgentCallSite added in v1.13.2

func NewAgentCallSite(cs *CallSite) AgentCallSite

type AgentProfile added in v1.13.2

type AgentProfile struct {
	ID        string          `json:"id"`
	Runtime   string          `json:"runtime"`
	Category  string          `json:"category"`
	Type      string          `json:"type"`
	Unit      string          `json:"unit"`
	Roots     []AgentCallSite `json:"roots"`
	Duration  int64           `json:"duration"`
	Timespan  int64           `json:"timespan"`
	Timestamp int64           `json:"timestamp"`
}

AgentProfile is a presenter type used to serialize a collected profile to JSON format supported by Instana profile sensor

func NewAgentProfile added in v1.13.2

func NewAgentProfile(p *Profile) AgentProfile

type AllocationSampler

type AllocationSampler struct{}

func NewAllocationSampler

func NewAllocationSampler() *AllocationSampler

func (*AllocationSampler) Profile

func (as *AllocationSampler) Profile(duration int64, timespan int64) (*Profile, error)

func (*AllocationSampler) Reset

func (as *AllocationSampler) Reset()

func (*AllocationSampler) Start

func (as *AllocationSampler) Start() error

func (*AllocationSampler) Stop

func (as *AllocationSampler) Stop() error

type BlockSampler

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

func NewBlockSampler

func NewBlockSampler() *BlockSampler

func (*BlockSampler) Profile

func (bs *BlockSampler) Profile(duration, timespan int64) (*Profile, error)

func (*BlockSampler) Reset

func (bs *BlockSampler) Reset()

func (*BlockSampler) Start

func (bs *BlockSampler) Start() error

func (*BlockSampler) Stop

func (bs *BlockSampler) Stop() error

type CPUSampler

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

func NewCPUSampler

func NewCPUSampler() *CPUSampler

func (*CPUSampler) Profile

func (cs *CPUSampler) Profile(duration int64, timespan int64) (*Profile, error)

func (*CPUSampler) Reset

func (cs *CPUSampler) Reset()

func (*CPUSampler) Start

func (cs *CPUSampler) Start() error

func (*CPUSampler) Stop

func (cs *CPUSampler) Stop() error

type CallSite

type CallSite struct {
	MethodName string
	FileName   string
	FileLine   int64
	Metadata   map[string]string
	// contains filtered or unexported fields
}

func NewCallSite

func NewCallSite(methodName string, fileName string, fileLine int64) *CallSite

func (*CallSite) FindOrAddChild

func (cs *CallSite) FindOrAddChild(methodName, fileName string, fileLine int64) *CallSite

func (*CallSite) Increment

func (cs *CallSite) Increment(value float64, numSamples int64)

func (*CallSite) Measurement

func (cs *CallSite) Measurement() (value float64, numSamples int64)

type Flag

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

func (*Flag) IsSet

func (f *Flag) IsSet() bool

func (*Flag) Set

func (f *Flag) Set()

func (*Flag) SetIfUnset

func (f *Flag) SetIfUnset() bool

func (*Flag) Unset

func (f *Flag) Unset()

func (*Flag) UnsetIfSet

func (f *Flag) UnsetIfSet() bool

type Profile

type Profile struct {
	ID        string
	Runtime   string
	Category  string
	Type      string
	Unit      string
	Roots     []*CallSite
	Duration  int64
	Timespan  int64
	Timestamp int64
}

func NewProfile

func NewProfile(category string, typ string, unit string, roots []*CallSite, duration int64, timespan int64) *Profile

type Recorder

type Recorder struct {
	FlushInterval       int64
	MaxBufferedProfiles int
	SendProfiles        SendProfilesFunc
	// contains filtered or unexported fields
}

func NewRecorder

func NewRecorder() *Recorder

func (*Recorder) Flush

func (pr *Recorder) Flush()

func (*Recorder) Record

func (pr *Recorder) Record(record AgentProfile)

func (*Recorder) Size

func (pr *Recorder) Size() int

func (*Recorder) Start

func (pr *Recorder) Start()

func (*Recorder) Stop

func (pr *Recorder) Stop()

type Sampler

type Sampler interface {
	Profile(duration int64, timespan int64) (*Profile, error)
	Start() error
	Stop() error
	Reset()
}

type SamplerConfig

type SamplerConfig struct {
	LogPrefix          string
	ReportOnly         bool
	MaxProfileDuration int64
	MaxSpanDuration    int64
	MaxSpanCount       int32
	SamplingInterval   int64
	ReportInterval     int64
}

type SamplerScheduler

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

func NewSamplerScheduler

func NewSamplerScheduler(profileRecorder *Recorder, samp Sampler, config SamplerConfig) *SamplerScheduler

func (*SamplerScheduler) Report

func (ss *SamplerScheduler) Report()

func (*SamplerScheduler) Reset

func (ss *SamplerScheduler) Reset()

func (*SamplerScheduler) Start

func (ss *SamplerScheduler) Start()

func (*SamplerScheduler) Stop

func (ss *SamplerScheduler) Stop()

type SendProfilesFunc

type SendProfilesFunc func([]AgentProfile) error

SendProfilesFunc is a callback to emit collected profiles from recorder

type Timer

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

Timer periodically executes provided job after a delay until it's stopped. Any panic occurred inside the job is recovered and logged

func NewTimer

func NewTimer(delay, interval time.Duration, job func()) *Timer

func (*Timer) Stop

func (t *Timer) Stop()

Stop stops the job execution

Directories

Path Synopsis
pprof
profile
Package profile provides a representation of profile.proto and methods to encode/decode profiles in this format.
Package profile provides a representation of profile.proto and methods to encode/decode profiles in this format.

Jump to

Keyboard shortcuts

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