Documentation
¶
Overview ¶
Package receivers provides a modular system for collecting metrics, events, and logs from various sources. It defines a common Receiver interface and a ReceiveManager to orchestrate multiple receiver instances. Receivers collect data from external sources, convert it into CCMessage format, and send it to a unified sink channel.
Index ¶
- Constants
- Variables
- func DecodeInfluxMessage(d *influx.Decoder) (lp.CCMessage, error)
- type EECPTReceiver
- type EECPTReceiverConfig
- type EECPTReceiverJob
- type EECPTReceiverTask
- type HttpReceiver
- type HttpReceiverConfig
- type IPMIReceiver
- type IPMIReceiverClientConfig
- type NatsReceiver
- type NatsReceiverConfig
- type PrometheusReceiver
- type PrometheusReceiverConfig
- type ReceiveManager
- type Receiver
- func NewEECPTReceiver(name string, config json.RawMessage) (Receiver, error)
- func NewHttpReceiver(name string, config json.RawMessage) (Receiver, error)
- func NewIPMIReceiver(name string, config json.RawMessage) (Receiver, error)
- func NewNatsReceiver(name string, config json.RawMessage) (Receiver, error)
- func NewPrometheusReceiver(name string, config json.RawMessage) (Receiver, error)
- func NewRedfishReceiver(name string, config json.RawMessage) (Receiver, error)
- func NewSampleReceiver(name string, config json.RawMessage) (Receiver, error)
- type ReceiverConfig
- type RedfishReceiver
- type RedfishReceiverClientConfig
- type SampleReceiver
- type SampleReceiverConfig
Constants ¶
const (
CCCPT_RECEIVER_PORT = "8080"
)
const HTTP_RECEIVER_PORT = "8080"
Variables ¶
var AvailableReceivers = map[string]func(name string, config json.RawMessage) (Receiver, error){ "http": NewHttpReceiver, "nats": NewNatsReceiver, "eecpt": NewEECPTReceiver, "prometheus": NewPrometheusReceiver, "ipmi": NewIPMIReceiver, "redfish": NewRedfishReceiver, }
Map of all available receivers
Functions ¶
Types ¶
type EECPTReceiver ¶
type EECPTReceiver struct {
// contains filtered or unexported fields
}
func (*EECPTReceiver) Close ¶
func (r *EECPTReceiver) Close()
func (*EECPTReceiver) Name ¶
func (r *EECPTReceiver) Name() string
Name returns the name of the metric receiver
func (*EECPTReceiver) ServerHttp ¶
func (r *EECPTReceiver) ServerHttp(w http.ResponseWriter, req *http.Request)
func (*EECPTReceiver) Start ¶
func (r *EECPTReceiver) Start()
type EECPTReceiverConfig ¶
type EECPTReceiverConfig struct {
Addr string `json:"address"`
Port string `json:"port"`
Path string `json:"path"`
// Maximum amount of time to wait for the next request when keep-alives are enabled
// should be larger than the measurement interval to keep the connection open
IdleTimeout string `json:"idle_timeout"`
// Controls whether HTTP keep-alives are enabled. By default, keep-alives are enabled
KeepAlivesEnabled bool `json:"keep_alives_enabled"`
// Basic authentication
Username string `json:"username"`
Password string `json:"password"`
AnalysisBufferLength int `json:"analysis_buffer_size"`
AnalysisInterval string `json:"analysis_interval"`
AnalysisMetric string `json:"analysis_metric"`
// contains filtered or unexported fields
}
type EECPTReceiverJob ¶
type EECPTReceiverJob struct {
// contains filtered or unexported fields
}
func NewJob ¶
func NewJob(ident string) *EECPTReceiverJob
func (*EECPTReceiverJob) Analyse ¶
func (job *EECPTReceiverJob) Analyse() float64
Analyse performs chi-square statistical test to detect phase transitions in application behavior. It computes the chi-square statistic by comparing the expected rate of change (prev) with the observed change (last) across all tasks in the job. Returns the chi-square test statistic value.
func (*EECPTReceiverJob) ChiSquareLimit ¶
func (job *EECPTReceiverJob) ChiSquareLimit() float64
ChiSquareLimit returns the critical chi-square value at 95% confidence level (p=0.05) for the given number of degrees of freedom (number of tasks). These are pre-calculated chi-square distribution values used to determine if a phase transition is statistically significant.
func (*EECPTReceiverJob) Reset ¶
func (job *EECPTReceiverJob) Reset()
type EECPTReceiverTask ¶
type EECPTReceiverTask struct {
// contains filtered or unexported fields
}
func (*EECPTReceiverTask) Add ¶
func (task *EECPTReceiverTask) Add(value float64)
func (*EECPTReceiverTask) Analyse ¶
func (task *EECPTReceiverTask) Analyse() (float64, float64, error)
Analyse computes the expected rate of change (prev) and last observed change (last) for this task's metric buffer. Returns (prev, last, error). prev = average rate of change over buffer history last = most recent change
func (*EECPTReceiverTask) PrintBuffer ¶
func (task *EECPTReceiverTask) PrintBuffer()
func (*EECPTReceiverTask) Reset ¶
func (task *EECPTReceiverTask) Reset()
type HttpReceiver ¶
type HttpReceiver struct {
// contains filtered or unexported fields
}
func (*HttpReceiver) Close ¶
func (r *HttpReceiver) Close()
func (*HttpReceiver) Name ¶
func (r *HttpReceiver) Name() string
Name returns the name of the metric receiver
func (*HttpReceiver) ServerHttp ¶
func (r *HttpReceiver) ServerHttp(w http.ResponseWriter, req *http.Request)
func (*HttpReceiver) Start ¶
func (r *HttpReceiver) Start()
type HttpReceiverConfig ¶
type HttpReceiverConfig struct {
Addr string `json:"address"` // Listen address (default: empty for all interfaces)
Port string `json:"port"` // Listen port (default: 8080)
Path string `json:"path"` // HTTP path to listen on
IdleTimeout string `json:"idle_timeout"` // Max idle time for keep-alive connections (default: 120s)
KeepAlivesEnabled bool `json:"keep_alives_enabled"` // Enable HTTP keep-alive (default: true)
Username string `json:"username"` // Basic auth username (optional)
Password string `json:"password"` // Basic auth password (optional)
// contains filtered or unexported fields
}
HttpReceiverConfig configures the HTTP receiver for accepting metrics via POST requests.
type IPMIReceiver ¶
type IPMIReceiver struct {
// contains filtered or unexported fields
}
func (*IPMIReceiver) Close ¶
func (r *IPMIReceiver) Close()
Close receiver: close network connection, close files, close libraries, ...
func (*IPMIReceiver) Name ¶
func (r *IPMIReceiver) Name() string
Name returns the name of the metric receiver
func (*IPMIReceiver) Start ¶
func (r *IPMIReceiver) Start()
type IPMIReceiverClientConfig ¶
type IPMIReceiverClientConfig struct {
// Hostname the IPMI service belongs to
Protocol string // Protocol / tool to use for IPMI sensor reading
DriverType string // Out of band IPMI driver
Fanout int // Maximum number of simultaneous IPMI connections
NumHosts int // Number of remote IPMI devices with the same configuration
IPMIHosts string // List of remote IPMI devices to communicate with
IPMI2HostMapping map[string]string // Mapping between IPMI device name and host name
Username string // User name to authenticate with
Password string // Password to use for authentication
CLIOptions []string // Additional command line options for ipmi-sensors
// contains filtered or unexported fields
}
type NatsReceiver ¶
type NatsReceiver struct {
// contains filtered or unexported fields
}
func (*NatsReceiver) Close ¶
func (r *NatsReceiver) Close()
Close closes the connection to the NATS server
func (*NatsReceiver) Name ¶
func (r *NatsReceiver) Name() string
Name returns the name of the metric receiver
func (*NatsReceiver) Start ¶
func (r *NatsReceiver) Start()
Start subscribes to the configured NATS subject Messages wil be handled by r._NatsReceive
type NatsReceiverConfig ¶
type NatsReceiverConfig struct {
Addr string `json:"address"` // NATS server address (default: localhost)
Port string `json:"port"` // NATS server port (default: 4222)
Subject string `json:"subject"` // NATS subject to subscribe to (required)
User string `json:"user,omitempty"` // Username for authentication
Password string `json:"password,omitempty"` // Password for authentication
NkeyFile string `json:"nkey_file,omitempty"` // Path to NKey credentials file
// contains filtered or unexported fields
}
NatsReceiverConfig configures the NATS receiver for subscribing to metric messages.
type PrometheusReceiver ¶
type PrometheusReceiver struct {
// contains filtered or unexported fields
}
func (*PrometheusReceiver) Close ¶
func (r *PrometheusReceiver) Close()
func (*PrometheusReceiver) Name ¶
func (r *PrometheusReceiver) Name() string
Name returns the name of the metric receiver
func (*PrometheusReceiver) Start ¶
func (r *PrometheusReceiver) Start()
type ReceiveManager ¶
type ReceiveManager interface {
Init(wg *sync.WaitGroup, receiverConfig json.RawMessage) error
AddInput(name string, rawConfig json.RawMessage) error
AddOutput(output chan lp.CCMessage)
Start()
Close()
}
func New ¶
func New(wg *sync.WaitGroup, receiverConfig json.RawMessage) (ReceiveManager, error)
type Receiver ¶
type Receiver interface {
Start() // Start begins the metric collection process
Close() // Close stops the receiver and releases resources
Name() string // Name returns the receiver's identifier
SetSink(sink chan lp.CCMessage) // SetSink configures the output channel for collected metrics
}
Receiver is the interface all metric receivers must implement. Receivers collect metrics from various sources and send them to a sink channel.
func NewEECPTReceiver ¶
func NewEECPTReceiver(name string, config json.RawMessage) (Receiver, error)
func NewHttpReceiver ¶
func NewHttpReceiver(name string, config json.RawMessage) (Receiver, error)
func NewIPMIReceiver ¶
func NewIPMIReceiver(name string, config json.RawMessage) (Receiver, error)
NewIPMIReceiver creates a new instance of the redfish receiver Initialize the receiver by giving it a name and reading in the config JSON
func NewNatsReceiver ¶
func NewNatsReceiver(name string, config json.RawMessage) (Receiver, error)
NewNatsReceiver creates a new Receiver which subscribes to messages from a NATS server
func NewPrometheusReceiver ¶
func NewPrometheusReceiver(name string, config json.RawMessage) (Receiver, error)
func NewRedfishReceiver ¶
func NewRedfishReceiver(name string, config json.RawMessage) (Receiver, error)
NewRedfishReceiver creates a new instance of the redfish receiver Initialize the receiver by giving it a name and reading in the config JSON
func NewSampleReceiver ¶
func NewSampleReceiver(name string, config json.RawMessage) (Receiver, error)
New function to create a new instance of the receiver Initialize the receiver by giving it a name and reading in the config JSON
type ReceiverConfig ¶
type ReceiverConfig struct {
Addr string `json:"address"` // Network address to bind/connect
Port string `json:"port"` // Network port
Database string `json:"database"` // Database name (if applicable)
Organization string `json:"organization,omitempty"` // Organization identifier
Type string `json:"type"` // Receiver type
}
ReceiverConfig is the legacy configuration structure for receivers. Deprecated: Most receivers now use type-specific configuration structs.
type RedfishReceiver ¶
type RedfishReceiver struct {
// contains filtered or unexported fields
}
RedfishReceiver configuration:
func (*RedfishReceiver) Name ¶
func (r *RedfishReceiver) Name() string
Name returns the name of the metric receiver
type RedfishReceiverClientConfig ¶
type RedfishReceiverClientConfig struct {
// Hostname the redfish service belongs to
Hostname string
// contains filtered or unexported fields
}
type SampleReceiver ¶
type SampleReceiver struct {
// contains filtered or unexported fields
}
func (*SampleReceiver) Close ¶
func (r *SampleReceiver) Close()
Close receiver: close network connection, close files, close libraries, ...
func (*SampleReceiver) Name ¶
func (r *SampleReceiver) Name() string
Name returns the name of the metric receiver
func (*SampleReceiver) Start ¶
func (r *SampleReceiver) Start()
type SampleReceiverConfig ¶
type SampleReceiverConfig struct {
Addr string `json:"address"`
Port string `json:"port"`
// contains filtered or unexported fields
}
SampleReceiver configuration: receiver type, listen address, port The defaultReceiverConfig contains the keys 'type' and 'process_messages'