api

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Error       EventType = "error"
	FlameGraph  EventType = "flamegraph"
	Jfr         EventType = "jfr"
	Raw         EventType = "raw"
	StackThread EventType = "stackthread"
	Progress    EventType = "progress"
	Log         EventType = "log"

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

Variables

View Source
var GetContainerRuntimeRootPath = map[ContainerRuntime]string{
	Docker:     "/var/lib/docker/",
	Crio:       "/var/lib/containers/storage/",
	Containerd: "/run/containerd/",
}
View Source
var GetOutputTypesByProfilingTool = map[ProfilingTool][]EventType{
	AsyncProfiler: {FlameGraph, Jfr},
	Jcmd:          {Jfr},
	Pyspy:         {FlameGraph, Raw},
	Bpf:           {FlameGraph},
	Perf:          {FlameGraph},
	Rbspy:         {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 GetProfilingToolsByProgrammingLanguage = map[ProgrammingLanguage][]ProfilingTool{
	Java:   {AsyncProfiler, Jcmd},
	Python: {Pyspy},
	Go:     {Bpf},
	Node:   {Bpf, Perf},
	Ruby:   {Rbspy},
}

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 AvailableProfilingToolsString added in v0.5.0

func AvailableProfilingToolsString() string

func GetDataStructByType

func GetDataStructByType(t EventType) interface{}

func IsSupportedCompressor added in v0.2.0

func IsSupportedCompressor(compressor string) bool

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)

func PublishError

func PublishError(err error)

func PublishEvent

func PublishEvent(eventType EventType, data interface{}) error

func PublishLogEvent

func PublishLogEvent(level LogLevel, msg string)

Types

type Compressor added in v0.2.0

type Compressor string
const (
	None   Compressor = "none"
	Snappy Compressor = "snappy"
	Gzip   Compressor = "gzip"
	Lzo    Compressor = "lzo"
	Zstd   Compressor = "zstd"
)

func AvailableCompressors added in v0.2.0

func AvailableCompressors() []Compressor

type ContainerRuntime

type ContainerRuntime string
const (
	Docker     ContainerRuntime = "docker"
	Crio       ContainerRuntime = "crio"
	Containerd ContainerRuntime = "containerd"
)

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 OutputData added in v0.5.0

type OutputData struct {
	EncodedData string `json:"encoded_data"`
}

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"
)

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"
	//Deprecated: NodeWithPerf is deprecated. This option will be removed. Use instead Node, that use BPF for running profiling
	NodeWithPerf ProgrammingLanguage = "node-perf"
)

func AvailableLanguages

func AvailableLanguages() []ProgrammingLanguage

type ProgressData

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

type ProgressStage

type ProgressStage string

Jump to

Keyboard shortcuts

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