blackbox

package
v16.9.5 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Fetch exercises the equivalent of git-fetch(1) with measurements for packfile negotiation
	// and receiving the packfile.
	Fetch = ProbeType("fetch")
	// Push exercises the equivalent of git-push(1) with measurements for packfile negotiation
	// and sending the packfile.
	Push = ProbeType("push")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Blackbox

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

Blackbox encapsulates all details required to run the blackbox prober.

func New

func New(cfg Config, logger log.Logger) Blackbox

New creates a new Blackbox structure.

func (Blackbox) Collect

func (b Blackbox) Collect(metrics chan<- prometheus.Metric)

Collect is used to collect Prometheus metrics.

func (Blackbox) Describe

func (b Blackbox) Describe(descs chan<- *prometheus.Desc)

Describe is used to describe Prometheus metrics.

func (Blackbox) Run

func (b Blackbox) Run() error

Run starts the blackbox. It sets up and serves the Prometheus listener and starts a Goroutine which runs the probes.

type Config

type Config struct {
	// PrometheusListenAddr is the listen address on which Prometheus metrics should be
	// made available for clients.
	PrometheusListenAddr string `toml:"prometheus_listen_addr"`
	// Sleep is the number of seconds between probe runs.
	Sleep int `toml:"sleep"`

	// Logging configures logging.
	Logging log.Config `toml:"logging"`
	// Probes defines endpoints to probe. At least one probe must be defined.
	Probes []Probe `toml:"probe"`
	// contains filtered or unexported fields
}

Config is the configuration for gitaly-blackbox.

func ParseConfig

func ParseConfig(raw string) (Config, error)

ParseConfig parses the provided TOML-formatted configuration string and either returns the parsed configuration or an error.

type Probe

type Probe struct {
	// Name is the name of the probe. This is used both for logging and for exported
	// Prometheus metrics.
	Name string `toml:"name"`
	// Type is the type of the probe. See ProbeType for the supported types. Defaults to `Fetch`
	// if no type was given.
	Type ProbeType `toml:"type"`
	// URL is the URL of the Git repository that should be probed. For now, only the
	// HTTP transport is supported.
	URL string `toml:"url"`
	// User is the user to authenticate as when connecting to the repository.
	User string `toml:"user"`
	// Password is the password to authenticate with when connecting to the repository.
	// Note that this password may easily leak when connecting to a non-HTTPS URL.
	Password string `toml:"password"`
	// Push contains the configuration of a Push-type probe.
	Push *PushConfig `toml:"push"`
}

Probe is the configuration for a specific endpoint whose clone performance should be exercised.

type ProbeType

type ProbeType string

ProbeType is the type of the probe.

type PushCommand

type PushCommand struct {
	// OldOID is the old state of the reference that should be updated.
	OldOID string `toml:"old_oid"`
	// OldOID is the new target state of the reference that should be updated.
	NewOID string `toml:"new_oid"`
	// Reference is the name of the reference that should be updated.
	Reference string `toml:"reference"`
}

PushCommand describes a command performed as part of the push.

type PushConfig

type PushConfig struct {
	// ObjectFormat is the object format that is used on the remote side. This can either be
	// "sha1" or "sha256". Defaults to "sha1".
	ObjectFormat string `toml:"object_format"`
	// Commands is the list of commands which should be executed as part of the push.
	Commands []PushCommand `toml:"commands"`
	// Packfile is the path to the packfile that shall be sent as part of the push.
	Packfile string `toml:"packfile"`
}

PushConfig is the configuration for a Push-type probe.

Jump to

Keyboard shortcuts

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