service

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMaxPowerScaleConnections is the number of workers that can query powerscale at a time
	DefaultMaxPowerScaleConnections = 10
	// ExpectedVolumeHandleProperties is the number of properties that the VolumeHandle contains
	ExpectedVolumeHandleProperties = 4
	// DirectoryQuotaType is the type of Quota corresponding to a volume
	DirectoryQuotaType = "directory"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncMetricCreator

type AsyncMetricCreator interface {
	AsyncInt64() asyncint64.InstrumentProvider
	AsyncFloat64() asyncfloat64.InstrumentProvider
}

AsyncMetricCreator to create AsyncInt64/AsyncFloat64 InstrumentProvider

type ClusterCapacityStatsMetrics

type ClusterCapacityStatsMetrics struct {
	TotalCapacity     asyncfloat64.UpDownCounter
	RemainingCapacity asyncfloat64.UpDownCounter
	UsedPercentage    asyncfloat64.UpDownCounter
}

ClusterCapacityStatsMetrics contains the capacity stats metrics related to a cluster

type ClusterCapacityStatsMetricsRecord

type ClusterCapacityStatsMetricsRecord struct {
	ClusterName       string
	TotalCapacity     float64
	RemainingCapacity float64
	UsedPercentage    float64
}

ClusterCapacityStatsMetricsRecord used for holding output of the capacity statistics for cluster

type ClusterMeta

type ClusterMeta struct {
	ClusterName string
}

ClusterMeta is the details of a cluster

type ClusterPerformanceStatsMetrics

type ClusterPerformanceStatsMetrics struct {
	CPUPercentage           asyncfloat64.UpDownCounter
	DiskReadOperationsRate  asyncfloat64.UpDownCounter
	DiskWriteOperationsRate asyncfloat64.UpDownCounter
	DiskReadThroughputRate  asyncfloat64.UpDownCounter
	DiskWriteThroughputRate asyncfloat64.UpDownCounter
}

ClusterPerformanceStatsMetrics contains the performance stats metrics related to a cluster

type ClusterPerformanceStatsMetricsRecord

type ClusterPerformanceStatsMetricsRecord struct {
	ClusterName                       string
	CPUPercentage                     float64
	DiskReadOperationsRate            float64
	DiskWriteOperationsRate           float64
	DiskReadThroughputRate            float64
	DiskWriteThroughputRate           float64
	DirectoryTotalHardQuota           float64
	DirectoryTotalHardQuotaPercentage float64
}

ClusterPerformanceStatsMetricsRecord used for holding output of the performance statistics for cluster

type ClusterQuotaMetrics

type ClusterQuotaMetrics struct {
	TotalHardQuotaGigabytes asyncfloat64.UpDownCounter
	TotalHardQuotaPct       asyncfloat64.UpDownCounter
}

ClusterQuotaMetrics contains quota capacity in all directories

type ClusterQuotaRecord

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

ClusterQuotaRecord used for holding output of the Volume stat query results

type LeaderElector

type LeaderElector interface {
	InitLeaderElection(string, string) error
	IsLeader() bool
}

LeaderElector will elect a leader

type MetricsRecorder

type MetricsRecorder interface {
	RecordVolumeQuota(ctx context.Context, meta interface{}, metric *VolumeQuotaMetricsRecord) error
	RecordClusterQuota(ctx context.Context, meta interface{}, metric *ClusterQuotaRecord) error
	RecordClusterCapacityStatsMetrics(ctx context.Context, metric *ClusterCapacityStatsMetricsRecord) error
	RecordClusterPerformanceStatsMetrics(ctx context.Context, metric *ClusterPerformanceStatsMetricsRecord) error
}

MetricsRecorder supports recording volume and cluster metric

type MetricsWrapper

type MetricsWrapper struct {
	Meter                          AsyncMetricCreator
	Labels                         sync.Map
	VolumeMetrics                  sync.Map
	ClusterCapacityStatsMetrics    sync.Map
	ClusterPerformanceStatsMetrics sync.Map
	VolumeQuotaMetrics             sync.Map
	ClusterQuotaMetrics            sync.Map
}

MetricsWrapper contains data used for pushing metrics data

func (*MetricsWrapper) RecordClusterCapacityStatsMetrics

func (mw *MetricsWrapper) RecordClusterCapacityStatsMetrics(ctx context.Context, metric *ClusterCapacityStatsMetricsRecord) error

RecordClusterCapacityStatsMetrics will publish cluster capacity stats metrics

func (*MetricsWrapper) RecordClusterPerformanceStatsMetrics

func (mw *MetricsWrapper) RecordClusterPerformanceStatsMetrics(ctx context.Context, metric *ClusterPerformanceStatsMetricsRecord) error

RecordClusterPerformanceStatsMetrics will publish cluster performance stats metrics

func (*MetricsWrapper) RecordClusterQuota

func (mw *MetricsWrapper) RecordClusterQuota(ctx context.Context, meta interface{}, metric *ClusterQuotaRecord) error

RecordClusterQuota will publish cluster Quota metrics data

func (*MetricsWrapper) RecordVolumeQuota

func (mw *MetricsWrapper) RecordVolumeQuota(ctx context.Context, meta interface{}, metric *VolumeQuotaMetricsRecord) error

RecordVolumeQuota will publish volume Quota metrics data

type PowerScaleClient

type PowerScaleClient interface {
	GetFloatStatistics(ctx context.Context, keys []string) (goisilon.FloatStats, error)
	GetAllQuotas(ctx context.Context) (goisilon.QuotaList, error)
}

PowerScaleClient contains operations for accessing the PowerScale API

type PowerScaleCluster

type PowerScaleCluster struct {
	Endpoint                 string `yaml:"endpoint"`
	EndpointPort             string `yaml:"endpointPort"`
	ClusterName              string `yaml:"clusterName"`
	Username                 string `yaml:"username"`
	Password                 string `yaml:"password"`
	Insecure                 bool   `yaml:"skipCertificateValidation"`
	IsDefault                bool   `yaml:"isDefault"`
	IsiPath                  string `yaml:"isiPath"`
	IsiVolumePathPermissions string `yaml:"isiVolumePathPermissions"`
	ReplicationCertificateID string `yaml:"replicationCertificateID"`

	Verbose     uint
	IsiAuthType uint8

	MountEndpoint string `yaml:"mountEndpoint,omitempty"`
	Client        *goisilon.Client
	EndpointURL   string
	IP            string
}

PowerScaleCluster is a struct that stores all PowerScale connection information. It stores gopowerscale client that can be directly used to invoke PowerSale API calls. This structure is supposed to be parsed from config and mainly is created by GetPowerScaleClusters function.

type PowerScaleService

type PowerScaleService struct {
	MetricsWrapper           MetricsRecorder
	MaxPowerScaleConnections int
	Logger                   *logrus.Logger
	PowerScaleClients        map[string]PowerScaleClient
	ClientIsiPaths           map[string]string
	DefaultPowerScaleCluster *PowerScaleCluster
	VolumeFinder             VolumeFinder
	StorageClassFinder       StorageClassFinder
}

PowerScaleService represents the service for getting metrics data for a PowerScale system

func (*PowerScaleService) ExportClusterCapacityMetrics

func (s *PowerScaleService) ExportClusterCapacityMetrics(ctx context.Context)

ExportClusterCapacityMetrics records cluster capacity metrics

func (*PowerScaleService) ExportClusterPerformanceMetrics

func (s *PowerScaleService) ExportClusterPerformanceMetrics(ctx context.Context)

ExportClusterPerformanceMetrics records cluster performance metrics

func (*PowerScaleService) ExportQuotaMetrics

func (s *PowerScaleService) ExportQuotaMetrics(ctx context.Context)

ExportQuotaMetrics records quota metrics for the given list of Volumes

type Service

type Service interface {
	ExportQuotaMetrics(context.Context)
	ExportClusterCapacityMetrics(context.Context)
	ExportClusterPerformanceMetrics(context.Context)
}

Service contains operations that would be used to interact with a PowerScale system

type StorageClassFinder

type StorageClassFinder interface {
	GetStorageClasses(context.Context) ([]v1.StorageClass, error)
}

StorageClassFinder is used to find storage classes in kubernetes

type VolumeFinder

type VolumeFinder interface {
	GetPersistentVolumes(context.Context) ([]k8s.VolumeInfo, error)
}

VolumeFinder is used to find volume information in kubernetes

type VolumeMeta

type VolumeMeta struct {
	ID                        string
	PersistentVolumeName      string
	ClusterName               string
	ExportID                  string
	AccessZone                string
	StorageClass              string
	Driver                    string
	IsiPath                   string
	PersistentVolumeClaimName string
	Namespace                 string
}

VolumeMeta is the details of a volume

type VolumeQuotaMetrics

type VolumeQuotaMetrics struct {
	QuotaSubscribed       asyncfloat64.UpDownCounter
	HardQuotaRemaining    asyncfloat64.UpDownCounter
	QuotaSubscribedPct    asyncfloat64.UpDownCounter
	HardQuotaRemainingPct asyncfloat64.UpDownCounter
}

VolumeQuotaMetrics contains volume quota metrics data

type VolumeQuotaMetricsRecord

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

VolumeQuotaMetricsRecord used for holding output of the Volume stat query results

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
asyncfloat64mock
Package asyncfloat64mock is a generated GoMock package.
Package asyncfloat64mock is a generated GoMock package.
asyncint64mock
Package asyncint64mock is a generated GoMock package.
Package asyncint64mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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