Documentation
¶
Index ¶
- Constants
- Variables
- func GetFuncAndLineDisplay(lang languages.Lang, smp *profile.Sample, reverse bool) string
- func GetPrintStrByLine(lang languages.Lang, line profile.Line) string
- func GetSpyPrintStr(funcName, fileName string) string
- func GetSummary(param parameter.SummaryParam, filterBySpan bool, spanIDSet *tracing.SpanIDSet) (map[events.Type]*EventSummary, int64, error)
- func IsCollapseProfile(profiles []*parameter.Profile, workspaceUUID string) (bool, error)
- func NewDecompressor(r io.Reader) io.ReadCloser
- type Aggregator
- type AggregatorOption
- type AggregatorSelect
- type AggregatorSelectForJSON
- type AggregatorSelectSlice
- type Collapse
- type DDFieldTag
- type DDTrace
- type Decompressor
- type DisplayCtl
- type EventSummary
- type Format
- type GetPropertyByLine
- type GetPropertyFunc
- type MetaData
- type OptionMap
- type OptionSlice
- type PProf
- type Parser
- type Profiler
- type PyroscopeNodejs
- type SampleFile
- type SummaryCollection
- type SummaryValueType
Constants ¶
View Source
const ( Unknown Profiler = "unknown" DDtrace = "ddtrace" AsyncProfiler = "async-profiler" PySpy Pyroscope = "pyroscope" )
View Source
const ( LabelExceptionType = "exception type" LabelThreadID = "thread id" LabelThreadNativeID = "thread native id" LabelThreadName = "thread name" LabelSpanID = "span id" LabelLocalRootSpanID = "local root span id" )
View Source
const UnknownInfo = "<unknown>"
Variables ¶
View Source
var ( Function = &Aggregator{ Name: "Function", Mapping: []string{pprof.FieldFunctionName}, ShowLanguages: languages.PythonID | languages.GolangID, GetIdentifier: getFuncIdentifier, GetDisplayStr: getFuncDisplayStr, GetMappingFuncs: []GetPropertyFunc{getFuncName}, } PHPFunction = &Aggregator{ Name: "Function", Mapping: []string{pprof.FieldFunctionName}, GetIdentifier: getFuncIdentifier, GetDisplayStr: getFuncDisplayStr, GetMappingFuncs: []GetPropertyFunc{getFuncName}, } Method = &Aggregator{ Name: "Method", Mapping: []string{pprof.FieldFunctionName}, ShowLanguages: languages.JavaID | languages.DotNetID, GetIdentifier: getMethod, GetDisplayStr: getMethod, GetMappingFuncs: []GetPropertyFunc{getMethod}, } Class = &Aggregator{ Name: "Class", Mapping: []string{pprof.FieldClass}, ShowLanguages: languages.DotNetID, GetIdentifier: getClass, GetDisplayStr: getClass, GetMappingFuncs: []GetPropertyFunc{getClass}, } Namespace = &Aggregator{ Name: "Namespace", Mapping: []string{pprof.FieldNamespace}, ShowLanguages: languages.DotNetID, GetIdentifier: getNamespace, GetDisplayStr: getNamespace, GetMappingFuncs: []GetPropertyFunc{getNamespace}, } Assembly = &Aggregator{ Name: "Assembly", Mapping: []string{pprof.FieldAssembly}, ShowLanguages: languages.DotNetID, GetIdentifier: getAssembly, GetDisplayStr: getAssembly, GetMappingFuncs: []GetPropertyFunc{getAssembly}, } PyroNodeFunction = &Aggregator{ Name: "Function", Mapping: []string{pprof.FieldFunctionName}, ShowLanguages: languages.NodeJSID, GetIdentifier: getFuncIdentifier, GetDisplayStr: getFuncDisplayStr, GetMappingFuncs: []GetPropertyFunc{getFuncName}, } FunctionLine = &Aggregator{ Name: "Function + Line", Mapping: []string{pprof.FieldFunctionName, pprof.FieldLine}, ShowLanguages: languages.PythonID | languages.GolangID, GetIdentifier: func(lang languages.Lang, smp *profile.Sample, reverse bool) string { i := 0 if reverse { i = len(smp.Location) - 1 } if len(smp.Location) > 0 { loc := smp.Location[i] if len(loc.Line) > 0 { return fmt.Sprintf("%s###%d###%d", loc.Line[len(loc.Line)-1].Function.Filename, loc.Line[len(loc.Line)-1].Function.ID, loc.Line[len(loc.Line)-1].Line) } } return "<unknown>" }, GetDisplayStr: GetFuncAndLineDisplay, GetMappingFuncs: []GetPropertyFunc{getFuncName, getLine}, } Directory = &Aggregator{ Name: "Directory", Mapping: []string{pprof.FieldDirectory}, ShowLanguages: languages.PythonID | languages.GolangID, GetIdentifier: getDirectory, GetDisplayStr: getDirectory, GetMappingFuncs: []GetPropertyFunc{getDirectory}, } File = &Aggregator{ Name: "File", Mapping: []string{pprof.FieldFile}, ShowLanguages: languages.PythonID | languages.GolangID, GetIdentifier: getFile, GetDisplayStr: getFile, GetMappingFuncs: []GetPropertyFunc{getFile}, } PyroNodeFile = &Aggregator{ Name: "File", Mapping: []string{pprof.FieldFile}, ShowLanguages: languages.NodeJSID, GetIdentifier: getFile, GetDisplayStr: getFile, GetMappingFuncs: []GetPropertyFunc{getFile}, } ThreadID = &Aggregator{ Name: "Thread ID", Mapping: []string{pprof.FieldThreadID}, ShowLanguages: languages.PythonID | languages.DotNetID, GetIdentifier: getThreadID, GetDisplayStr: getThreadID, GetMappingFuncs: []GetPropertyFunc{getThreadID}, } ThreadName = &Aggregator{ Name: "Thread Name", Mapping: []string{pprof.FieldThreadName}, ShowLanguages: languages.PythonID | languages.DotNetID, GetIdentifier: getThreadName, GetDisplayStr: getThreadName, GetMappingFuncs: []GetPropertyFunc{getThreadName}, } Package = &Aggregator{ Name: "Package", Mapping: []string{pprof.FieldPackage}, ShowLanguages: languages.GolangID, GetIdentifier: getPackageName, GetDisplayStr: getPackageName, GetMappingFuncs: []GetPropertyFunc{getPackageName}, } )
View Source
var ( ZIPMagic = []byte{0x50, 0x4b, 3, 4} LZ4Magic = []byte{4, 34, 77, 24} GZIPMagic = []byte{31, 139} )
View Source
var DDTraceDotnetAggregatorList = []*Aggregator{ Method, Class, Namespace, Assembly, ThreadID, ThreadName, }
View Source
var DDTracePHPAggregatorList = []*Aggregator{ PHPFunction, FunctionLine, Class, File, Directory, }
View Source
var GoAggregatorList = []*Aggregator{ Function, FunctionLine, Directory, File, Package, }
View Source
var PyroscopeNodeJSAggregatorList = []*Aggregator{ PyroNodeFunction, PyroNodeFile, }
View Source
var PythonAggregatorList = []*Aggregator{ Function, FunctionLine, Directory, File, ThreadID, ThreadName, }
View Source
var SpyAggregatorList = []*Aggregator{ Function, FunctionLine, Directory, File, ThreadName, }
Functions ¶
func GetFuncAndLineDisplay ¶
func GetSpyPrintStr ¶
func GetSummary ¶
func GetSummary(param parameter.SummaryParam, filterBySpan bool, spanIDSet *tracing.SpanIDSet) (map[events.Type]*EventSummary, int64, error)
func IsCollapseProfile ¶
func NewDecompressor ¶
func NewDecompressor(r io.Reader) io.ReadCloser
Types ¶
type Aggregator ¶
type Aggregator struct { Name string Mapping []string ShowLanguages languages.LangID // GetIdentifier 获取维度的唯一标识 GetIdentifier GetPropertyFunc // GetDisplayStr 获取维度的显示字符 GetDisplayStr GetPropertyFunc // GetMappingFuncs, 获取与Mapping字段对应值Func GetMappingFuncs []GetPropertyFunc }
type AggregatorOption ¶
type AggregatorOption struct { Title string `json:"title"` Quantity *quantity.Quantity `json:"quantity"` Value int64 `json:"value"` Unit *quantity.Unit `json:"unit"` Percent string `json:"percent"` MappingValues []string `json:"mappingValues"` }
func (*AggregatorOption) CalcPercentAndQuantity ¶
func (ao *AggregatorOption) CalcPercentAndQuantity(total int64)
type AggregatorSelect ¶
type AggregatorSelect struct { Aggregator *Aggregator Mapping []string Options OptionMap }
type AggregatorSelectForJSON ¶
type AggregatorSelectForJSON struct { Dimension string `json:"dimension"` Mapping []string `json:"mapping"` Options OptionSlice `json:"data"` }
type AggregatorSelectSlice ¶
type AggregatorSelectSlice []*AggregatorSelect
func ParseRawFlameGraph ¶
func ParseRawFlameGraph(filename string) (*pprof.Frame, AggregatorSelectSlice, error)
func (AggregatorSelectSlice) CalcPercentAndQuantity ¶
func (asm AggregatorSelectSlice) CalcPercentAndQuantity(total int64)
func (AggregatorSelectSlice) MarshalJSON ¶
func (asm AggregatorSelectSlice) MarshalJSON() ([]byte, error)
type Collapse ¶
type Collapse struct {
// contains filtered or unexported fields
}
func NewCollapse ¶
func (*Collapse) ResolveFlameGraph ¶
type DDFieldTag ¶
type DDFieldTag string
const ( AssemblyTag DDFieldTag = "|lm:" NamespaceTag DDFieldTag = "|ns:" ClassTag DDFieldTag = "|ct:" MethodTag DDFieldTag = "|fn:" )
type Decompressor ¶
func (*Decompressor) Close ¶
func (d *Decompressor) Close() error
type DisplayCtl ¶
type EventSummary ¶
type EventSummary = pprof.EventSummary
type Format ¶
type Format string
const ( FlameGraph Format = "flamegraph" // see https://github.com/brendangregg/FlameGraph //Deprecated use Collapsed instead RawFlameGraph Format = "rawflamegraph" // flamegraph collapse Collapsed Format = "collapse" // flamegraph collapse format see https://github.com/brendangregg/FlameGraph/blob/master/stackcollapse.pl SpeedScope Format = "speedscope" // see https://github.com/jlfwong/speedscope JFR Format = "jfr" // see https://github.com/openjdk/jmc#core-api-example PPROF Format = "pprof" // see https://github.com/google/pprof/blob/main/proto/profile.proto )
type GetPropertyFunc ¶
type MetaData ¶
type MetaData struct { Format Format `json:"format"` Profiler Profiler `json:"profiler"` Attachments []string `json:"attachments"` }
func ReadMetaData ¶
func ReadMetaDataFile ¶
type OptionMap ¶
type OptionMap map[string]*AggregatorOption
type OptionSlice ¶
type OptionSlice []*AggregatorOption
func (OptionSlice) Len ¶
func (os OptionSlice) Len() int
func (OptionSlice) Less ¶
func (os OptionSlice) Less(i, j int) bool
func (OptionSlice) Swap ¶
func (os OptionSlice) Swap(i, j int)
type PProf ¶
type PProf struct { DisplayCtl // contains filtered or unexported fields }
func NewPProfParser ¶
func (*PProf) ResolveFlameGraph ¶
func (p *PProf) ResolveFlameGraph(eventType events.Type) (*pprof.Frame, AggregatorSelectSlice, error)
ResolveFlameGraph (lang languages.Lang, eType events.Type, pprofSampleType string, filterBySpan bool, span *parameter.Span, spanIDSet *dql.SpanIDSet)
type PyroscopeNodejs ¶
type PyroscopeNodejs struct{}
func (*PyroscopeNodejs) ShowInProfile ¶
func (p *PyroscopeNodejs) ShowInProfile(_ events.Type) bool
func (*PyroscopeNodejs) ShowInTrace ¶
func (p *PyroscopeNodejs) ShowInTrace(_ events.Type) bool
type SampleFile ¶
func GetFileByEvent ¶
type SummaryCollection ¶
type SummaryCollection = pprof.SummaryCollection
type SummaryValueType ¶
type SummaryValueType = pprof.SummaryValueType
Click to show internal directories.
Click to hide internal directories.