agent

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogFormatLogfmt = "logfmt"
	LogFormatJSON   = "json"
)

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(logLevel, logFormat, debugName string) log.Logger

NewLogger returns a log.Logger that prints in the provided format at the provided level with a UTC timestamp and the caller of the log entry. If non empty, the debug name is also appended as a field to all log lines. Panics if the log level is not error, warn, info or debug. Log level is expected to be validated before passed to this function.

Types

type CgroupProfiler

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

func NewCgroupProfiler

func NewCgroupProfiler(
	logger log.Logger,
	externalLabels map[string]string,
	ksymCache *ksym.KsymCache,
	writeClient profilestorepb.ProfileStoreServiceClient,
	debugInfoClient DebugInfoClient,
	target CgroupProfilingTarget,
	sink func(Record),
	tmp string,
) *CgroupProfiler

func (*CgroupProfiler) Labels

func (p *CgroupProfiler) Labels() []*profilestorepb.Label

func (*CgroupProfiler) LastError

func (p *CgroupProfiler) LastError() error

func (*CgroupProfiler) LastProfileTakenAt

func (p *CgroupProfiler) LastProfileTakenAt() time.Time

func (*CgroupProfiler) Run

func (p *CgroupProfiler) Run(ctx context.Context) error

func (*CgroupProfiler) Stop

func (p *CgroupProfiler) Stop()

type CgroupProfilingTarget

type CgroupProfilingTarget interface {
	PerfEventCgroupPath() string
	Labels() []*profilestorepb.Label
}

type DebugInfoClient

type DebugInfoClient interface {
	Exists(ctx context.Context, buildID string) (bool, error)
	Upload(ctx context.Context, buildID string, f io.Reader) (uint64, error)
}

func NewNoopDebugInfoClient

func NewNoopDebugInfoClient() DebugInfoClient

type NoopDebugInfoClient

type NoopDebugInfoClient struct{}

func (*NoopDebugInfoClient) Exists

func (c *NoopDebugInfoClient) Exists(ctx context.Context, buildID string) (bool, error)

func (*NoopDebugInfoClient) Upload

func (c *NoopDebugInfoClient) Upload(ctx context.Context, buildID string, f io.Reader) (uint64, error)

type NoopProfileStoreClient

type NoopProfileStoreClient struct{}

func (*NoopProfileStoreClient) WriteRaw

type PodManager

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

func NewPodManager

func NewPodManager(
	logger log.Logger,
	externalLabels map[string]string,
	nodeName string,
	podLabelSelector string,
	samplingRatio float64,
	ksymCache *ksym.KsymCache,
	writeClient profilestorepb.ProfileStoreServiceClient,
	debugInfoClient DebugInfoClient,
	tmp string,
) (*PodManager, error)

func (*PodManager) ActiveProfilers

func (m *PodManager) ActiveProfilers() []Profiler

func (*PodManager) Run

func (g *PodManager) Run(ctx context.Context) error

func (*PodManager) SetSink

func (g *PodManager) SetSink(sink func(Record))

type Profiler

type Profiler interface {
	Labels() []*profilestorepb.Label
	LastProfileTakenAt() time.Time
	LastError() error
}

type Record

type Record struct {
	Labels  []*profilestorepb.Label
	Profile *profile.Profile
}

type SystemdManager

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

func NewSystemdManager

func NewSystemdManager(
	logger log.Logger,
	nodeName string,
	units []string,
	samplingRatio float64,
	externalLabels map[string]string,
	ksymCache *ksym.KsymCache,
	writeClient profilestorepb.ProfileStoreServiceClient,
	debugInfoClient DebugInfoClient,
	tmp string,
) *SystemdManager

func (*SystemdManager) ActiveProfilers

func (m *SystemdManager) ActiveProfilers() []Profiler

func (*SystemdManager) Run

func (m *SystemdManager) Run(ctx context.Context) error

func (*SystemdManager) SetSink

func (m *SystemdManager) SetSink(sink func(Record))

type SystemdUnitTarget

type SystemdUnitTarget struct {
	Name     string
	NodeName string
}

func (*SystemdUnitTarget) Labels

func (t *SystemdUnitTarget) Labels() []*profilestorepb.Label

func (*SystemdUnitTarget) PerfEventCgroupPath

func (t *SystemdUnitTarget) PerfEventCgroupPath() string

type TargetManager

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

func NewTargetManager

func NewTargetManager(sources []TargetSource) *TargetManager

func (*TargetManager) ActiveProfilers

func (m *TargetManager) ActiveProfilers() []Profiler

func (*TargetManager) NextMatchingProfile

func (m *TargetManager) NextMatchingProfile(ctx context.Context, matchers []*labels.Matcher) (*profile.Profile, error)

func (*TargetManager) Observe

func (m *TargetManager) Observe(f func(Record)) *observer

func (*TargetManager) ObserveProfile

func (m *TargetManager) ObserveProfile(r Record)

func (*TargetManager) RemoveObserver

func (m *TargetManager) RemoveObserver(o *observer)

type TargetSource

type TargetSource interface {
	SetSink(func(Record))
	ActiveProfilers() []Profiler
}

Jump to

Keyboard shortcuts

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