node_agent

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureNodeAgentSecret

func EnsureNodeAgentSecret(ctx context.Context, mgr ctrl.Manager) error

func TransformMetrics

func TransformMetrics(original []byte, extraLabels map[string]string, prefix string) ([]byte, error)

TransformMetrics takes original Prometheus metrics (in text format) as a []byte, applies extraLabels to every metric, and prepends a prefix (with dashes replaced by underscores) to every metric name. It preserves the original HELP and TYPE strings. It returns the transformed metrics as a single []byte.

Types

type CategoryStat

type CategoryStat struct {
	Stat     string `json:"stat"`
	Category string `json:"category"`
}

type ContainerInfo

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

type ContainerInfoResponse

type ContainerInfoResponse struct {
	ContainerMetrics weka.WekaContainerMetrics `json:"container_metrics,omitempty"`
}

type DeregisterContainerPayload added in v1.9.0

type DeregisterContainerPayload struct {
	ContainerId string `json:"container_id"`
}

type FindDrivesResponse added in v1.9.0

type FindDrivesResponse struct {
	Drives []domain.DriveInfo `json:"drives"`
	Error  string             `json:"error,omitempty"`
}

FindDrivesResponse represents the response containing drive information

type GetContainerInfoRequest

type GetContainerInfoRequest struct {
	ContainerId string `json:"container_id"`
}

type GroupedMetrics added in v1.10.6

type GroupedMetrics map[CategoryStat][]WekaStat

type JSONRPCError added in v1.10.0

type JSONRPCError struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

JSONRPCError represents a JSONRPC 2.0 error object

type JSONRPCProxyPayload added in v1.10.0

type JSONRPCProxyPayload struct {
	ContainerId string         `json:"container_id"`
	Method      string         `json:"method"`
	Params      map[string]any `json:"params"`
}

JSONRPCProxyPayload represents a generic JSONRPC call to be proxied to a container

type JSONRPCResponse added in v1.10.0

type JSONRPCResponse struct {
	ID      interface{}     `json:"id"`
	JSONRPC string          `json:"jsonrpc"`
	Result  json.RawMessage `json:"result,omitempty"`
	Error   *JSONRPCError   `json:"error,omitempty"`
}

JSONRPCResponse represents a JSONRPC 2.0 response

type LocalConfigStateResponse

type LocalConfigStateResponse struct {
	HasLease           *bool `json:"has_lease"`
	FilesystemsSummary []struct {
		FilesystemId string `json:"filesystem_id"` // FSId<0>
		Name         string `json:"name"`          // .config_fs
	} `json:"filesystems_summary"`
	DisksSummary     []WekaDrive `json:"disks_summary"`
	HostName         string      `json:"host_name"`
	HostId           string      `json:"host_id"`
	ProcessesSummary struct {
		Drive      ProcessSummary `json:"drive"`
		Dataserv   ProcessSummary `json:"dataserv"`
		Management ProcessSummary `json:"management"`
		Compute    ProcessSummary `json:"compute"`
		Total      ProcessSummary `json:"total"`
		Frontend   ProcessSummary `json:"frontend"`
	} `json:"processes_summary"`
}

type LocalCpuUtilization added in v1.10.0

type LocalCpuUtilization struct {
	Value *float64 `json:"value"`
	Err   *string  `json:"err"`
}

type MetricDefinition added in v1.7.0

type MetricDefinition struct {
	PromMetricName string
	Help           string
	Type           string
	Modes          []string
	CategoryStats  []CategoryStat
	ValueTransform func(float64) float64
	TagsFunc       func(p processedStat) metrics2.TagMap
	// CustomGetValueAndTagsFunc provides an alternative way to fetch metric values and tags,
	// bypassing the CategoryStats logic. If set, it's used; otherwise, CategoryStats processing is attempted.
	CustomGetValueAndTagsFunc func(ctx context.Context, container *ContainerInfo, baseLabels metrics2.TagMap) []metrics2.TaggedValue
	Aggregate                 bool
	Reduce                    bool
	ReduceBy                  string
	ReduceKeep                []string
}

type NodeAgent

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

func NewNodeAgent

func NewNodeAgent(logger logr.Logger) *NodeAgent

func (*NodeAgent) ConfigureHttpServer

func (a *NodeAgent) ConfigureHttpServer(ctx context.Context) (*http.Server, error)

func (*NodeAgent) LoggerInjectionMiddleware added in v1.9.0

func (a *NodeAgent) LoggerInjectionMiddleware(next http.Handler) http.Handler

func (*NodeAgent) LoggingMiddleware

func (a *NodeAgent) LoggingMiddleware(next http.Handler) http.Handler

func (*NodeAgent) PanicRecovery

func (a *NodeAgent) PanicRecovery(next http.Handler) http.Handler

func (*NodeAgent) RemoveContainer added in v1.9.0

func (a *NodeAgent) RemoveContainer(containerId string)

RemoveContainer removes a container from tracking and cleans up its HTTP client

func (*NodeAgent) Run

func (a *NodeAgent) Run(ctx context.Context, server *http.Server) error

func (*NodeAgent) Shutdown added in v1.9.0

func (a *NodeAgent) Shutdown()

Shutdown gracefully shuts down the node agent and cleans up resources

type ProcessSummary

type ProcessSummary struct {
	Up    int `json:"up"`
	Total int `json:"total"`
}

type RegisterContainerPayload

type RegisterContainerPayload struct {
	ContainerName      string               `json:"container_name"`
	ContainerId        string               `json:"container_id"`
	WekaContainerName  string               `json:"weka_container_name"`
	Labels             map[string]string    `json:"labels"`
	Mode               string               `json:"mode"`
	ScrapeTargets      []ScrapeTarget       `json:"scrape_targets"`
	PodStatus          string               `json:"pod_status"`
	PodStatusStartTime time.Time            `json:"pod_status_start_time"`
	FeatureFlags       *domain.FeatureFlags `json:"feature_flags,omitempty"` // feature flags
}

type ScrapeTarget

type ScrapeTarget struct {
	Port int    `json:"port"`
	Path string `json:"path"`
	// defaults to localhost if not specified
	Endpoint string `json:"endpoint,omitempty"`
	AppName  string `json:"app_name"`
}

type WekaDrive

type WekaDrive struct {
	DiskId       string `json:"disk_id"` // "DiskId<1>",
	Uid          string `json:"uid"`
	SerialNumber string `json:"serial_number"`
	DevUuid      string `json:"dev_uuid"`
	Status       string `json:"status"`
	IsFailed     bool   `json:"isFailed"`
	Name         string `json:"name"`
}

type WekaJSONRPCService added in v1.9.0

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

WekaJSONRPCService handles JSONRPC communication with Weka containers via Unix sockets

func NewWekaJSONRPCService added in v1.9.0

func NewWekaJSONRPCService() *WekaJSONRPCService

NewWekaJSONRPCService creates a new JSONRPC service

func (*WekaJSONRPCService) Call added in v1.9.0

func (s *WekaJSONRPCService) Call(ctx context.Context, container *ContainerInfo, method string, params map[string]any, data interface{}) error

Call makes a JSONRPC call to the specified container

func (*WekaJSONRPCService) Close added in v1.9.0

func (s *WekaJSONRPCService) Close()

Close closes all HTTP clients and cleans up resources

func (*WekaJSONRPCService) RemoveContainer added in v1.9.0

func (s *WekaJSONRPCService) RemoveContainer(containerId string)

RemoveContainer removes the HTTP client for a specific container (when container is deleted)

type WekaStat

type WekaStat struct {
	Params struct {
		FsId  string `json:"fS,omitempty"`   // integer in string format
		Disk  string `json:"disk,omitempty"` // integer in string format
		FeIdx string `json:"feIdx,omitempty"`
	} `json:"params"`
	Stat     string `json:"stat"`
	NodeId   string `json:"nodeId"` // NodeId<25011>
	Category string `json:"category"`
	Value    string `json:"value"`
	Unit     string `json:"unit"`
}

Jump to

Keyboard shortcuts

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