api

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Error         EventType = "error"
	FlameGraph    EventType = "flamegraph"
	SpeedScope    EventType = "speedscope"
	Jfr           EventType = "jfr"
	ThreadDump    EventType = "threaddump"
	HeapDump      EventType = "heapdump"
	HeapHistogram EventType = "heaphistogram"
	Flat          EventType = "flat"
	Traces        EventType = "traces"
	Collapsed     EventType = "collapsed"
	Tree          EventType = "tree"
	Progress      EventType = "progress"
	Result        EventType = "result"
	Log           EventType = "log"

	Started ProgressStage = "started"
	Ended   ProgressStage = "ended"
)

Variables

View Source
var GetContainerRuntimeRootPath = map[ContainerRuntime]string{
	Crio:       "/var/lib/containers/storage/",
	Containerd: "/run/containerd/",
}
View Source
var GetOutputTypesByProfilingTool = map[ProfilingTool][]EventType{
	AsyncProfiler: {FlameGraph, Jfr, Flat, Traces, Collapsed, Tree},
	Jcmd:          {Jfr, ThreadDump, HeapDump, HeapHistogram},
	Pyspy:         {FlameGraph, SpeedScope, ThreadDump},
	Bpf:           {FlameGraph},
	Perf:          {FlameGraph},
	Rbspy:         {FlameGraph},
	FakeTool:      {FlameGraph},
}

GetOutputTypesByProfilingTool Gets the list of EventType related to the ProfilingTool that they will be considered as output types. The first one is considered the default

View Source
var GetProfilingTool = func(l ProgrammingLanguage, e EventType) ProfilingTool {
	switch l {
	case Java:
		switch e {
		case Jfr, ThreadDump, HeapDump, HeapHistogram:
			return Jcmd
		case FlameGraph, Flat, Traces, Collapsed, Tree:
			return AsyncProfiler
		}
	case Python:
		return Pyspy
	case Go, Node, Clang, ClangPlusPlus:
		return Bpf
	case Ruby:
		return Rbspy
	}

	return GetProfilingToolsByProgrammingLanguage[l][0]
}

GetProfilingTool Gets profiling tool related to the programming language and output event type.

View Source
var GetProfilingToolsByProgrammingLanguage = map[ProgrammingLanguage][]ProfilingTool{
	Java:          {Jcmd, AsyncProfiler},
	Python:        {Pyspy},
	Go:            {Bpf},
	Node:          {Bpf, Perf},
	Clang:         {Bpf, Perf},
	ClangPlusPlus: {Bpf, Perf},
	Ruby:          {Rbspy},
	FakeLang:      {FakeTool},
}

GetProfilingToolsByProgrammingLanguage Gets profiling tool related to the programming language. The first one is considered the default

View Source
var (
	ProfilingTools = []ProfilingTool{AsyncProfiler, Jcmd, Pyspy, Bpf, Perf, Rbspy}
)

Functions

func AvailableOutputTypesString added in v0.6.2

func AvailableOutputTypesString() string

func AvailableProfilingToolsString added in v0.5.0

func AvailableProfilingToolsString() string

func GetDataStructByType

func GetDataStructByType(t EventType) interface{}

func IsSupportedContainerRuntime

func IsSupportedContainerRuntime(runtime string) bool

func IsSupportedEvent

func IsSupportedEvent(event string) bool

func IsSupportedLanguage

func IsSupportedLanguage(lang string) bool

func IsSupportedLogLevel

func IsSupportedLogLevel(event string) bool

func IsSupportedOutputType added in v0.5.0

func IsSupportedOutputType(outputType string) bool

func IsSupportedProfilingTool added in v0.5.0

func IsSupportedProfilingTool(profilingTool string) bool

func IsValidOutputType added in v0.5.0

func IsValidOutputType(eventType EventType, profilingTool ProfilingTool) bool

IsValidOutputType Identifies if given EventType is valid for the also given ProfilingTool

func IsValidProfilingTool added in v0.5.0

func IsValidProfilingTool(tool ProfilingTool, language ProgrammingLanguage) bool

IsValidProfilingTool Identifies if given ProfilingTool is valid for the also given ProgrammingLanguage

func ParseEvent

func ParseEvent(eventString string) (interface{}, error)

Types

type ContainerRuntime

type ContainerRuntime string
const (
	Crio                                               ContainerRuntime = "crio"
	Containerd                                         ContainerRuntime = "containerd"
	FakeContainer                                      ContainerRuntime = "fake"
	FakeContainerWithRootFileSystemLocationResultError ContainerRuntime = "fakeWithRootFileSystemLocationResultError"
	FakeContainerWithPIDResultError                    ContainerRuntime = "fakeWithPIDResultError"
)

func AvailableContainerRuntimes

func AvailableContainerRuntimes() []ContainerRuntime

type ErrorData

type ErrorData struct {
	Reason string `json:"reason"`
}

type Event

type Event struct {
	Type EventType            `json:"type"`
	Data *jsoniter.RawMessage `json:"data"`
}

type EventType

type EventType string

func AvailableOutputTypes added in v0.5.0

func AvailableOutputTypes() []EventType

type LogData

type LogData struct {
	Time  time.Time `json:"time"`
	Level string    `json:"level"`
	Msg   string    `json:"msg"`
}

type LogLevel

type LogLevel string
const (
	InfoLevel  LogLevel = "info"
	WarnLevel  LogLevel = "warn"
	DebugLevel LogLevel = "debug"
	ErrorLevel LogLevel = "error"
)

func AvailableLogLevels

func AvailableLogLevels() []LogLevel

type ProfilingEvent

type ProfilingEvent string
const (
	Cpu         ProfilingEvent = "cpu"
	Alloc       ProfilingEvent = "alloc"
	Lock        ProfilingEvent = "lock"
	CacheMisses ProfilingEvent = "cache-misses"
	Wall        ProfilingEvent = "wall"
	Itimer      ProfilingEvent = "itimer"
)

func AvailableEvents

func AvailableEvents() []ProfilingEvent

type ProfilingTool added in v0.5.0

type ProfilingTool string
const (
	AsyncProfiler ProfilingTool = "async-profiler"
	Jcmd          ProfilingTool = "jcmd"
	Pyspy         ProfilingTool = "pyspy"
	Bpf           ProfilingTool = "bpf"
	Perf          ProfilingTool = "perf"
	Rbspy         ProfilingTool = "rbspy"
	FakeTool      ProfilingTool = "fake"
)

func AvailableProfilingTools added in v0.5.0

func AvailableProfilingTools() []ProfilingTool

type ProgrammingLanguage

type ProgrammingLanguage string
const (
	Java          ProgrammingLanguage = "java"
	Go            ProgrammingLanguage = "go"
	Python        ProgrammingLanguage = "python"
	Ruby          ProgrammingLanguage = "ruby"
	Node          ProgrammingLanguage = "node"
	Clang         ProgrammingLanguage = "clang"
	ClangPlusPlus ProgrammingLanguage = "clang++"
	FakeLang      ProgrammingLanguage = "fake"
)

func AvailableLanguages

func AvailableLanguages() []ProgrammingLanguage

type ProgressData

type ProgressData struct {
	Time  time.Time     `json:"time"`
	Stage ProgressStage `json:"stage"`
}

type ProgressStage

type ProgressStage string

type ResultData added in v0.7.0

type ResultData struct {
	Time           time.Time `json:"time"`
	ResultType     EventType `json:"result-type"`
	File           string    `json:"file,omitempty"`
	CompressorType string    `json:"compressor-type,omitempty"`
}

Jump to

Keyboard shortcuts

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