Documentation ¶
Overview ¶
Package prom implements a Prometheus-lite client for service discovery, scraping metrics into a WAL, and remote_write. Clients are broken into a set of instances, each of which contain their own set of configs.
Index ¶
- Variables
- type Agent
- func (a *Agent) Config() Config
- func (a *Agent) InstanceManager() instance.Manager
- func (a *Agent) ListInstancesHandler(w http.ResponseWriter, _ *http.Request)
- func (a *Agent) ListTargetsHandler(w http.ResponseWriter, _ *http.Request)
- func (a *Agent) Stop()
- func (a *Agent) WireAPI(r *mux.Router)
- func (a *Agent) WireGRPC(s *grpc.Server)
- type Config
- type InstanceMode
- type ListTargetsResponse
- type TargetInfo
Constants ¶
This section is empty.
Variables ¶
var ( DefaultConfig = Config{ Global: config.DefaultGlobalConfig, InstanceRestartBackoff: instance.DefaultBasicManagerConfig.InstanceRestartBackoff, ServiceConfig: ha.DefaultConfig, ServiceClientConfig: client.DefaultConfig, InstanceMode: DefaultInstanceMode, } )
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent is an agent for collecting Prometheus metrics. It acts as a Prometheus-lite; only running the service discovery, remote_write, and WAL components of Prometheus. It is broken down into a series of Instances, each of which perform metric collection.
func New ¶
func New(reg prometheus.Registerer, cfg Config, logger log.Logger) (*Agent, error)
New creates and starts a new Agent.
func (*Agent) InstanceManager ¶ added in v0.4.0
func (*Agent) ListInstancesHandler ¶
func (a *Agent) ListInstancesHandler(w http.ResponseWriter, _ *http.Request)
ListInstances writes the set of currently running instances to the http.ResponseWriter.
func (*Agent) ListTargetsHandler ¶ added in v0.5.0
func (a *Agent) ListTargetsHandler(w http.ResponseWriter, _ *http.Request)
ListTargetsHandler retrieves the full set of targets across all instances and shows information on them.
type Config ¶
type Config struct { // Whether the Prometheus subsystem should be enabled. Enabled bool `yaml:"-"` Global config.GlobalConfig `yaml:"global"` WALDir string `yaml:"wal_directory"` ServiceConfig ha.Config `yaml:"scraping_service"` ServiceClientConfig client.Config `yaml:"scraping_service_client"` Configs []instance.Config `yaml:"configs,omitempty"` InstanceRestartBackoff time.Duration `yaml:"instance_restart_backoff,omitempty"` InstanceMode InstanceMode `yaml:"instance_mode"` }
Config defines the configuration for the entire set of Prometheus client instances, along with a global configuration.
func (*Config) ApplyDefaults ¶
ApplyDefaults applies default values to the Config and validates it.
func (*Config) RegisterFlags ¶
RegisterFlags defines flags corresponding to the Config.
func (*Config) UnmarshalYAML ¶ added in v0.4.0
UnmarshalYAML implements yaml.Unmarshaler.
type InstanceMode ¶ added in v0.5.0
type InstanceMode string
InstanceMode controls how instances are created.
var ( InstanceModeDistinct InstanceMode = "distinct" DefaultInstanceMode = InstanceModeShared )
Types of instance modes
func (*InstanceMode) UnmarshalYAML ¶ added in v0.5.0
func (m *InstanceMode) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals a string to an InstanceMode. Fails if the string is unrecognized.
type ListTargetsResponse ¶ added in v0.5.0
type ListTargetsResponse []TargetInfo
ListTargetsResponse is returned by the ListTargetsHandler.
type TargetInfo ¶ added in v0.5.0
type TargetInfo struct { InstanceName string `json:"instance"` TargetGroup string `json:"target_group"` Endpoint string `json:"endpoint"` State string `json:"state"` Labels labels.Labels `json:"labels"` LastScrape time.Time `json:"last_scrape"` ScrapeDuration int64 `json:"scrape_duration_ms"` ScrapeError string `json:"scrape_error"` }
TargetInfo describes a specific target.
Directories ¶
Path | Synopsis |
---|---|
Package ha implements a high availability clustering mode for the agent.
|
Package ha implements a high availability clustering mode for the agent. |
Package instance provides a mini Prometheus scraper and remote_writer.
|
Package instance provides a mini Prometheus scraper and remote_writer. |