Documentation
¶
Index ¶
- Constants
- func NewReadyChecker(adminHost string, listeners ...*Listener) *readyChecker
- type ChecksumDownloader
- type ExitInfo
- type ExitKey
- type FatalError
- type GitHubRelease
- type Identity
- type LatestCachedRelease
- type Limits
- type Listener
- type Metrics
- type Option
- func WithAdminHost(host string) Option
- func WithArgs(args ...string) Option
- func WithBootstrapConfigYAML(yaml string) Option
- func WithCluster(cluster string) Option
- func WithDrainTimeout(timeout *time.Duration) Option
- func WithGoPluginDir(dir string) Option
- func WithIdentity(proxy, replica, projectID string) Option
- func WithLimits(l Limits) Option
- func WithLogsCollector(c logs.LogsCollector) Option
- func WithMinDrainTime(timeout *time.Duration) Option
- func WithNodeMetadata(metadata *xdstypes.NodeMetadata) Option
- func WithOTLPMetricSink(addr string) Option
- func WithOtelCollector(c *otel.Collector) Option
- func WithRelease(release ReleaseDownloader) Option
- type ReleaseDownloader
- type Runtime
- type RuntimeStatus
- type URLRelease
Constants ¶
const ( ExitReasonExit = "exit" ExitReasonSignal = "signal" ExitReasonOOMKill = "oom_kill" ExitReasonStartFailed = "start_failed" )
Exit reasons the runtime records. The code is the decimal exit status for ExitReasonExit, the signal name for ExitReasonSignal and ExitReasonOOMKill, and empty for ExitReasonStartFailed.
const ( // DefaultVersion is the Envoy release that backplane images bake in and // that the runtime downloads. The Envoy version must not float, because a // new minor release can break the Go filter. Bump it only after a soak // test of the new release. DefaultVersion = "v1.35.13" )
Variables ¶
This section is empty.
Functions ¶
func NewReadyChecker ¶
NewReadyChecker creates a new readyChecker.
Types ¶
type ChecksumDownloader ¶ added in v0.23.0
type ChecksumDownloader interface {
// DownloadChecksum returns the published SHA-256 digest of the binary in
// lowercase hex. It returns an empty digest when no checksum is published.
DownloadChecksum(ctx context.Context) (string, error)
}
ChecksumDownloader is implemented by releases that can publish a ".sha256" sidecar next to the binary.
type ExitInfo ¶ added in v0.23.0
type ExitInfo struct {
// At is the time the exit was recorded.
At time.Time
// ProcState is the state of the exited process. It is nil if the process
// never started.
ProcState *os.ProcessState
// Err is the error returned by the wait on the process, if any.
Err error
// Reason is one of exit, signal, oom_kill and start_failed.
Reason string
// Code is the decimal exit status for an exit, the signal name for a
// signal and an OOM kill, and empty for a failed start.
Code string
// Uptime is how long the process ran.
Uptime time.Duration
// RequestsInFlight is the last sampled number of active downstream
// requests. It is nil when no sample was taken.
RequestsInFlight *int64
// Connections is the last sampled number of active downstream connections.
// It is nil when no sample was taken.
Connections *int64
// SampleAge is how old the sample was when the process exited.
SampleAge time.Duration
// ConnectionsAborted counts the established connections the kernel tore
// down when the process died. The value at the exit is a floor, because
// the kernel resets the sockets after the parent reaps the process. It
// becomes final when the next process starts.
ConnectionsAborted int64
// ConnectionsRefused counts the connection attempts the kernel answered
// with a reset while Envoy was gone. It becomes final when the next
// process starts.
ConnectionsRefused int64
}
ExitInfo records the last exit of the Envoy process.
type ExitKey ¶ added in v0.23.1
type ExitKey struct {
// Reason is one of exit, signal, oom_kill and start_failed.
Reason string
// Code is the exit status or the signal name.
Code string
}
ExitKey names one kind of exit. The set of keys is bounded by the reason vocabulary and the exit status range.
type FatalError ¶
type FatalError struct {
Err error
}
FatalError is an error that should cause the runtime to exit.
type GitHubRelease ¶
GitHubRelease represents a release from GitHub.
func (*GitHubRelease) DownloadBinary ¶
func (r *GitHubRelease) DownloadBinary(ctx context.Context) (io.ReadCloser, error)
func (*GitHubRelease) DownloadChecksum ¶ added in v0.23.0
func (r *GitHubRelease) DownloadChecksum(ctx context.Context) (string, error)
DownloadChecksum returns the digest published next to the release binary.
func (*GitHubRelease) String ¶
func (r *GitHubRelease) String() string
type Identity ¶ added in v0.23.1
type Identity struct {
// Proxy is the name of the Proxy object.
Proxy string
// Replica is the name of the replica.
Replica string
// ProjectID is the Apoxy project. It is empty outside the hosted platform.
ProjectID string
}
Identity names the Proxy and the replica the Envoy process belongs to.
type LatestCachedRelease ¶
type LatestCachedRelease struct {
Path string
// contains filtered or unexported fields
}
func (*LatestCachedRelease) DownloadBinary ¶
func (r *LatestCachedRelease) DownloadBinary(ctx context.Context) (io.ReadCloser, error)
func (*LatestCachedRelease) String ¶
func (r *LatestCachedRelease) String() string
type Limits ¶ added in v0.23.1
type Limits struct {
// MaxActiveDownstreamConnections is the connection cap of the overload
// manager.
MaxActiveDownstreamConnections *uint64
// MaxHeapBytes is the fixed heap size of the overload manager.
MaxHeapBytes *uint64
}
Limits are the configured ceilings of the Envoy process. Dashboards draw the ceiling next to the value Envoy reports.
type Metrics ¶ added in v0.23.1
type Metrics struct {
// contains filtered or unexported fields
}
Metrics exports the state of the Envoy runtime to Prometheus and, when a sink is configured, to an OpenTelemetry collector.
func NewMetrics ¶ added in v0.23.1
NewMetrics defines the runtime metrics and registers the exporters. An empty otlpAddr leaves the OTLP export off, which is the default outside the hosted platform.
func (*Metrics) Gatherer ¶ added in v0.23.1
func (m *Metrics) Gatherer() prometheus.Gatherer
Gatherer returns the Prometheus gatherer of the runtime metrics.
func (*Metrics) Registry ¶ added in v0.23.1
func (m *Metrics) Registry() *prometheus.Registry
Registry returns the Prometheus registry the metrics are registered on.
type Option ¶
type Option func(*Runtime)
Option configures a Runtime.
func WithAdminHost ¶
WithAdminHost sets the host for the Envoy admin interface.
func WithArgs ¶
WithArgs sets additional arguments to pass to Envoy. The arguments are appended to the default arguments.
func WithBootstrapConfigYAML ¶
WithBootstrapConfigYAML sets the Envoy bootstrap config YAML.
func WithCluster ¶
WithCluster sets the Envoy cluster name. If this is not set, a random cluster name is used. The cluster name is used in the Envoy bootstrap config.
func WithDrainTimeout ¶
If this is not set, the default timeout is used (30 seconds).
func WithGoPluginDir ¶
WithGoPluginDir sets the directory to load Go plugins from.
func WithIdentity ¶ added in v0.23.1
WithIdentity names the Proxy and the replica this runtime belongs to. Every metric datapoint carries the names as attributes. The project ID is empty outside the hosted platform.
func WithLimits ¶ added in v0.23.1
WithLimits sets the configured ceilings of the Envoy process. The runtime publishes them as gauges next to the values Envoy reports.
func WithLogsCollector ¶
func WithLogsCollector(c logs.LogsCollector) Option
WithLogsCollector sets the logs collector.
func WithMinDrainTime ¶
If this is not set, the default timeout is used (30 seconds).
func WithNodeMetadata ¶
func WithNodeMetadata(metadata *xdstypes.NodeMetadata) Option
WithNodeMetadata sets the metadata for the Envoy node in XDS discovery requests. The metadata will be included in the node configuration and sent to the control plane.
func WithOTLPMetricSink ¶ added in v0.23.1
WithOTLPMetricSink sends the runtime metrics to the OpenTelemetry collector at addr ("host:port"). An empty address leaves the OTLP export off.
func WithOtelCollector ¶
WithOtelCollector sets the OpenTelemetry collector.
func WithRelease ¶
func WithRelease(release ReleaseDownloader) Option
WithRelease sets the Envoy release to use. If this is not set, the latest release is used.
type ReleaseDownloader ¶
type Runtime ¶
type Runtime struct {
EnvoyPath string
BootstrapConfigYAML string
Release ReleaseDownloader
Cluster string
// Args are additional arguments to pass to Envoy.
Args []string
// contains filtered or unexported fields
}
func (*Runtime) Configure ¶ added in v0.23.1
Configure applies options to the runtime before it starts. Metrics read the values at collection time, so the caller sets identity and limits once.
func (*Runtime) Gatherer ¶ added in v0.23.1
func (r *Runtime) Gatherer() prometheus.Gatherer
Gatherer returns the Prometheus gatherer of the runtime metrics. The metrics server appends the families to the Envoy stats.
func (*Runtime) Metrics ¶ added in v0.23.1
Metrics returns the runtime metrics and defines them on first use.
func (*Runtime) RuntimeStatus ¶
func (r *Runtime) RuntimeStatus() RuntimeStatus
RuntimeStatus returns the status of the Envoy process.
type RuntimeStatus ¶
type RuntimeStatus struct {
StartedAt time.Time
Starting bool
Running bool
ProcState *os.ProcessState
// LastExit is the last recorded exit of the Envoy process. It is nil until
// the process exits for the first time.
LastExit *ExitInfo
// Restarts counts how many times the runtime started Envoy again after an
// exit.
Restarts int
// ExitCounts counts the exits of each reason and code.
ExitCounts map[ExitKey]int64
}
type URLRelease ¶
type URLRelease struct {
URL string
}
func (*URLRelease) DownloadBinary ¶
func (r *URLRelease) DownloadBinary(ctx context.Context) (io.ReadCloser, error)
func (*URLRelease) DownloadChecksum ¶ added in v0.23.0
func (r *URLRelease) DownloadChecksum(ctx context.Context) (string, error)
DownloadChecksum returns the digest published next to the release binary.
func (*URLRelease) String ¶
func (r *URLRelease) String() string