agent

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: AGPL-3.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LabelsByProfiles

func LabelsByProfiles(lset labels.Labels, c *config.ProfilingConfig) []labels.Labels

LabelsByProfiles returns the labels for a given ProfilingConfig.

Types

type Agent

type Agent struct {
	agentv1.UnimplementedAgentServiceServer

	Config *Config
	services.Service
	// contains filtered or unexported fields
}

func New

func New(config *Config, logger log.Logger, pusherClientProvider PusherClientProvider) (*Agent, error)

func (*Agent) ActiveTargets

func (a *Agent) ActiveTargets() map[string][]*Target

func (*Agent) ConnectHandler

func (a *Agent) ConnectHandler() agentv1connect.AgentServiceHandler

func (*Agent) DroppedTargets

func (a *Agent) DroppedTargets() []*Target

func (*Agent) GetTargets

type ClientConfig

type ClientConfig struct {
	URL       flagext.URLValue
	BatchWait time.Duration
	BatchSize int
	Client    commonconfig.HTTPClientConfig `yaml:",inline"`
	// The tenant ID to use when pushing profiles to Phlare (default to anonymous).
	TenantID string `yaml:"tenant_id"`
}

func (*ClientConfig) RegisterFlagsWithPrefix

func (c *ClientConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlags with prefix registers flags where every name is prefixed by prefix. If prefix is a non-empty string, prefix should end with a period.

func (*ClientConfig) Validate

func (c *ClientConfig) Validate() error

type Config

type Config struct {
	ScrapeConfigs []*ScrapeConfig `yaml:"scrape_configs,omitempty"`
	ClientConfig  ClientConfig    `yaml:"client,omitempty"`
}

func (*Config) RegisterFlags

func (c *Config) RegisterFlags(flags *flag.FlagSet)

RegisterFlags registers flags.

func (*Config) Validate

func (c *Config) Validate() error

type PusherClientProvider

type PusherClientProvider func() pushv1connect.PusherServiceClient

type ScrapeConfig

type ScrapeConfig struct {
	JobName                string                       `yaml:"job_name"`
	Params                 url.Values                   `yaml:"params,omitempty"`
	ScrapeInterval         model.Duration               `yaml:"scrape_interval,omitempty"`
	ScrapeTimeout          model.Duration               `yaml:"scrape_timeout,omitempty"`
	Scheme                 string                       `yaml:"scheme,omitempty"`
	RelabelConfigs         []*relabel.Config            `yaml:"relabel_configs,omitempty"`
	ServiceDiscoveryConfig ServiceDiscoveryConfig       `yaml:",inline"`
	ProfilingConfig        *parcaconfig.ProfilingConfig `yaml:"profiling_config,omitempty"`

	HTTPClientConfig commonconfig.HTTPClientConfig `yaml:",inline"`
}

func (*ScrapeConfig) Validate

func (c *ScrapeConfig) Validate() error

type ServiceDiscoveryConfig

type ServiceDiscoveryConfig struct {
	StaticConfigs       discovery.StaticConfig `yaml:"static_configs"`
	KubernetesSDConfigs []*kubernetes.SDConfig `yaml:"kubernetes_sd_configs,omitempty"`
	HTTPSDConfigs       []*http.SDConfig       `yaml:"http_sd_configs,omitempty"`
}

func (ServiceDiscoveryConfig) Configs

func (cfg ServiceDiscoveryConfig) Configs() (res discovery.Configs)

type Target

type Target struct {
	*scrape.Target
	// contains filtered or unexported fields
}

func (*Target) GetValue

func (t *Target) GetValue(name string) string

GetValue gets a label value from the entire label set.

func (*Target) Hash

func (t *Target) Hash() uint64

hash returns an identifying hash for the target.

func (*Target) Health

func (t *Target) Health() agentv1.Health

Health returns the last known health state of the target.

func (*Target) Labels

func (t *Target) Labels() labels.Labels

func (*Target) LastError

func (t *Target) LastError() error

LastError returns the error encountered during the last scrape.

func (*Target) LastScrape

func (t *Target) LastScrape() time.Time

LastScrape returns the time of the last scrape.

func (*Target) LastScrapeDuration

func (t *Target) LastScrapeDuration() time.Duration

LastScrapeDuration returns how long the last scrape of the target took.

type TargetGroup

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

func NewTargetGroup

func NewTargetGroup(ctx context.Context, jobName string, cfg ScrapeConfig, pusherClientProvider PusherClientProvider, tenantID string, logger log.Logger) *TargetGroup

func (*TargetGroup) TargetsFromGroup added in v0.6.0

func (tg *TargetGroup) TargetsFromGroup(group *targetgroup.Group) ([]*Target, []*Target, error)

TargetsFromGroup builds targets based on the given TargetGroup and config.

type TargetManager

type TargetManager interface {
	Ready() bool
	ActiveTargets() map[string][]Target
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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