Documentation ¶
Index ¶
- Constants
- Variables
- func NewCompileRequestClient(ctx context.Context, stream types.Scheduler_StreamOutgoingTasksClient) run.SchedulerClientStream
- func NewRemoteUsageManager(ctx context.Context, client types.MonitorClient) run.ResizerManager
- func WatchAvailability(ctx context.Context, monClient types.MonitorClient, al AvailabilityListener)
- type AvailabilityChecker
- type AvailabilityFilter
- type AvailabilityListener
- type ChangeListener
- type CompileRequestClient
- type ContextMetric
- type EventKind
- type MetricsListener
- type MetricsProvider
- type MetricsProviderOption
- type MetricsProviderOptions
- type OnConnectFailedEventHandler
- type OnConnectedEventHandler
- type OnLostConnectionEventHandler
- type QueueStrategy
- type RemoteStatus
- type RemoteUsageManager
- type RetryOptions
- type StatusCtrlKind
- type StreamHandler
- type StreamManager
- type StreamManagerOption
- type StreamManagerOptions
Constants ¶
const MetaBucket = "meta"
Variables ¶
var ErrStreamNotReady = errors.New("Stream is not ready yet")
Functions ¶
func NewCompileRequestClient ¶
func NewCompileRequestClient( ctx context.Context, stream types.Scheduler_StreamOutgoingTasksClient, ) run.SchedulerClientStream
func NewRemoteUsageManager ¶
func NewRemoteUsageManager( ctx context.Context, client types.MonitorClient, ) run.ResizerManager
func WatchAvailability ¶
func WatchAvailability( ctx context.Context, monClient types.MonitorClient, al AvailabilityListener, )
WatchAvailability hooks an AvailabilityListener into a monitor listener which will call OnComponentAvailable when the component begins streaming metrics to the monitor.
Types ¶
type AvailabilityChecker ¶
type AvailabilityChecker struct {
// contains filtered or unexported fields
}
func NewAvailabilityChecker ¶
func NewAvailabilityChecker(filter AvailabilityFilter) *AvailabilityChecker
func (*AvailabilityChecker) EnsureAvailable ¶
func (rsm *AvailabilityChecker) EnsureAvailable() context.Context
EnsureAvailable blocks until the AvailabilityChecker reports that the component is available, then returns a context which will be canceled when the component becomes unavailable again.
func (*AvailabilityChecker) OnComponentAvailable ¶
func (rsm *AvailabilityChecker) OnComponentAvailable( ctx context.Context, info *types.WhoisResponse, )
type AvailabilityFilter ¶
type AvailabilityFilter = func(*types.WhoisResponse) bool
func ComponentFilter ¶
func ComponentFilter(c ...types.Component) AvailabilityFilter
ComponentFilter is an AvailabilityFilter which allows only a subset of all components to trigger the availability callback.
type AvailabilityListener ¶
type AvailabilityListener interface {
OnComponentAvailable(context.Context, *types.WhoisResponse)
}
An AvailabilityListener allows asserting that a component is available (i.e. it is streaming metadata to the monitor) during a section of code. The default concrete implementation of this interface is the AvailabilityChecker. This interface is intended to be used with the function WatchAvailability.
Example: avc := clients.NewAvailabilityChecker(clients.ComponentFilter(types.Cache)) clients.WatchAvailability(testCtx, monClient, avc) avc.EnsureAvailable()
type ChangeListener ¶
type ChangeListener interface { StreamHandler OrExpired(handler func() RetryOptions) }
type CompileRequestClient ¶
type CompileRequestClient struct {
// contains filtered or unexported fields
}
func (*CompileRequestClient) Compile ¶
func (rc *CompileRequestClient) Compile( request *types.CompileRequest, ) (*types.CompileResponse, error)
func (*CompileRequestClient) LoadNewStream ¶
func (rc *CompileRequestClient) LoadNewStream( stream types.Scheduler_StreamOutgoingTasksClient, )
LoadNewStream replaces an existing (or nil) stream with a new one. This is used in remote PackagedTasks to allow switching a task to be remote or local while it is in queue if the remote state changes. If this was not used, a SplitTask would never be able to run remote if the remote came online after the task was posted to the queue but before being run.
type ContextMetric ¶
type EventKind ¶
type EventKind uint
const ( LogConnected EventKind = 1 << iota LogConnectionFailed LogConnectionLost LogStreamFinished LogNone EventKind = 0 LogDefaults EventKind = LogConnected | LogConnectionFailed | LogConnectionLost )
type MetricsListener ¶
type MetricsListener interface { OnValueChanged(bucket string, handler interface{}) ChangeListener OnProviderAdded(func(context.Context, string)) }
func NewMetricsListener ¶
func NewMetricsListener( ctx context.Context, client types.MonitorClient, streamOpts ...StreamManagerOption, ) MetricsListener
func NewNoopMetricsListener ¶
func NewNoopMetricsListener() MetricsListener
type MetricsProvider ¶
type MetricsProvider interface { Post(metric proto.Message) PostContext(metric proto.Message, ctx context.Context) }
func NewKeyedBufferMonitorProvider ¶
func NewKeyedBufferMonitorProvider( ctx context.Context, client types.MonitorClient, ) MetricsProvider
func NewMetricsProvider ¶
func NewMetricsProvider( ctx context.Context, client types.MonitorClient, qs QueueStrategy, opts ...MetricsProviderOption, ) MetricsProvider
func NewNoopMetricsProvider ¶
func NewNoopMetricsProvider() MetricsProvider
type MetricsProviderOption ¶
type MetricsProviderOption func(*MetricsProviderOptions)
func StatusCtrl ¶
func StatusCtrl(ctrl *metrics.StatusController) MetricsProviderOption
type MetricsProviderOptions ¶
type MetricsProviderOptions struct {
// contains filtered or unexported fields
}
func (*MetricsProviderOptions) Apply ¶
func (o *MetricsProviderOptions) Apply(opts ...MetricsProviderOption)
type OnConnectFailedEventHandler ¶
type OnConnectFailedEventHandler interface {
OnConnectFailed()
}
type OnConnectedEventHandler ¶
type OnConnectedEventHandler interface {
OnConnected()
}
type OnLostConnectionEventHandler ¶
type OnLostConnectionEventHandler interface {
OnLostConnection()
}
type QueueStrategy ¶
type QueueStrategy int
const ( Buffered QueueStrategy = 1 << iota Discard Block )
type RemoteUsageManager ¶
type RemoteUsageManager struct {
// contains filtered or unexported fields
}
func (*RemoteUsageManager) Manage ¶
func (m *RemoteUsageManager) Manage(resizer run.Resizer)
type StreamHandler ¶
type StreamHandler interface { TryConnect() (grpc.ClientStream, error) HandleStream(grpc.ClientStream) error Target() string }
type StreamManager ¶
type StreamManager struct { StreamManagerOptions // contains filtered or unexported fields }
StreamManager is used to manage automatic reconnect and backoff logic for gRPC streams, as well as providing a means to handle connection events.
func NewStreamManager ¶
func NewStreamManager( ctx context.Context, handler StreamHandler, opts ...StreamManagerOption, ) *StreamManager
func (*StreamManager) Run ¶
func (sm *StreamManager) Run()
func (*StreamManager) TryImmediately ¶
func (sm *StreamManager) TryImmediately()
TryImmediately will immediately invoke TryConnect. This should only be used when you are reasonably certain the connection to the server will succeed, but you may be stuck in a long backoff timer. This function has the side effect of resetting the backoff manager to its defaults, but only if a backoff timer is currently active. If the backoff timer is not currently active, this function will do nothing. This function is not safe to call concurrently.
type StreamManagerOption ¶
type StreamManagerOption func(*StreamManagerOptions)
func WithLogEvents ¶
func WithLogEvents(events EventKind) StreamManagerOption
func WithStatusCtrl ¶
func WithStatusCtrl(stat *metrics.StatusController, kind StatusCtrlKind) StreamManagerOption
type StreamManagerOptions ¶
type StreamManagerOptions struct {
// contains filtered or unexported fields
}
func (*StreamManagerOptions) Apply ¶
func (o *StreamManagerOptions) Apply(opts ...StreamManagerOption)