Documentation ¶
Overview ¶
Package metrics provides the metrics for the zadara-exporter.
Index ¶
Constants ¶
const ( // DefaultNamespace is the default namespace for the Prometheus exporter. DefaultNamespace = "zadara" // DefaultPath is the default path for the Prometheus exporter. DefaultPath = "/metrics" )
Variables ¶
This section is empty.
Functions ¶
func RegisterStorageMetrics ¶
RegisterStorageMetrics registers storage metrics for the given Zadara client. It creates storage metrics using the provided meter and registers the metrics callback to observe the storage metrics for the client. Returns an error if there was a failure in creating or registering the metrics.
func SetupPrometheusExporter ¶
SetupPrometheusExporter initialises and sets up the Prometheus exporter for metrics. It creates a new Prometheus exporter, sets it as the meter provider, and returns any error encountered.
Types ¶
type ClientFunc ¶
type ClientFunc func(ctx context.Context, target *config.Target) ZadaraClient
ClientFunc is a function that returns a ZadaraClient.
type StorageMetrics ¶
type StorageMetrics struct { FreeStorage metric.Int64ObservableGauge UsedStorage metric.Int64ObservableGauge AccountsCount metric.Int64ObservableGauge UsersCount metric.Int64ObservableGauge ContainersCount metric.Int64ObservableGauge ObjectsCount metric.Int64ObservableGauge DrivesCount metric.Int64ObservableGauge Cache metric.Int64ObservableGauge HealthPercentage metric.Float64ObservableGauge RebalancePercentage metric.Float64ObservableGauge PercentageDrivesAdded metric.Float64ObservableGauge RingBalanceNormalPercentage metric.Float64ObservableGauge RingBalanceDegradedPercentage metric.Float64ObservableGauge RingBalanceCriticalPercentage metric.Float64ObservableGauge RingBalanceNormalCount metric.Int64ObservableGauge RingBalanceDegradedCount metric.Int64ObservableGauge RingBalanceCriticalCount metric.Int64ObservableGauge }
StorageMetrics provides the metrics for the storage.
func NewStorageMetrics ¶
func NewStorageMetrics(meter metric.Meter) (*StorageMetrics, error)
NewStorageMetrics creates a new instance of StorageMetrics using the provided meter. It returns a pointer to the created StorageMetrics and an error, if any.
func (*StorageMetrics) StorageMetricsObserve ¶
func (sm *StorageMetrics) StorageMetricsObserve(targets []*config.Target, newclient ClientFunc) metric.Callback
StorageMetricsObserve returns a metric callback function that observes storage metrics for the given targets. It takes a slice of targets and a newclient function as parameters. The newclient function is used to create a new client for each target. The metric callback function iterates over the targets, creates a client for each target using the newclient function, and calls the observeStores function to observe the storage metrics for the target using the client. If any error occurs during the observation, it is returned. If all observations are successful, nil is returned.
type ZadaraClient ¶
type ZadaraClient interface {
GetAllStoragePolicies(ctx context.Context) ([]*commandcenter.StoreStoragePolicies, error)
}
ZadaraClient provides the client for the Zadara storage.