protocol

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package protocol defines communication to agents

Index

Constants

View Source
const ReportName = "report.yaml"

ReportName is the name of the configuration file name

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentUpdates

type AgentUpdates struct {
	// Labels changes are only supported by OpAMP
	Labels *model.Labels

	// Configuration changes are only supported by OpAMP
	Configuration *model.Configuration

	// Version instructs the agent to install a specific version
	Version string
}

AgentUpdates contains fields that can be modified on an Agent and should be sent to the agent. The model.Agent should not be updated directly and will be updated when the agent reports its new status after the update is complete.

func (*AgentUpdates) Empty

func (u *AgentUpdates) Empty() bool

Empty returns true if the updates are empty because no changes need to be made to the agent

type Protocol

type Protocol interface {
	// Name is the name for the protocol use mostly for logging
	Name() string

	// Connected returns true if the specified agent ID is connected
	Connected(agentID string) bool

	// ConnectedAgents should return a slice of the currently connected agent IDs
	ConnectedAgentIDs(context.Context) ([]string, error)

	// Disconnect closes the any connection to the specified agent ID
	Disconnect(agentID string) bool

	// UpdateAgent should send a message to the specified agent to apply the updates
	UpdateAgent(context.Context, *model.Agent, *AgentUpdates) error

	// SendHeartbeat sends a heartbeat to the agent to keep the websocket open
	SendHeartbeat(agentID string) error

	// RequestReport sends report configuration to the specified agent
	RequestReport(ctx context.Context, agentID string, report Report) error

	// Shutdown should disconnect all agents before the server is terminated
	Shutdown(ctx context.Context) error
}

Protocol represents a communication protocol for managing agents

type Report

type Report struct {
	Snapshot Snapshot `json:"snapshot" yaml:"snapshot" mapstructure:"snapshot"`
}

Report represents the "report.yaml" config sent to the agent via opamp

func (*Report) YAML

func (r *Report) YAML() ([]byte, error)

YAML returns the encoded Configuration

type ReportEndpoint

type ReportEndpoint struct {
	// Header should be added as HTTP headers with the payload sent to the endpoint
	Header http.Header `json:"headers" yaml:"headers,omitempty" mapstructure:"headers"`

	// URL indicates the target for the HTTP POST with OTLP data
	URL string `json:"url" yaml:"url" mapstructure:"url"`
}

ReportEndpoint contains the headers and url where OTLP data should be sent

type Snapshot

type Snapshot struct {
	// Processor is the full ComponentID of the snapshot processor
	Processor string `json:"processor" yaml:"processor" mapstructure:"processor"`

	// PipelineType will be "logs", "metrics", or "traces"
	PipelineType otel.PipelineType `json:"pipeline_type" yaml:"pipeline_type" mapstructure:"pipeline_type"`

	// Endpoint indicates where OTLP telemetry should be sent
	Endpoint ReportEndpoint `json:"endpoint" yaml:"endpoint,omitempty" mapstructure:"endpoint"`
}

Snapshot contains the portion of the configuration specific to the snapshot capability

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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