server

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package server contains the interface and implementation of the BindPlane Server

Index

Constants

View Source
const (
	// AgentCleanupInterval is the default agent cleanup interval.
	AgentCleanupInterval = time.Minute
	// AgentCleanupTTL is the default agent cleanup time to live.
	AgentCleanupTTL = 15 * time.Minute
	// AgentHeartbeatInterval is the default interval for the heartbeat sent to the agent to keep the websocket live.
	AgentHeartbeatInterval = 30 * time.Second
)
View Source
const HeaderSessionID = "X-BindPlane-Session-ID"

HeaderSessionID is the name of the HTTP header where a BindPlane Session ID can be found. This will be used by Relayer to match up the request with an eventual response via OTLP HTTP POST.

Variables

This section is empty.

Functions

This section is empty.

Types

type BindPlane

type BindPlane interface {
	// Store TODO(doc)
	Store() store.Store
	// Manager TODO(doc)
	Manager() Manager
	// Relayer enables Live messages to flow from Agents to GraphQL subscriptions
	Relayers() *Relayers
	// Versions TODO(doc)
	Versions() agent.Versions
	// Config TODO(doc)
	Config() *common.Server
	// Logger TODO(doc)
	Logger() *zap.Logger
}

BindPlane is the interface for the BindPlane Server

func NewBindPlane

func NewBindPlane(config *common.Server, logger *zap.Logger, s store.Store, versions agent.Versions) (BindPlane, error)

NewBindPlane creates a new BindPlane Server using the given store and agent versions

type Manager

type Manager interface {
	// Start starts the manager and allows it to begin processing configuration changes
	Start(ctx context.Context)
	// EnableProtocol adds the protocol to the manager
	EnableProtocol(protocol.Protocol)
	// Agent returns the agent with the specified agentID.
	Agent(ctx context.Context, agentID string) (*model.Agent, error)
	// UpsertAgent adds a new Agent to the Store or updates an existing one
	UpsertAgent(ctx context.Context, agentID string, updater store.AgentUpdater) (*model.Agent, error)
	// AgentUpdates returns the updates that should be applied to an agent based on the current bindplane configuration
	AgentUpdates(ctx context.Context, agent *model.Agent) (*protocol.AgentUpdates, error)
	// VerifySecretKey checks to see if the specified secretKey matches configured secretKey
	VerifySecretKey(ctx context.Context, secretKey string) bool
	// ResourceStore provides access to the store to render configurations
	ResourceStore() model.ResourceStore
	// BindPlaneConfiguration provides access to the config to render configurations
	BindPlaneConfiguration() model.BindPlaneConfiguration
	// RequestReport sends report configuration to the specified agent
	RequestReport(ctx context.Context, agentID string, configuration protocol.Report) error
	// AgentVersion returns information about a version of an agent
	AgentVersion(ctx context.Context, version string) (*model.AgentVersion, error)
}

Manager manages agent connects and communications with them

func NewManager

func NewManager(config *common.Server, store store.Store, versions agent.Versions, logger *zap.Logger) (Manager, error)

NewManager returns a new implementation of the Manager interface

type Relayer added in v1.1.0

type Relayer[T any] struct {
	// contains filtered or unexported fields
}

Relayer forwards results to consumers awaiting the results. It is intentionally generic and is used to support cases where the request for results is decoupled from the response with the results.

func (*Relayer[T]) AwaitResult added in v1.1.0

func (r *Relayer[T]) AwaitResult() (id string, result <-chan T, cancelFunc func())

AwaitResult will create a new ID and channel where results will be received. It also returns a cancelFunc that must be called to cleanup the channel.

func (*Relayer[T]) SendResult added in v1.1.0

func (r *Relayer[T]) SendResult(id string, result T)

SendResult will forward results to the channel returned by AwaitResult

type Relayers added in v1.1.0

type Relayers struct {
	Logs    *Relayer[[]*record.Log]
	Metrics *Relayer[[]*record.Metric]
	Traces  *Relayer[[]*record.Trace]
}

Relayers is a wrapper around multiple Relayer instances used for different types of results

func NewRelayers added in v1.1.0

func NewRelayers(logger *zap.Logger) *Relayers

NewRelayers returns a new set of Relayers

Directories

Path Synopsis
Package auth provides authentication middleware for the BindPlane server
Package auth provides authentication middleware for the BindPlane server
Package protocol defines communication to agents
Package protocol defines communication to agents
Package sessions provides session management for the UI
Package sessions provides session management for the UI

Jump to

Keyboard shortcuts

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