probe

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func NewCePubSubClient

func NewCePubSubClient(ctx context.Context, pc *pubsub.Client) (handlers.CePubSubClient, error)

func NewCeReceiverClient

func NewCeReceiverClient(ctx context.Context, livenessChecker *utils.LivenessChecker, opts ReceiveClientOptions) (handlers.CeReceiveClient, error)

func NewK8sClient added in v0.21.0

func NewK8sClient(ctx context.Context) (c kubernetes.Interface, err error)

func NewPubSubClient

func NewPubSubClient(ctx context.Context, projectID clients.ProjectID) (c *pubsub.Client, err error)

func NewStorageClient

func NewStorageClient(ctx context.Context) (c *storage.Client, err error)

Types

type EnvConfig

type EnvConfig struct {
	// Environment variable containing the maximum tolerated staleness duration for events processed by the forward and receiver clients
	LivenessStaleDuration time.Duration `envconfig:"LIVENESS_STALE_DURATION" default:"5m"`

	// Environment variable containing the default timeout duration to wait for an event to be delivered, if no custom timeout is specified
	DefaultTimeoutDuration time.Duration `envconfig:"DEFAULT_TIMEOUT_DURATION" default:"2m"`

	// Environment variable containing the maximum timeout duration to wait for an event to be delivered
	MaxTimeoutDuration time.Duration `envconfig:"MAX_TIMEOUT_DURATION" default:"30m"`
}

type ForwardClientOptions

type ForwardClientOptions []cehttp.Option

func NewCeForwardClientOptions

func NewCeForwardClientOptions(port ForwardPort) ForwardClientOptions

func NewTestCeForwardClientOptions

func NewTestCeForwardClientOptions(listener ForwardListener) ForwardClientOptions

type ForwardListener

type ForwardListener net.Listener

type ForwardPort

type ForwardPort int

type Helper

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

Helper is the main probe helper object which contains the metadata and clients shared between all probe Handlers.

func InitializeTestProbeHelper

func InitializeTestProbeHelper(ctx context.Context, brokerCellBaseUrl string, projectID clients.ProjectID, cronStaleDuration time.Duration, helperEnv EnvConfig, forwardListener ForwardListener, receiveListener ReceiveListener, storageClient *storage.Client, psClient *pubsub.Client, k8sClient kubernetes.Interface) (*Helper, error)

func NewHelper

func NewHelper(env EnvConfig, handler handlers.Interface, ceForwardClient handlers.CeForwardClient, ceReceiveClient handlers.CeReceiveClient, livenessCheker *utils.LivenessChecker) *Helper

func (*Helper) CheckLastEventTimes

func (ph *Helper) CheckLastEventTimes() func(ctx context.Context) error

CheckLastEventTimes returns an actionFunc which checks the delay between the current time and last processed event times from the forward and receiver clients. This handler is used by the liveness checker to declare the liveness status of the probe helper.

func (*Helper) Run

func (ph *Helper) Run(ctx context.Context)

Run starts the probe forwarder and receiver. This function should be called after Initialize.

type ReceiveClientOptions

type ReceiveClientOptions []cehttp.Option

func NewCeReceiverClientOptions

func NewCeReceiverClientOptions(port ReceivePort) ReceiveClientOptions

func NewTestCeReceiverClientOptions

func NewTestCeReceiverClientOptions(listener ReceiveListener) ReceiveClientOptions

type ReceiveListener

type ReceiveListener net.Listener

type ReceivePort

type ReceivePort int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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