2024-01-19 17:51:36 -05:00
|
|
|
// Copyright (c) 2015-2024 MinIO, Inc.
|
2021-04-18 15:41:13 -04:00
|
|
|
//
|
|
|
|
// This file is part of MinIO Object Storage stack
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2021-01-18 23:35:38 -05:00
|
|
|
|
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
2024-01-18 17:51:28 -05:00
|
|
|
"math"
|
2021-01-18 23:35:38 -05:00
|
|
|
"net/http"
|
2021-01-22 21:30:16 -05:00
|
|
|
"runtime"
|
2023-11-13 03:59:48 -05:00
|
|
|
"strconv"
|
2021-01-18 23:35:38 -05:00
|
|
|
"strings"
|
|
|
|
"sync"
|
2021-10-02 12:31:05 -04:00
|
|
|
"sync/atomic"
|
2021-01-18 23:35:38 -05:00
|
|
|
"time"
|
|
|
|
|
2024-03-01 16:09:42 -05:00
|
|
|
"github.com/minio/kms-go/kes"
|
2023-12-02 05:51:33 -05:00
|
|
|
"github.com/minio/madmin-go/v3"
|
2021-10-02 12:31:05 -04:00
|
|
|
"github.com/minio/minio/internal/bucket/lifecycle"
|
2024-02-23 16:28:14 -05:00
|
|
|
"github.com/minio/minio/internal/cachevalue"
|
2024-01-28 13:04:17 -05:00
|
|
|
xioutil "github.com/minio/minio/internal/ioutil"
|
2021-06-01 17:59:40 -04:00
|
|
|
"github.com/minio/minio/internal/logger"
|
2022-12-06 12:27:26 -05:00
|
|
|
"github.com/minio/minio/internal/mcontext"
|
2022-09-26 12:04:26 -04:00
|
|
|
"github.com/minio/minio/internal/rest"
|
2021-01-18 23:35:38 -05:00
|
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
|
|
dto "github.com/prometheus/client_model/go"
|
2022-07-01 16:18:39 -04:00
|
|
|
"github.com/prometheus/common/expfmt"
|
2021-01-22 21:30:16 -05:00
|
|
|
"github.com/prometheus/procfs"
|
2021-01-18 23:35:38 -05:00
|
|
|
)
|
|
|
|
|
2024-02-19 17:54:46 -05:00
|
|
|
//go:generate msgp -file=$GOFILE -unexported -io=false
|
|
|
|
|
2021-12-17 13:11:04 -05:00
|
|
|
var (
|
2023-07-19 01:25:12 -04:00
|
|
|
nodeCollector *minioNodeCollector
|
|
|
|
clusterCollector *minioClusterCollector
|
|
|
|
bucketCollector *minioBucketCollector
|
2024-03-10 05:15:15 -04:00
|
|
|
peerMetricsGroups []*MetricsGroupV2
|
|
|
|
bucketPeerMetricsGroups []*MetricsGroupV2
|
2021-12-17 13:11:04 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2024-03-10 05:15:15 -04:00
|
|
|
clusterMetricsGroups := []*MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
getNodeHealthMetrics(MetricsGroupOpts{dependGlobalNotificationSys: true}),
|
|
|
|
getClusterStorageMetrics(MetricsGroupOpts{dependGlobalObjectAPI: true}),
|
|
|
|
getClusterTierMetrics(MetricsGroupOpts{dependGlobalObjectAPI: true}),
|
|
|
|
getClusterUsageMetrics(MetricsGroupOpts{dependGlobalObjectAPI: true}),
|
|
|
|
getKMSMetrics(MetricsGroupOpts{dependGlobalObjectAPI: true, dependGlobalKMS: true}),
|
|
|
|
getClusterHealthMetrics(MetricsGroupOpts{dependGlobalObjectAPI: true}),
|
|
|
|
getIAMNodeMetrics(MetricsGroupOpts{dependGlobalAuthNPlugin: true, dependGlobalIAMSys: true}),
|
|
|
|
getReplicationSiteMetrics(MetricsGroupOpts{dependGlobalSiteReplicationSys: true}),
|
2024-01-28 15:53:59 -05:00
|
|
|
getBatchJobsMetrics(MetricsGroupOpts{dependGlobalObjectAPI: true}),
|
2021-12-17 13:11:04 -05:00
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
peerMetricsGroups = []*MetricsGroupV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
getGoMetrics(),
|
2024-01-10 18:21:52 -05:00
|
|
|
getHTTPMetrics(MetricsGroupOpts{}),
|
|
|
|
getNotificationMetrics(MetricsGroupOpts{dependGlobalLambdaTargetList: true}),
|
2021-12-17 13:11:04 -05:00
|
|
|
getMinioProcMetrics(),
|
|
|
|
getMinioVersionMetrics(),
|
|
|
|
getNetworkMetrics(),
|
|
|
|
getS3TTFBMetric(),
|
|
|
|
getILMNodeMetrics(),
|
|
|
|
getScannerNodeMetrics(),
|
2024-01-10 18:21:52 -05:00
|
|
|
getIAMNodeMetrics(MetricsGroupOpts{dependGlobalAuthNPlugin: true, dependGlobalIAMSys: true}),
|
|
|
|
getKMSNodeMetrics(MetricsGroupOpts{dependGlobalObjectAPI: true, dependGlobalKMS: true}),
|
|
|
|
getMinioHealingMetrics(MetricsGroupOpts{dependGlobalBackgroundHealState: true}),
|
2023-05-11 14:24:37 -04:00
|
|
|
getWebhookMetrics(),
|
2024-01-28 15:53:59 -05:00
|
|
|
getTierMetrics(),
|
2021-12-17 13:11:04 -05:00
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
allMetricsGroups := func() (allMetrics []*MetricsGroupV2) {
|
2021-12-17 13:11:04 -05:00
|
|
|
allMetrics = append(allMetrics, clusterMetricsGroups...)
|
|
|
|
allMetrics = append(allMetrics, peerMetricsGroups...)
|
|
|
|
return allMetrics
|
|
|
|
}()
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
nodeGroups := []*MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
getNodeHealthMetrics(MetricsGroupOpts{dependGlobalNotificationSys: true}),
|
|
|
|
getHTTPMetrics(MetricsGroupOpts{}),
|
2021-12-17 13:11:04 -05:00
|
|
|
getNetworkMetrics(),
|
|
|
|
getMinioVersionMetrics(),
|
|
|
|
getS3TTFBMetric(),
|
2023-12-20 23:13:40 -05:00
|
|
|
getTierMetrics(),
|
2024-01-10 18:21:52 -05:00
|
|
|
getNotificationMetrics(MetricsGroupOpts{dependGlobalLambdaTargetList: true}),
|
|
|
|
getDistLockMetrics(MetricsGroupOpts{dependGlobalIsDistErasure: true, dependGlobalLockServer: true}),
|
|
|
|
getIAMNodeMetrics(MetricsGroupOpts{dependGlobalAuthNPlugin: true, dependGlobalIAMSys: true}),
|
|
|
|
getLocalStorageMetrics(MetricsGroupOpts{dependGlobalObjectAPI: true}),
|
2024-01-28 15:53:59 -05:00
|
|
|
getReplicationNodeMetrics(MetricsGroupOpts{dependGlobalObjectAPI: true, dependBucketTargetSys: true}),
|
2023-04-04 00:23:24 -04:00
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
bucketMetricsGroups := []*MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
getBucketUsageMetrics(MetricsGroupOpts{dependGlobalObjectAPI: true}),
|
|
|
|
getHTTPMetrics(MetricsGroupOpts{bucketOnly: true}),
|
2023-07-19 01:25:12 -04:00
|
|
|
getBucketTTFBMetric(),
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
bucketPeerMetricsGroups = []*MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
getHTTPMetrics(MetricsGroupOpts{bucketOnly: true}),
|
2023-07-19 01:25:12 -04:00
|
|
|
getBucketTTFBMetric(),
|
|
|
|
}
|
|
|
|
|
2023-04-04 00:23:24 -04:00
|
|
|
nodeCollector = newMinioCollectorNode(nodeGroups)
|
2021-12-17 13:11:04 -05:00
|
|
|
clusterCollector = newMinioClusterCollector(allMetricsGroups)
|
2023-07-19 01:25:12 -04:00
|
|
|
bucketCollector = newMinioBucketCollector(bucketMetricsGroups)
|
2021-12-17 13:11:04 -05:00
|
|
|
}
|
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
// MetricNamespace is top level grouping of metrics to create the metric name.
|
|
|
|
type MetricNamespace string
|
|
|
|
|
|
|
|
// MetricSubsystem is the sub grouping for metrics within a namespace.
|
|
|
|
type MetricSubsystem string
|
|
|
|
|
|
|
|
const (
|
|
|
|
bucketMetricNamespace MetricNamespace = "minio_bucket"
|
|
|
|
clusterMetricNamespace MetricNamespace = "minio_cluster"
|
|
|
|
healMetricNamespace MetricNamespace = "minio_heal"
|
|
|
|
interNodeMetricNamespace MetricNamespace = "minio_inter_node"
|
|
|
|
nodeMetricNamespace MetricNamespace = "minio_node"
|
2021-04-03 12:03:42 -04:00
|
|
|
minioMetricNamespace MetricNamespace = "minio"
|
2021-01-18 23:35:38 -05:00
|
|
|
s3MetricNamespace MetricNamespace = "minio_s3"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2021-03-31 02:19:36 -04:00
|
|
|
cacheSubsystem MetricSubsystem = "cache"
|
|
|
|
capacityRawSubsystem MetricSubsystem = "capacity_raw"
|
|
|
|
capacityUsableSubsystem MetricSubsystem = "capacity_usable"
|
2023-08-15 13:55:47 -04:00
|
|
|
driveSubsystem MetricSubsystem = "drive"
|
2023-09-30 16:40:20 -04:00
|
|
|
interfaceSubsystem MetricSubsystem = "if"
|
|
|
|
memSubsystem MetricSubsystem = "mem"
|
|
|
|
cpuSubsystem MetricSubsystem = "cpu_avg"
|
2023-05-04 17:44:30 -04:00
|
|
|
storageClassSubsystem MetricSubsystem = "storage_class"
|
2021-03-31 02:19:36 -04:00
|
|
|
fileDescriptorSubsystem MetricSubsystem = "file_descriptor"
|
|
|
|
goRoutines MetricSubsystem = "go_routine"
|
|
|
|
ioSubsystem MetricSubsystem = "io"
|
|
|
|
nodesSubsystem MetricSubsystem = "nodes"
|
|
|
|
objectsSubsystem MetricSubsystem = "objects"
|
2023-07-19 01:25:12 -04:00
|
|
|
bucketsSubsystem MetricSubsystem = "bucket"
|
2021-03-31 02:19:36 -04:00
|
|
|
processSubsystem MetricSubsystem = "process"
|
|
|
|
replicationSubsystem MetricSubsystem = "replication"
|
|
|
|
requestsSubsystem MetricSubsystem = "requests"
|
|
|
|
requestsRejectedSubsystem MetricSubsystem = "requests_rejected"
|
|
|
|
timeSubsystem MetricSubsystem = "time"
|
2023-07-19 01:25:12 -04:00
|
|
|
ttfbSubsystem MetricSubsystem = "requests_ttfb"
|
2021-03-31 02:19:36 -04:00
|
|
|
trafficSubsystem MetricSubsystem = "traffic"
|
|
|
|
softwareSubsystem MetricSubsystem = "software"
|
|
|
|
sysCallSubsystem MetricSubsystem = "syscall"
|
|
|
|
usageSubsystem MetricSubsystem = "usage"
|
2022-01-31 20:27:43 -05:00
|
|
|
quotaSubsystem MetricSubsystem = "quota"
|
2021-08-17 13:21:19 -04:00
|
|
|
ilmSubsystem MetricSubsystem = "ilm"
|
2023-12-20 23:13:40 -05:00
|
|
|
tierSubsystem MetricSubsystem = "tier"
|
2021-10-02 12:31:05 -04:00
|
|
|
scannerSubsystem MetricSubsystem = "scanner"
|
2022-04-03 16:08:59 -04:00
|
|
|
iamSubsystem MetricSubsystem = "iam"
|
2022-07-11 12:17:28 -04:00
|
|
|
kmsSubsystem MetricSubsystem = "kms"
|
2022-11-08 19:36:47 -05:00
|
|
|
notifySubsystem MetricSubsystem = "notify"
|
2023-03-07 11:12:41 -05:00
|
|
|
lambdaSubsystem MetricSubsystem = "lambda"
|
2022-11-10 13:20:21 -05:00
|
|
|
auditSubsystem MetricSubsystem = "audit"
|
2023-05-11 14:24:37 -04:00
|
|
|
webhookSubsystem MetricSubsystem = "webhook"
|
2021-01-18 23:35:38 -05:00
|
|
|
)
|
|
|
|
|
2021-01-22 21:30:16 -05:00
|
|
|
// MetricName are the individual names for the metric.
|
|
|
|
type MetricName string
|
2021-01-18 23:35:38 -05:00
|
|
|
|
|
|
|
const (
|
2023-07-20 10:52:32 -04:00
|
|
|
authTotal MetricName = "auth_total"
|
|
|
|
canceledTotal MetricName = "canceled_total"
|
|
|
|
errorsTotal MetricName = "errors_total"
|
|
|
|
headerTotal MetricName = "header_total"
|
|
|
|
healTotal MetricName = "heal_total"
|
|
|
|
hitsTotal MetricName = "hits_total"
|
|
|
|
inflightTotal MetricName = "inflight_total"
|
|
|
|
invalidTotal MetricName = "invalid_total"
|
|
|
|
limitTotal MetricName = "limit_total"
|
|
|
|
missedTotal MetricName = "missed_total"
|
|
|
|
waitingTotal MetricName = "waiting_total"
|
|
|
|
incomingTotal MetricName = "incoming_total"
|
|
|
|
objectTotal MetricName = "object_total"
|
|
|
|
versionTotal MetricName = "version_total"
|
|
|
|
deleteMarkerTotal MetricName = "deletemarker_total"
|
|
|
|
offlineTotal MetricName = "offline_total"
|
|
|
|
onlineTotal MetricName = "online_total"
|
|
|
|
openTotal MetricName = "open_total"
|
|
|
|
readTotal MetricName = "read_total"
|
|
|
|
timestampTotal MetricName = "timestamp_total"
|
|
|
|
writeTotal MetricName = "write_total"
|
|
|
|
total MetricName = "total"
|
|
|
|
freeInodes MetricName = "free_inodes"
|
2021-01-22 21:30:16 -05:00
|
|
|
|
2023-08-30 04:00:59 -04:00
|
|
|
lastMinFailedCount MetricName = "last_minute_failed_count"
|
|
|
|
lastMinFailedBytes MetricName = "last_minute_failed_bytes"
|
|
|
|
lastHourFailedCount MetricName = "last_hour_failed_count"
|
|
|
|
lastHourFailedBytes MetricName = "last_hour_failed_bytes"
|
|
|
|
totalFailedCount MetricName = "total_failed_count"
|
|
|
|
totalFailedBytes MetricName = "total_failed_bytes"
|
|
|
|
|
|
|
|
currActiveWorkers MetricName = "current_active_workers"
|
|
|
|
avgActiveWorkers MetricName = "average_active_workers"
|
|
|
|
maxActiveWorkers MetricName = "max_active_workers"
|
|
|
|
recentBacklogCount MetricName = "recent_backlog_count"
|
|
|
|
currInQueueCount MetricName = "last_minute_queued_count"
|
|
|
|
currInQueueBytes MetricName = "last_minute_queued_bytes"
|
|
|
|
receivedCount MetricName = "received_count"
|
|
|
|
sentCount MetricName = "sent_count"
|
|
|
|
currTransferRate MetricName = "current_transfer_rate"
|
|
|
|
avgTransferRate MetricName = "average_transfer_rate"
|
|
|
|
maxTransferRate MetricName = "max_transfer_rate"
|
|
|
|
credentialErrors MetricName = "credential_errors"
|
|
|
|
|
|
|
|
currLinkLatency MetricName = "current_link_latency_ms"
|
|
|
|
avgLinkLatency MetricName = "average_link_latency_ms"
|
|
|
|
maxLinkLatency MetricName = "max_link_latency_ms"
|
|
|
|
|
|
|
|
linkOnline MetricName = "link_online"
|
|
|
|
linkOfflineDuration MetricName = "link_offline_duration_seconds"
|
|
|
|
linkDowntimeTotalDuration MetricName = "link_downtime_duration_seconds"
|
|
|
|
|
2024-02-06 01:00:45 -05:00
|
|
|
avgInQueueCount MetricName = "average_queued_count"
|
|
|
|
avgInQueueBytes MetricName = "average_queued_bytes"
|
|
|
|
maxInQueueCount MetricName = "max_queued_count"
|
|
|
|
maxInQueueBytes MetricName = "max_queued_bytes"
|
|
|
|
proxiedGetRequestsTotal MetricName = "proxied_get_requests_total"
|
|
|
|
proxiedHeadRequestsTotal MetricName = "proxied_head_requests_total"
|
|
|
|
proxiedPutTaggingRequestsTotal MetricName = "proxied_put_tagging_requests_total"
|
|
|
|
proxiedGetTaggingRequestsTotal MetricName = "proxied_get_tagging_requests_total"
|
|
|
|
proxiedDeleteTaggingRequestsTotal MetricName = "proxied_delete_tagging_requests_total"
|
|
|
|
proxiedGetRequestsFailures MetricName = "proxied_get_requests_failures"
|
|
|
|
proxiedHeadRequestsFailures MetricName = "proxied_head_requests_failures"
|
|
|
|
proxiedPutTaggingRequestFailures MetricName = "proxied_put_tagging_requests_failures"
|
|
|
|
proxiedGetTaggingRequestFailures MetricName = "proxied_get_tagging_requests_failures"
|
|
|
|
proxiedDeleteTaggingRequestFailures MetricName = "proxied_delete_tagging_requests_failures"
|
2023-08-30 04:00:59 -04:00
|
|
|
|
2021-11-17 15:10:57 -05:00
|
|
|
freeBytes MetricName = "free_bytes"
|
|
|
|
readBytes MetricName = "read_bytes"
|
|
|
|
rcharBytes MetricName = "rchar_bytes"
|
|
|
|
receivedBytes MetricName = "received_bytes"
|
|
|
|
latencyMilliSec MetricName = "latency_ms"
|
|
|
|
sentBytes MetricName = "sent_bytes"
|
|
|
|
totalBytes MetricName = "total_bytes"
|
|
|
|
usedBytes MetricName = "used_bytes"
|
|
|
|
writeBytes MetricName = "write_bytes"
|
|
|
|
wcharBytes MetricName = "wchar_bytes"
|
2021-01-22 21:30:16 -05:00
|
|
|
|
2022-09-26 12:04:26 -04:00
|
|
|
latencyMicroSec MetricName = "latency_us"
|
|
|
|
latencyNanoSec MetricName = "latency_ns"
|
2022-01-25 19:31:44 -05:00
|
|
|
|
2021-01-22 21:30:16 -05:00
|
|
|
commitInfo MetricName = "commit_info"
|
|
|
|
usageInfo MetricName = "usage_info"
|
|
|
|
versionInfo MetricName = "version_info"
|
2021-01-18 23:35:38 -05:00
|
|
|
|
2023-03-10 11:53:59 -05:00
|
|
|
sizeDistribution = "size_distribution"
|
|
|
|
versionDistribution = "version_distribution"
|
2023-07-19 01:25:12 -04:00
|
|
|
ttfbDistribution = "seconds_distribution"
|
2023-12-20 23:13:40 -05:00
|
|
|
ttlbDistribution = "ttlb_seconds_distribution"
|
2021-01-18 23:35:38 -05:00
|
|
|
|
|
|
|
lastActivityTime = "last_activity_nano_seconds"
|
2021-02-02 02:02:18 -05:00
|
|
|
startTime = "starttime_seconds"
|
2021-03-21 00:23:27 -04:00
|
|
|
upTime = "uptime_seconds"
|
2021-05-04 13:17:10 -04:00
|
|
|
memory = "resident_memory_bytes"
|
2024-01-19 17:51:36 -05:00
|
|
|
vmemory = "virtual_memory_bytes"
|
2021-05-04 13:17:10 -04:00
|
|
|
cpu = "cpu_total_seconds"
|
2021-08-17 13:21:19 -04:00
|
|
|
|
2024-03-02 00:11:03 -05:00
|
|
|
expiryPendingTasks MetricName = "expiry_pending_tasks"
|
|
|
|
expiryMissedTasks MetricName = "expiry_missed_tasks"
|
|
|
|
expiryMissedFreeVersions MetricName = "expiry_missed_freeversions"
|
|
|
|
expiryMissedTierJournalTasks MetricName = "expiry_missed_tierjournal_tasks"
|
|
|
|
expiryNumWorkers MetricName = "expiry_num_workers"
|
|
|
|
transitionPendingTasks MetricName = "transition_pending_tasks"
|
|
|
|
transitionActiveTasks MetricName = "transition_active_tasks"
|
|
|
|
transitionMissedTasks MetricName = "transition_missed_immediate_tasks"
|
2022-02-08 15:45:28 -05:00
|
|
|
|
|
|
|
transitionedBytes MetricName = "transitioned_bytes"
|
|
|
|
transitionedObjects MetricName = "transitioned_objects"
|
|
|
|
transitionedVersions MetricName = "transitioned_versions"
|
2022-07-11 12:17:28 -04:00
|
|
|
|
2023-12-20 23:13:40 -05:00
|
|
|
tierRequestsSuccess MetricName = "requests_success"
|
|
|
|
tierRequestsFailure MetricName = "requests_failure"
|
|
|
|
|
2022-07-11 12:17:28 -04:00
|
|
|
kmsOnline = "online"
|
|
|
|
kmsRequestsSuccess = "request_success"
|
|
|
|
kmsRequestsError = "request_error"
|
|
|
|
kmsRequestsFail = "request_failure"
|
|
|
|
kmsUptime = "uptime"
|
2023-05-11 14:24:37 -04:00
|
|
|
|
|
|
|
webhookOnline = "online"
|
|
|
|
webhookQueueLength = "queue_length"
|
|
|
|
webhookTotalMessages = "total_messages"
|
|
|
|
webhookFailedMessages = "failed_messages"
|
2021-01-18 23:35:38 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
serverName = "server"
|
|
|
|
)
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
// MetricTypeV2 for the types of metrics supported
|
|
|
|
type MetricTypeV2 string
|
2021-01-18 23:35:38 -05:00
|
|
|
|
|
|
|
const (
|
|
|
|
gaugeMetric = "gaugeMetric"
|
|
|
|
counterMetric = "counterMetric"
|
|
|
|
histogramMetric = "histogramMetric"
|
|
|
|
)
|
|
|
|
|
|
|
|
// MetricDescription describes the metric
|
|
|
|
type MetricDescription struct {
|
|
|
|
Namespace MetricNamespace `json:"MetricNamespace"`
|
|
|
|
Subsystem MetricSubsystem `json:"Subsystem"`
|
2021-01-22 21:30:16 -05:00
|
|
|
Name MetricName `json:"MetricName"`
|
2021-01-18 23:35:38 -05:00
|
|
|
Help string `json:"Help"`
|
2024-03-10 05:15:15 -04:00
|
|
|
Type MetricTypeV2 `json:"Type"`
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
// MetricV2 captures the details for a metric
|
|
|
|
type MetricV2 struct {
|
2021-01-18 23:35:38 -05:00
|
|
|
Description MetricDescription `json:"Description"`
|
|
|
|
StaticLabels map[string]string `json:"StaticLabels"`
|
|
|
|
Value float64 `json:"Value"`
|
|
|
|
VariableLabels map[string]string `json:"VariableLabels"`
|
|
|
|
HistogramBucketLabel string `json:"HistogramBucketLabel"`
|
|
|
|
Histogram map[string]uint64 `json:"Histogram"`
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
// MetricsGroupV2 are a group of metrics that are initialized together.
|
|
|
|
type MetricsGroupV2 struct {
|
|
|
|
metricsCache *cachevalue.Cache[[]MetricV2] `msg:"-"`
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval time.Duration
|
|
|
|
metricsGroupOpts MetricsGroupOpts
|
|
|
|
}
|
|
|
|
|
|
|
|
// MetricsGroupOpts are a group of metrics opts to be used to initialize the metrics group.
|
|
|
|
type MetricsGroupOpts struct {
|
|
|
|
dependGlobalObjectAPI bool
|
|
|
|
dependGlobalAuthNPlugin bool
|
|
|
|
dependGlobalSiteReplicationSys bool
|
|
|
|
dependGlobalNotificationSys bool
|
|
|
|
dependGlobalKMS bool
|
|
|
|
bucketOnly bool
|
|
|
|
dependGlobalLambdaTargetList bool
|
|
|
|
dependGlobalIAMSys bool
|
|
|
|
dependGlobalLockServer bool
|
|
|
|
dependGlobalIsDistErasure bool
|
|
|
|
dependGlobalBackgroundHealState bool
|
|
|
|
dependBucketTargetSys bool
|
2021-03-19 03:04:29 -04:00
|
|
|
}
|
|
|
|
|
2021-12-17 13:11:04 -05:00
|
|
|
// RegisterRead register the metrics populator function to be used
|
|
|
|
// to populate new values upon cache invalidation.
|
2024-03-10 05:15:15 -04:00
|
|
|
func (g *MetricsGroupV2) RegisterRead(read func(context.Context) []MetricV2) {
|
2024-02-28 12:09:09 -05:00
|
|
|
g.metricsCache = cachevalue.NewFromFunc(g.cacheInterval,
|
|
|
|
cachevalue.Opts{ReturnLastGood: true},
|
2024-03-10 05:15:15 -04:00
|
|
|
func() ([]MetricV2, error) {
|
2024-01-10 18:21:52 -05:00
|
|
|
if g.metricsGroupOpts.dependGlobalObjectAPI {
|
|
|
|
objLayer := newObjectLayerFn()
|
|
|
|
// Service not initialized yet
|
|
|
|
if objLayer == nil {
|
2024-03-10 05:15:15 -04:00
|
|
|
return []MetricV2{}, nil
|
2024-01-10 18:21:52 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if g.metricsGroupOpts.dependGlobalAuthNPlugin {
|
|
|
|
if globalAuthNPlugin == nil {
|
2024-03-10 05:15:15 -04:00
|
|
|
return []MetricV2{}, nil
|
2024-01-10 18:21:52 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if g.metricsGroupOpts.dependGlobalSiteReplicationSys {
|
|
|
|
if !globalSiteReplicationSys.isEnabled() {
|
2024-03-10 05:15:15 -04:00
|
|
|
return []MetricV2{}, nil
|
2024-01-10 18:21:52 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if g.metricsGroupOpts.dependGlobalNotificationSys {
|
|
|
|
if globalNotificationSys == nil {
|
2024-03-10 05:15:15 -04:00
|
|
|
return []MetricV2{}, nil
|
2024-01-10 18:21:52 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if g.metricsGroupOpts.dependGlobalKMS {
|
|
|
|
if GlobalKMS == nil {
|
2024-03-10 05:15:15 -04:00
|
|
|
return []MetricV2{}, nil
|
2024-01-10 18:21:52 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if g.metricsGroupOpts.dependGlobalLambdaTargetList {
|
|
|
|
if globalLambdaTargetList == nil {
|
2024-03-10 05:15:15 -04:00
|
|
|
return []MetricV2{}, nil
|
2024-01-10 18:21:52 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if g.metricsGroupOpts.dependGlobalIAMSys {
|
|
|
|
if globalIAMSys == nil {
|
2024-03-10 05:15:15 -04:00
|
|
|
return []MetricV2{}, nil
|
2024-01-10 18:21:52 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if g.metricsGroupOpts.dependGlobalLockServer {
|
|
|
|
if globalLockServer == nil {
|
2024-03-10 05:15:15 -04:00
|
|
|
return []MetricV2{}, nil
|
2024-01-10 18:21:52 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if g.metricsGroupOpts.dependGlobalIsDistErasure {
|
|
|
|
if !globalIsDistErasure {
|
2024-03-10 05:15:15 -04:00
|
|
|
return []MetricV2{}, nil
|
2024-01-10 18:21:52 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if g.metricsGroupOpts.dependGlobalBackgroundHealState {
|
|
|
|
if globalBackgroundHealState == nil {
|
2024-03-10 05:15:15 -04:00
|
|
|
return []MetricV2{}, nil
|
2024-01-10 18:21:52 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if g.metricsGroupOpts.dependBucketTargetSys {
|
|
|
|
if globalBucketTargetSys == nil {
|
2024-03-10 05:15:15 -04:00
|
|
|
return []MetricV2{}, nil
|
2024-01-10 18:21:52 -05:00
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
return read(GlobalContext), nil
|
2024-02-28 12:09:09 -05:00
|
|
|
},
|
|
|
|
)
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func (m *MetricV2) clone() MetricV2 {
|
|
|
|
metric := MetricV2{
|
2022-01-14 19:48:19 -05:00
|
|
|
Description: m.Description,
|
|
|
|
Value: m.Value,
|
|
|
|
HistogramBucketLabel: m.HistogramBucketLabel,
|
2024-02-21 15:27:35 -05:00
|
|
|
StaticLabels: make(map[string]string, len(m.StaticLabels)),
|
|
|
|
VariableLabels: make(map[string]string, len(m.VariableLabels)),
|
|
|
|
Histogram: make(map[string]uint64, len(m.Histogram)),
|
2022-01-14 19:48:19 -05:00
|
|
|
}
|
|
|
|
for k, v := range m.StaticLabels {
|
|
|
|
metric.StaticLabels[k] = v
|
|
|
|
}
|
|
|
|
for k, v := range m.VariableLabels {
|
|
|
|
metric.VariableLabels[k] = v
|
|
|
|
}
|
|
|
|
for k, v := range m.Histogram {
|
|
|
|
metric.Histogram[k] = v
|
|
|
|
}
|
|
|
|
return metric
|
|
|
|
}
|
|
|
|
|
2021-12-17 13:11:04 -05:00
|
|
|
// Get - returns cached value always upton the configured TTL,
|
|
|
|
// once the TTL expires "read()" registered function is called
|
|
|
|
// to return the new values and updated.
|
2024-03-10 05:15:15 -04:00
|
|
|
func (g *MetricsGroupV2) Get() (metrics []MetricV2) {
|
2024-02-23 12:21:38 -05:00
|
|
|
m, _ := g.metricsCache.Get()
|
|
|
|
if len(m) == 0 {
|
2024-03-10 05:15:15 -04:00
|
|
|
return []MetricV2{}
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = make([]MetricV2, 0, len(m))
|
2022-01-14 19:48:19 -05:00
|
|
|
for i := range m {
|
2024-02-21 15:27:35 -05:00
|
|
|
metrics = append(metrics, m[i].clone())
|
2022-01-14 19:48:19 -05:00
|
|
|
}
|
|
|
|
return metrics
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
|
2023-07-19 01:25:12 -04:00
|
|
|
func getClusterBucketsTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: bucketsSubsystem,
|
|
|
|
Name: total,
|
|
|
|
Help: "Total number of buckets in the cluster",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getClusterCapacityTotalBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: capacityRawSubsystem,
|
|
|
|
Name: totalBytes,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Total capacity online in the cluster",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getClusterCapacityFreeBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: capacityRawSubsystem,
|
|
|
|
Name: freeBytes,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Total free capacity online in the cluster",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getClusterCapacityUsageBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: capacityUsableSubsystem,
|
|
|
|
Name: totalBytes,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Total usable capacity online in the cluster",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getClusterCapacityUsageFreeBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: capacityUsableSubsystem,
|
|
|
|
Name: freeBytes,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Total free usable capacity online in the cluster",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-01 17:31:35 -05:00
|
|
|
func getNodeDriveAPILatencyMD() MetricDescription {
|
2022-01-25 19:31:44 -05:00
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
2023-08-15 13:55:47 -04:00
|
|
|
Subsystem: driveSubsystem,
|
2022-09-26 12:04:26 -04:00
|
|
|
Name: latencyMicroSec,
|
2022-08-04 19:10:08 -04:00
|
|
|
Help: "Average last minute latency in µs for drive API storage operations",
|
2022-01-25 19:31:44 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-01 17:31:35 -05:00
|
|
|
func getNodeDriveUsedBytesMD() MetricDescription {
|
2021-01-18 23:35:38 -05:00
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
2023-08-15 13:55:47 -04:00
|
|
|
Subsystem: driveSubsystem,
|
2021-01-18 23:35:38 -05:00
|
|
|
Name: usedBytes,
|
2022-08-04 19:10:08 -04:00
|
|
|
Help: "Total storage used on a drive",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2023-08-15 13:55:47 -04:00
|
|
|
func getNodeDriveTimeoutErrorsMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: driveSubsystem,
|
|
|
|
Name: "errors_timeout",
|
2024-01-19 17:51:36 -05:00
|
|
|
Help: "Total number of drive timeout errors since server start",
|
2023-08-15 13:55:47 -04:00
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-22 01:26:06 -05:00
|
|
|
func getNodeDriveAvailabilityErrorsMD() MetricDescription {
|
2023-08-15 13:55:47 -04:00
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: driveSubsystem,
|
|
|
|
Name: "errors_availability",
|
2024-01-19 17:51:36 -05:00
|
|
|
Help: "Total number of drive I/O errors, permission denied and timeouts since server start",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getNodeDriveWaitingIOMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: driveSubsystem,
|
|
|
|
Name: "io_waiting",
|
|
|
|
Help: "Total number I/O operations waiting on drive",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-01 17:31:35 -05:00
|
|
|
func getNodeDriveFreeBytesMD() MetricDescription {
|
2021-01-18 23:35:38 -05:00
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
2023-08-15 13:55:47 -04:00
|
|
|
Subsystem: driveSubsystem,
|
2021-01-18 23:35:38 -05:00
|
|
|
Name: freeBytes,
|
2022-08-04 19:10:08 -04:00
|
|
|
Help: "Total storage available on a drive",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2022-12-01 17:31:35 -05:00
|
|
|
func getClusterDrivesOfflineTotalMD() MetricDescription {
|
2021-01-18 23:35:38 -05:00
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
2023-08-15 13:55:47 -04:00
|
|
|
Subsystem: driveSubsystem,
|
2021-01-18 23:35:38 -05:00
|
|
|
Name: offlineTotal,
|
2023-08-15 13:55:47 -04:00
|
|
|
Help: "Total drives offline in this cluster",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-01 17:31:35 -05:00
|
|
|
func getClusterDrivesOnlineTotalMD() MetricDescription {
|
2021-01-18 23:35:38 -05:00
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
2023-08-15 13:55:47 -04:00
|
|
|
Subsystem: driveSubsystem,
|
2021-01-18 23:35:38 -05:00
|
|
|
Name: onlineTotal,
|
2023-08-15 13:55:47 -04:00
|
|
|
Help: "Total drives online in this cluster",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-01 17:31:35 -05:00
|
|
|
func getClusterDrivesTotalMD() MetricDescription {
|
2021-03-03 14:18:41 -05:00
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
2023-08-15 13:55:47 -04:00
|
|
|
Subsystem: driveSubsystem,
|
2021-03-03 14:18:41 -05:00
|
|
|
Name: total,
|
2023-08-15 13:55:47 -04:00
|
|
|
Help: "Total drives in this cluster",
|
2021-03-03 14:18:41 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-01 17:31:35 -05:00
|
|
|
func getNodeDrivesOfflineTotalMD() MetricDescription {
|
2021-05-06 02:03:40 -04:00
|
|
|
return MetricDescription{
|
2022-12-01 17:31:35 -05:00
|
|
|
Namespace: nodeMetricNamespace,
|
2023-08-15 13:55:47 -04:00
|
|
|
Subsystem: driveSubsystem,
|
2022-12-01 17:31:35 -05:00
|
|
|
Name: offlineTotal,
|
2023-08-15 13:55:47 -04:00
|
|
|
Help: "Total drives offline in this node",
|
2022-12-01 17:31:35 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getNodeDrivesOnlineTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
2023-08-15 13:55:47 -04:00
|
|
|
Subsystem: driveSubsystem,
|
2022-12-01 17:31:35 -05:00
|
|
|
Name: onlineTotal,
|
2023-08-15 13:55:47 -04:00
|
|
|
Help: "Total drives online in this node",
|
2022-12-01 17:31:35 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getNodeDrivesTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
2023-08-15 13:55:47 -04:00
|
|
|
Subsystem: driveSubsystem,
|
2022-12-01 17:31:35 -05:00
|
|
|
Name: total,
|
2023-08-15 13:55:47 -04:00
|
|
|
Help: "Total drives in this node",
|
2022-12-01 17:31:35 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-04 17:44:30 -04:00
|
|
|
func getNodeStandardParityMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: storageClassSubsystem,
|
|
|
|
Name: "standard_parity",
|
|
|
|
Help: "standard storage class parity",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getNodeRRSParityMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: storageClassSubsystem,
|
|
|
|
Name: "rrs_parity",
|
|
|
|
Help: "reduced redundancy storage class parity",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-30 16:40:20 -04:00
|
|
|
func getNodeDrivesFreeInodesMD() MetricDescription {
|
2022-12-01 17:31:35 -05:00
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
2023-08-15 13:55:47 -04:00
|
|
|
Subsystem: driveSubsystem,
|
2021-05-06 02:03:40 -04:00
|
|
|
Name: freeInodes,
|
2023-09-30 16:40:20 -04:00
|
|
|
Help: "Free inodes on a drive",
|
2021-05-06 02:03:40 -04:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-01 17:31:35 -05:00
|
|
|
func getNodeDriveTotalBytesMD() MetricDescription {
|
2021-01-18 23:35:38 -05:00
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
2023-08-15 13:55:47 -04:00
|
|
|
Subsystem: driveSubsystem,
|
2021-01-18 23:35:38 -05:00
|
|
|
Name: totalBytes,
|
2022-08-04 19:10:08 -04:00
|
|
|
Help: "Total storage on a drive",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-04-03 12:03:42 -04:00
|
|
|
func getUsageLastScanActivityMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: minioMetricNamespace,
|
|
|
|
Subsystem: usageSubsystem,
|
|
|
|
Name: lastActivityTime,
|
2023-06-21 12:41:59 -04:00
|
|
|
Help: "Time elapsed (in nano seconds) since last scan activity.",
|
2021-04-03 12:03:42 -04:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-31 20:27:43 -05:00
|
|
|
func getBucketUsageQuotaTotalBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: quotaSubsystem,
|
|
|
|
Name: totalBytes,
|
|
|
|
Help: "Total bucket quota size in bytes",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-14 18:14:24 -04:00
|
|
|
func getBucketTrafficReceivedBytes() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: trafficSubsystem,
|
|
|
|
Name: receivedBytes,
|
|
|
|
Help: "Total number of S3 bytes received for this bucket",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getBucketTrafficSentBytes() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: trafficSubsystem,
|
|
|
|
Name: sentBytes,
|
|
|
|
Help: "Total number of S3 bytes sent for this bucket",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getBucketUsageTotalBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: usageSubsystem,
|
|
|
|
Name: totalBytes,
|
|
|
|
Help: "Total bucket size in bytes",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2022-01-02 12:15:06 -05:00
|
|
|
|
2023-07-19 01:25:12 -04:00
|
|
|
func getClusterUsageTotalBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: usageSubsystem,
|
|
|
|
Name: totalBytes,
|
|
|
|
Help: "Total cluster usage in bytes",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterUsageObjectsTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: usageSubsystem,
|
|
|
|
Name: objectTotal,
|
|
|
|
Help: "Total number of objects in a cluster",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterUsageVersionsTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: usageSubsystem,
|
|
|
|
Name: versionTotal,
|
|
|
|
Help: "Total number of versions (includes delete marker) in a cluster",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-20 10:52:32 -04:00
|
|
|
func getClusterUsageDeleteMarkersTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: usageSubsystem,
|
|
|
|
Name: deleteMarkerTotal,
|
|
|
|
Help: "Total number of delete markers in a cluster",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getBucketUsageObjectsTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: usageSubsystem,
|
|
|
|
Name: objectTotal,
|
|
|
|
Help: "Total number of objects",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-05-31 23:26:52 -04:00
|
|
|
|
2023-04-12 23:08:07 -04:00
|
|
|
func getBucketUsageVersionsTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: usageSubsystem,
|
|
|
|
Name: versionTotal,
|
2023-07-19 01:25:12 -04:00
|
|
|
Help: "Total number of versions (includes delete marker)",
|
2023-04-12 23:08:07 -04:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-20 10:52:32 -04:00
|
|
|
func getBucketUsageDeleteMarkersTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: usageSubsystem,
|
|
|
|
Name: deleteMarkerTotal,
|
|
|
|
Help: "Total number of delete markers",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-30 04:00:59 -04:00
|
|
|
func getClusterObjectDistributionMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: objectsSubsystem,
|
|
|
|
Name: sizeDistribution,
|
|
|
|
Help: "Distribution of object sizes across a cluster",
|
|
|
|
Type: histogramMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterObjectVersionsMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: objectsSubsystem,
|
|
|
|
Name: versionDistribution,
|
2023-11-03 14:43:52 -04:00
|
|
|
Help: "Distribution of object versions across a cluster",
|
2023-08-30 04:00:59 -04:00
|
|
|
Type: histogramMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterRepLinkLatencyCurrMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: currLinkLatency,
|
|
|
|
Help: "Replication current link latency in milliseconds",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterRepLinkOnlineMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: linkOnline,
|
|
|
|
Help: "Reports whether replication link is online (1) or offline(0)",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterRepLinkCurrOfflineDurationMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: linkOfflineDuration,
|
|
|
|
Help: "Duration of replication link being offline in seconds since last offline event",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterRepLinkTotalOfflineDurationMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: linkDowntimeTotalDuration,
|
|
|
|
Help: "Total downtime of replication link in seconds since server start",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-17 15:10:57 -05:00
|
|
|
func getBucketRepLatencyMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: latencyMilliSec,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Replication latency in milliseconds",
|
2021-11-17 15:10:57 -05:00
|
|
|
Type: histogramMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-30 04:00:59 -04:00
|
|
|
func getRepFailedBytesLastMinuteMD(namespace MetricNamespace) MetricDescription {
|
2021-01-18 23:35:38 -05:00
|
|
|
return MetricDescription{
|
2023-08-30 04:00:59 -04:00
|
|
|
Namespace: namespace,
|
2021-01-18 23:35:38 -05:00
|
|
|
Subsystem: replicationSubsystem,
|
2023-08-30 04:00:59 -04:00
|
|
|
Name: lastMinFailedBytes,
|
|
|
|
Help: "Total number of bytes failed at least once to replicate in the last full minute",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2023-08-30 04:00:59 -04:00
|
|
|
func getRepFailedOperationsLastMinuteMD(namespace MetricNamespace) MetricDescription {
|
2021-01-18 23:35:38 -05:00
|
|
|
return MetricDescription{
|
2023-08-30 04:00:59 -04:00
|
|
|
Namespace: namespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: lastMinFailedCount,
|
|
|
|
Help: "Total number of objects which failed replication in the last full minute",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getRepFailedBytesLastHourMD(namespace MetricNamespace) MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: namespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: lastHourFailedBytes,
|
|
|
|
Help: "Total number of bytes failed at least once to replicate in the last hour",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getRepFailedOperationsLastHourMD(namespace MetricNamespace) MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: namespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: lastHourFailedCount,
|
|
|
|
Help: "Total number of objects which failed replication in the last hour",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getRepFailedBytesTotalMD(namespace MetricNamespace) MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: namespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: totalFailedBytes,
|
|
|
|
Help: "Total number of bytes failed at least once to replicate since server start",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getRepFailedOperationsTotalMD(namespace MetricNamespace) MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: namespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: totalFailedCount,
|
|
|
|
Help: "Total number of objects which failed replication since server start",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getRepSentBytesMD(namespace MetricNamespace) MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: namespace,
|
2021-01-18 23:35:38 -05:00
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: sentBytes,
|
2023-08-30 04:00:59 -04:00
|
|
|
Help: "Total number of bytes replicated to the target",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2023-08-30 04:00:59 -04:00
|
|
|
func getRepSentOperationsMD(namespace MetricNamespace) MetricDescription {
|
2021-01-18 23:35:38 -05:00
|
|
|
return MetricDescription{
|
2023-08-30 04:00:59 -04:00
|
|
|
Namespace: namespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: sentCount,
|
|
|
|
Help: "Total number of objects replicated to the target",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getRepReceivedBytesMD(namespace MetricNamespace) MetricDescription {
|
|
|
|
helpText := "Total number of bytes replicated to this bucket from another source bucket"
|
|
|
|
if namespace == clusterMetricNamespace {
|
|
|
|
helpText = "Total number of bytes replicated to this cluster from site replication peer"
|
|
|
|
}
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: namespace,
|
2021-01-18 23:35:38 -05:00
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: receivedBytes,
|
2023-08-30 04:00:59 -04:00
|
|
|
Help: helpText,
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-05-31 23:26:52 -04:00
|
|
|
|
2023-08-30 04:00:59 -04:00
|
|
|
func getRepReceivedOperationsMD(namespace MetricNamespace) MetricDescription {
|
|
|
|
help := "Total number of objects received by this cluster"
|
|
|
|
if namespace == bucketMetricNamespace {
|
|
|
|
help = "Total number of objects received by this bucket from another source bucket"
|
|
|
|
}
|
2021-04-03 12:03:42 -04:00
|
|
|
return MetricDescription{
|
2023-08-30 04:00:59 -04:00
|
|
|
Namespace: namespace,
|
2021-04-03 12:03:42 -04:00
|
|
|
Subsystem: replicationSubsystem,
|
2023-08-30 04:00:59 -04:00
|
|
|
Name: receivedCount,
|
|
|
|
Help: help,
|
2021-04-03 12:03:42 -04:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2023-08-30 04:00:59 -04:00
|
|
|
func getClusterReplMRFFailedOperationsMD() MetricDescription {
|
2023-07-19 01:25:12 -04:00
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
2023-08-30 04:00:59 -04:00
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: recentBacklogCount,
|
|
|
|
Help: "Total number of objects seen in replication backlog in the last 5 minutes",
|
|
|
|
Type: gaugeMetric,
|
2023-07-19 01:25:12 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-30 04:00:59 -04:00
|
|
|
func getClusterRepCredentialErrorsMD(namespace MetricNamespace) MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: namespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: credentialErrors,
|
|
|
|
Help: "Total number of replication credential errors since server start",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplCurrQueuedOperationsMD() MetricDescription {
|
2023-07-19 01:25:12 -04:00
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
2023-08-30 04:00:59 -04:00
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: currInQueueCount,
|
|
|
|
Help: "Total number of objects queued for replication in the last full minute",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplCurrQueuedBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: currInQueueBytes,
|
|
|
|
Help: "Total number of bytes queued for replication in the last full minute",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplActiveWorkersCountMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: currActiveWorkers,
|
|
|
|
Help: "Total number of active replication workers",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplAvgActiveWorkersCountMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: avgActiveWorkers,
|
|
|
|
Help: "Average number of active replication workers",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplMaxActiveWorkersCountMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: maxActiveWorkers,
|
|
|
|
Help: "Maximum number of active replication workers seen since server start",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplCurrentTransferRateMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: currTransferRate,
|
|
|
|
Help: "Current replication transfer rate in bytes/sec",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterRepLinkLatencyMaxMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: maxLinkLatency,
|
|
|
|
Help: "Maximum replication link latency in milliseconds seen since server start",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterRepLinkLatencyAvgMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: avgLinkLatency,
|
|
|
|
Help: "Average replication link latency in milliseconds",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplAvgQueuedOperationsMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: avgInQueueCount,
|
|
|
|
Help: "Average number of objects queued for replication since server start",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplAvgQueuedBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: avgInQueueBytes,
|
|
|
|
Help: "Average number of bytes queued for replication since server start",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplMaxQueuedOperationsMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: maxInQueueCount,
|
|
|
|
Help: "Maximum number of objects queued for replication since server start",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplMaxQueuedBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: maxInQueueBytes,
|
|
|
|
Help: "Maximum number of bytes queued for replication since server start",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplAvgTransferRateMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: avgTransferRate,
|
|
|
|
Help: "Average replication transfer rate in bytes/sec",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplMaxTransferRateMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: maxTransferRate,
|
|
|
|
Help: "Maximum replication transfer rate in bytes/sec seen since server start",
|
|
|
|
Type: gaugeMetric,
|
2023-07-19 01:25:12 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-06 01:00:45 -05:00
|
|
|
func getClusterReplProxiedGetOperationsMD(ns MetricNamespace) MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: ns,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: proxiedGetRequestsTotal,
|
|
|
|
Help: "Number of GET requests proxied to replication target",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplProxiedHeadOperationsMD(ns MetricNamespace) MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: ns,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: proxiedHeadRequestsTotal,
|
|
|
|
Help: "Number of HEAD requests proxied to replication target",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplProxiedPutTaggingOperationsMD(ns MetricNamespace) MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: ns,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: proxiedPutTaggingRequestsTotal,
|
|
|
|
Help: "Number of PUT tagging requests proxied to replication target",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplProxiedGetTaggingOperationsMD(ns MetricNamespace) MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: ns,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: proxiedGetTaggingRequestsTotal,
|
|
|
|
Help: "Number of GET tagging requests proxied to replication target",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplProxiedRmvTaggingOperationsMD(ns MetricNamespace) MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: ns,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: proxiedDeleteTaggingRequestsTotal,
|
|
|
|
Help: "Number of DELETE tagging requests proxied to replication target",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplProxiedGetFailedOperationsMD(ns MetricNamespace) MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: ns,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: proxiedGetRequestsFailures,
|
|
|
|
Help: "Number of failures in GET requests proxied to replication target",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplProxiedHeadFailedOperationsMD(ns MetricNamespace) MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: ns,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: proxiedHeadRequestsFailures,
|
|
|
|
Help: "Number of failures in HEAD requests proxied to replication target",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplProxiedPutTaggingFailedOperationsMD(ns MetricNamespace) MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: ns,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: proxiedPutTaggingRequestFailures,
|
|
|
|
Help: "Number of failures in PUT tagging proxy requests to replication target",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplProxiedGetTaggingFailedOperationsMD(ns MetricNamespace) MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: ns,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: proxiedGetTaggingRequestFailures,
|
|
|
|
Help: "Number of failures in GET tagging proxy requests to replication target",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterReplProxiedRmvTaggingFailedOperationsMD(ns MetricNamespace) MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: ns,
|
|
|
|
Subsystem: replicationSubsystem,
|
|
|
|
Name: proxiedDeleteTaggingRequestFailures,
|
|
|
|
Help: "Number of failures in DELETE tagging proxy requests to replication target",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getBucketObjectDistributionMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: objectsSubsystem,
|
|
|
|
Name: sizeDistribution,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Distribution of object sizes in the bucket, includes label for the bucket name",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: histogramMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2023-03-10 11:53:59 -05:00
|
|
|
func getBucketObjectVersionsMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: objectsSubsystem,
|
|
|
|
Name: versionDistribution,
|
|
|
|
Help: "Distribution of object sizes in the bucket, includes label for the bucket name",
|
|
|
|
Type: histogramMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-01 15:31:33 -05:00
|
|
|
func getInternodeFailedRequests() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: interNodeMetricNamespace,
|
|
|
|
Subsystem: trafficSubsystem,
|
|
|
|
Name: errorsTotal,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Total number of failed internode calls",
|
2021-03-01 15:31:33 -05:00
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-26 12:04:26 -04:00
|
|
|
func getInternodeTCPDialTimeout() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: interNodeMetricNamespace,
|
|
|
|
Subsystem: trafficSubsystem,
|
|
|
|
Name: "dial_errors",
|
|
|
|
Help: "Total number of internode TCP dial timeouts and errors",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getInternodeTCPAvgDuration() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: interNodeMetricNamespace,
|
|
|
|
Subsystem: trafficSubsystem,
|
|
|
|
Name: "dial_avg_time",
|
|
|
|
Help: "Average time of internodes TCP dial calls",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getInterNodeSentBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: interNodeMetricNamespace,
|
|
|
|
Subsystem: trafficSubsystem,
|
|
|
|
Name: sentBytes,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Total number of bytes sent to the other peer nodes",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getInterNodeReceivedBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: interNodeMetricNamespace,
|
|
|
|
Subsystem: trafficSubsystem,
|
|
|
|
Name: receivedBytes,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Total number of bytes received from other peer nodes",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getS3SentBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: s3MetricNamespace,
|
|
|
|
Subsystem: trafficSubsystem,
|
|
|
|
Name: sentBytes,
|
|
|
|
Help: "Total number of s3 bytes sent",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getS3ReceivedBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: s3MetricNamespace,
|
|
|
|
Subsystem: trafficSubsystem,
|
|
|
|
Name: receivedBytes,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Total number of s3 bytes received",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getS3RequestsInFlightMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: s3MetricNamespace,
|
|
|
|
Subsystem: requestsSubsystem,
|
|
|
|
Name: inflightTotal,
|
2021-02-20 03:21:55 -05:00
|
|
|
Help: "Total number of S3 requests currently in flight",
|
2021-02-04 15:26:58 -05:00
|
|
|
Type: gaugeMetric,
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-02-20 03:21:55 -05:00
|
|
|
func getS3RequestsInQueueMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: s3MetricNamespace,
|
|
|
|
Subsystem: requestsSubsystem,
|
|
|
|
Name: waitingTotal,
|
2023-06-21 12:41:59 -04:00
|
|
|
Help: "Total number of S3 requests in the waiting queue",
|
2021-03-24 12:06:37 -04:00
|
|
|
Type: gaugeMetric,
|
2021-02-20 03:21:55 -05:00
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2022-02-07 19:30:14 -05:00
|
|
|
func getIncomingS3RequestsMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: s3MetricNamespace,
|
|
|
|
Subsystem: requestsSubsystem,
|
|
|
|
Name: incomingTotal,
|
2023-06-21 12:41:59 -04:00
|
|
|
Help: "Total number of incoming S3 requests",
|
2022-02-07 19:30:14 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getS3RequestsTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: s3MetricNamespace,
|
|
|
|
Subsystem: requestsSubsystem,
|
|
|
|
Name: total,
|
2023-06-21 12:41:59 -04:00
|
|
|
Help: "Total number of S3 requests",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getS3RequestsErrorsMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: s3MetricNamespace,
|
|
|
|
Subsystem: requestsSubsystem,
|
|
|
|
Name: errorsTotal,
|
2023-06-21 12:41:59 -04:00
|
|
|
Help: "Total number of S3 requests with (4xx and 5xx) errors",
|
2022-06-08 14:22:34 -04:00
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getS3Requests4xxErrorsMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: s3MetricNamespace,
|
|
|
|
Subsystem: requestsSubsystem,
|
|
|
|
Name: "4xx_" + errorsTotal,
|
2023-06-21 12:41:59 -04:00
|
|
|
Help: "Total number of S3 requests with (4xx) errors",
|
2022-06-08 14:22:34 -04:00
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getS3Requests5xxErrorsMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: s3MetricNamespace,
|
|
|
|
Subsystem: requestsSubsystem,
|
|
|
|
Name: "5xx_" + errorsTotal,
|
2023-06-21 12:41:59 -04:00
|
|
|
Help: "Total number of S3 requests with (5xx) errors",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-03-24 13:25:27 -04:00
|
|
|
func getS3RequestsCanceledMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: s3MetricNamespace,
|
|
|
|
Subsystem: requestsSubsystem,
|
|
|
|
Name: canceledTotal,
|
2023-06-21 12:41:59 -04:00
|
|
|
Help: "Total number of S3 requests that were canceled by the client",
|
2021-03-24 13:25:27 -04:00
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-03-31 02:19:36 -04:00
|
|
|
func getS3RejectedAuthRequestsTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: s3MetricNamespace,
|
|
|
|
Subsystem: requestsRejectedSubsystem,
|
|
|
|
Name: authTotal,
|
2023-06-21 12:41:59 -04:00
|
|
|
Help: "Total number of S3 requests rejected for auth failure",
|
2021-03-31 02:19:36 -04:00
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-03-31 02:19:36 -04:00
|
|
|
func getS3RejectedHeaderRequestsTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: s3MetricNamespace,
|
|
|
|
Subsystem: requestsRejectedSubsystem,
|
|
|
|
Name: headerTotal,
|
2023-06-21 12:41:59 -04:00
|
|
|
Help: "Total number of S3 requests rejected for invalid header",
|
2021-03-31 02:19:36 -04:00
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-03-31 02:19:36 -04:00
|
|
|
func getS3RejectedTimestampRequestsTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: s3MetricNamespace,
|
|
|
|
Subsystem: requestsRejectedSubsystem,
|
|
|
|
Name: timestampTotal,
|
2023-06-21 12:41:59 -04:00
|
|
|
Help: "Total number of S3 requests rejected for invalid timestamp",
|
2021-03-31 02:19:36 -04:00
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-03-31 02:19:36 -04:00
|
|
|
func getS3RejectedInvalidRequestsTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: s3MetricNamespace,
|
|
|
|
Subsystem: requestsRejectedSubsystem,
|
|
|
|
Name: invalidTotal,
|
2023-06-21 12:41:59 -04:00
|
|
|
Help: "Total number of invalid S3 requests",
|
2021-03-31 02:19:36 -04:00
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getHealObjectsTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: healMetricNamespace,
|
|
|
|
Subsystem: objectsSubsystem,
|
|
|
|
Name: total,
|
|
|
|
Help: "Objects scanned in current self healing run",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getHealObjectsHealTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: healMetricNamespace,
|
|
|
|
Subsystem: objectsSubsystem,
|
|
|
|
Name: healTotal,
|
|
|
|
Help: "Objects healed in current self healing run",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-03-24 13:25:27 -04:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getHealObjectsFailTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: healMetricNamespace,
|
|
|
|
Subsystem: objectsSubsystem,
|
|
|
|
Name: errorsTotal,
|
|
|
|
Help: "Objects for which healing failed in current self healing run",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getHealLastActivityTimeMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: healMetricNamespace,
|
|
|
|
Subsystem: timeSubsystem,
|
|
|
|
Name: lastActivityTime,
|
2023-06-21 12:41:59 -04:00
|
|
|
Help: "Time elapsed (in nano seconds) since last self healing activity.",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getNodeOnlineTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: nodesSubsystem,
|
|
|
|
Name: onlineTotal,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Total number of MinIO nodes online",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getNodeOfflineTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: nodesSubsystem,
|
|
|
|
Name: offlineTotal,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Total number of MinIO nodes offline",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getMinIOVersionMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
2021-04-03 12:03:42 -04:00
|
|
|
Namespace: minioMetricNamespace,
|
2021-01-18 23:35:38 -05:00
|
|
|
Subsystem: softwareSubsystem,
|
|
|
|
Name: versionInfo,
|
|
|
|
Help: "MinIO Release tag for the server",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getMinIOCommitMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
2021-04-03 12:03:42 -04:00
|
|
|
Namespace: minioMetricNamespace,
|
2021-01-18 23:35:38 -05:00
|
|
|
Subsystem: softwareSubsystem,
|
|
|
|
Name: commitInfo,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Git commit hash for the MinIO release",
|
2021-01-18 23:35:38 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func getS3TTFBDistributionMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: s3MetricNamespace,
|
2023-07-19 01:25:12 -04:00
|
|
|
Subsystem: ttfbSubsystem,
|
2021-01-18 23:35:38 -05:00
|
|
|
Name: ttfbDistribution,
|
2023-07-19 01:25:12 -04:00
|
|
|
Help: "Distribution of time to first byte across API calls",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getBucketTTFBDistributionMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: ttfbSubsystem,
|
|
|
|
Name: ttfbDistribution,
|
|
|
|
Help: "Distribution of time to first byte across API calls per bucket",
|
2023-07-07 16:57:37 -04:00
|
|
|
Type: gaugeMetric,
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-22 21:30:16 -05:00
|
|
|
func getMinioFDOpenMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: fileDescriptorSubsystem,
|
|
|
|
Name: openTotal,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Total number of open file descriptors by the MinIO Server process",
|
2021-01-22 21:30:16 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-22 21:30:16 -05:00
|
|
|
func getMinioFDLimitMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: fileDescriptorSubsystem,
|
|
|
|
Name: limitTotal,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Limit on total number of open file descriptors for the MinIO Server process",
|
2021-01-22 21:30:16 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-22 21:30:16 -05:00
|
|
|
func getMinioProcessIOWriteBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: ioSubsystem,
|
|
|
|
Name: writeBytes,
|
|
|
|
Help: "Total bytes written by the process to the underlying storage system, /proc/[pid]/io write_bytes",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-22 21:30:16 -05:00
|
|
|
func getMinioProcessIOReadBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: ioSubsystem,
|
|
|
|
Name: readBytes,
|
|
|
|
Help: "Total bytes read by the process from the underlying storage system, /proc/[pid]/io read_bytes",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-22 21:30:16 -05:00
|
|
|
func getMinioProcessIOWriteCachedBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: ioSubsystem,
|
|
|
|
Name: wcharBytes,
|
|
|
|
Help: "Total bytes written by the process to the underlying storage system including page cache, /proc/[pid]/io wchar",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-22 21:30:16 -05:00
|
|
|
func getMinioProcessIOReadCachedBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: ioSubsystem,
|
|
|
|
Name: rcharBytes,
|
|
|
|
Help: "Total bytes read by the process from the underlying storage system including cache, /proc/[pid]/io rchar",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-22 21:30:16 -05:00
|
|
|
func getMinIOProcessSysCallRMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: sysCallSubsystem,
|
|
|
|
Name: readTotal,
|
|
|
|
Help: "Total read SysCalls to the kernel. /proc/[pid]/io syscr",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-22 21:30:16 -05:00
|
|
|
func getMinIOProcessSysCallWMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: sysCallSubsystem,
|
|
|
|
Name: writeTotal,
|
|
|
|
Help: "Total write SysCalls to the kernel. /proc/[pid]/io syscw",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-22 21:30:16 -05:00
|
|
|
func getMinIOGORoutineCountMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: goRoutines,
|
|
|
|
Name: total,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Total number of go routines running",
|
2021-01-22 21:30:16 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-02-02 02:02:18 -05:00
|
|
|
func getMinIOProcessStartTimeMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: processSubsystem,
|
|
|
|
Name: startTime,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Start time for MinIO process per node, time in seconds since Unix epoc",
|
2021-03-21 00:23:27 -04:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-03-21 00:23:27 -04:00
|
|
|
func getMinIOProcessUptimeMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: processSubsystem,
|
|
|
|
Name: upTime,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Uptime for MinIO process per node in seconds",
|
2021-02-02 02:02:18 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-05-04 13:17:10 -04:00
|
|
|
func getMinIOProcessResidentMemory() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: processSubsystem,
|
|
|
|
Name: memory,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Resident memory size in bytes",
|
2021-05-04 13:17:10 -04:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2024-01-19 17:51:36 -05:00
|
|
|
func getMinIOProcessVirtualMemory() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: processSubsystem,
|
|
|
|
Name: memory,
|
|
|
|
Help: "Virtual memory size in bytes",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-04 13:17:10 -04:00
|
|
|
func getMinIOProcessCPUTime() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: processSubsystem,
|
|
|
|
Name: cpu,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Total user and system CPU time spent in seconds",
|
2021-05-04 13:17:10 -04:00
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
2021-01-18 23:35:38 -05:00
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getMinioProcMetrics() *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2022-12-26 11:35:32 -05:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) (metrics []MetricV2) {
|
2021-12-17 13:11:04 -05:00
|
|
|
if runtime.GOOS == "windows" {
|
|
|
|
return nil
|
|
|
|
}
|
2023-08-07 05:21:22 -04:00
|
|
|
|
2021-12-17 13:11:04 -05:00
|
|
|
p, err := procfs.Self()
|
|
|
|
if err != nil {
|
2024-04-04 08:04:40 -04:00
|
|
|
internalLogOnceIf(ctx, err, string(nodeMetricNamespace))
|
2021-03-19 03:04:29 -04:00
|
|
|
return
|
2021-12-17 13:11:04 -05:00
|
|
|
}
|
2022-02-03 12:45:12 -05:00
|
|
|
|
|
|
|
openFDs, _ := p.FileDescriptorsLen()
|
|
|
|
l, _ := p.Limits()
|
|
|
|
io, _ := p.IO()
|
|
|
|
stat, _ := p.Stat()
|
|
|
|
startTime, _ := stat.StartTime()
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = make([]MetricV2, 0, 20)
|
2023-08-07 05:21:22 -04:00
|
|
|
|
2022-02-03 12:45:12 -05:00
|
|
|
if openFDs > 0 {
|
|
|
|
metrics = append(metrics,
|
2024-03-10 05:15:15 -04:00
|
|
|
MetricV2{
|
2022-02-03 12:45:12 -05:00
|
|
|
Description: getMinioFDOpenMD(),
|
|
|
|
Value: float64(openFDs),
|
|
|
|
},
|
|
|
|
)
|
2021-12-17 13:11:04 -05:00
|
|
|
}
|
2022-02-03 12:45:12 -05:00
|
|
|
|
|
|
|
if l.OpenFiles > 0 {
|
|
|
|
metrics = append(metrics,
|
2024-03-10 05:15:15 -04:00
|
|
|
MetricV2{
|
2022-02-03 12:45:12 -05:00
|
|
|
Description: getMinioFDLimitMD(),
|
|
|
|
Value: float64(l.OpenFiles),
|
|
|
|
})
|
2021-12-17 13:11:04 -05:00
|
|
|
}
|
2022-02-03 12:45:12 -05:00
|
|
|
|
|
|
|
if io.SyscR > 0 {
|
|
|
|
metrics = append(metrics,
|
2024-03-10 05:15:15 -04:00
|
|
|
MetricV2{
|
2022-02-03 12:45:12 -05:00
|
|
|
Description: getMinIOProcessSysCallRMD(),
|
|
|
|
Value: float64(io.SyscR),
|
|
|
|
})
|
2021-12-17 13:11:04 -05:00
|
|
|
}
|
2022-02-03 12:45:12 -05:00
|
|
|
|
|
|
|
if io.SyscW > 0 {
|
|
|
|
metrics = append(metrics,
|
2024-03-10 05:15:15 -04:00
|
|
|
MetricV2{
|
2022-02-03 12:45:12 -05:00
|
|
|
Description: getMinIOProcessSysCallWMD(),
|
|
|
|
Value: float64(io.SyscW),
|
|
|
|
})
|
2021-12-17 13:11:04 -05:00
|
|
|
}
|
2022-02-03 12:45:12 -05:00
|
|
|
|
|
|
|
if io.ReadBytes > 0 {
|
|
|
|
metrics = append(metrics,
|
2024-03-10 05:15:15 -04:00
|
|
|
MetricV2{
|
2022-02-03 12:45:12 -05:00
|
|
|
Description: getMinioProcessIOReadBytesMD(),
|
|
|
|
Value: float64(io.ReadBytes),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
if io.WriteBytes > 0 {
|
|
|
|
metrics = append(metrics,
|
2024-03-10 05:15:15 -04:00
|
|
|
MetricV2{
|
2022-02-03 12:45:12 -05:00
|
|
|
Description: getMinioProcessIOWriteBytesMD(),
|
|
|
|
Value: float64(io.WriteBytes),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
if io.RChar > 0 {
|
|
|
|
metrics = append(metrics,
|
2024-03-10 05:15:15 -04:00
|
|
|
MetricV2{
|
2022-02-03 12:45:12 -05:00
|
|
|
Description: getMinioProcessIOReadCachedBytesMD(),
|
|
|
|
Value: float64(io.RChar),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
if io.WChar > 0 {
|
|
|
|
metrics = append(metrics,
|
2024-03-10 05:15:15 -04:00
|
|
|
MetricV2{
|
2022-02-03 12:45:12 -05:00
|
|
|
Description: getMinioProcessIOWriteCachedBytesMD(),
|
|
|
|
Value: float64(io.WChar),
|
|
|
|
})
|
2021-12-17 13:11:04 -05:00
|
|
|
}
|
|
|
|
|
2022-02-03 12:45:12 -05:00
|
|
|
if startTime > 0 {
|
|
|
|
metrics = append(metrics,
|
2024-03-10 05:15:15 -04:00
|
|
|
MetricV2{
|
2022-02-03 12:45:12 -05:00
|
|
|
Description: getMinIOProcessStartTimeMD(),
|
|
|
|
Value: startTime,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
if !globalBootTime.IsZero() {
|
|
|
|
metrics = append(metrics,
|
2024-03-10 05:15:15 -04:00
|
|
|
MetricV2{
|
2022-02-03 12:45:12 -05:00
|
|
|
Description: getMinIOProcessUptimeMD(),
|
|
|
|
Value: time.Since(globalBootTime).Seconds(),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
if stat.ResidentMemory() > 0 {
|
|
|
|
metrics = append(metrics,
|
2024-03-10 05:15:15 -04:00
|
|
|
MetricV2{
|
2022-02-03 12:45:12 -05:00
|
|
|
Description: getMinIOProcessResidentMemory(),
|
|
|
|
Value: float64(stat.ResidentMemory()),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-01-19 17:51:36 -05:00
|
|
|
if stat.VirtualMemory() > 0 {
|
|
|
|
metrics = append(metrics,
|
2024-03-10 05:15:15 -04:00
|
|
|
MetricV2{
|
2024-01-19 17:51:36 -05:00
|
|
|
Description: getMinIOProcessVirtualMemory(),
|
|
|
|
Value: float64(stat.VirtualMemory()),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-02-03 12:45:12 -05:00
|
|
|
if stat.CPUTime() > 0 {
|
|
|
|
metrics = append(metrics,
|
2024-03-10 05:15:15 -04:00
|
|
|
MetricV2{
|
2022-02-03 12:45:12 -05:00
|
|
|
Description: getMinIOProcessCPUTime(),
|
|
|
|
Value: stat.CPUTime(),
|
|
|
|
})
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
return
|
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getGoMetrics() *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2022-12-26 11:35:32 -05:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) (metrics []MetricV2) {
|
|
|
|
metrics = append(metrics, MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getMinIOGORoutineCountMD(),
|
|
|
|
Value: float64(runtime.NumGoroutine()),
|
|
|
|
})
|
|
|
|
return
|
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2023-12-14 17:02:52 -05:00
|
|
|
// getHistogramMetrics fetches histogram metrics and returns it in a []Metric
|
|
|
|
// Note: Typically used in MetricGroup.RegisterRead
|
2024-03-04 13:05:56 -05:00
|
|
|
//
|
|
|
|
// The last parameter is added for compatibility - if true it lowercases the
|
|
|
|
// `api` label values.
|
2024-03-10 05:15:15 -04:00
|
|
|
func getHistogramMetrics(hist *prometheus.HistogramVec, desc MetricDescription, toLowerAPILabels bool) []MetricV2 {
|
2023-12-14 17:02:52 -05:00
|
|
|
ch := make(chan prometheus.Metric)
|
|
|
|
go func() {
|
2024-01-28 13:04:17 -05:00
|
|
|
defer xioutil.SafeClose(ch)
|
2023-12-14 17:02:52 -05:00
|
|
|
// Collects prometheus metrics from hist and sends it over ch
|
|
|
|
hist.Collect(ch)
|
|
|
|
}()
|
|
|
|
|
|
|
|
// Converts metrics received into internal []Metric type
|
2024-03-10 05:15:15 -04:00
|
|
|
var metrics []MetricV2
|
2023-12-14 17:02:52 -05:00
|
|
|
for promMetric := range ch {
|
|
|
|
dtoMetric := &dto.Metric{}
|
|
|
|
err := promMetric.Write(dtoMetric)
|
|
|
|
if err != nil {
|
|
|
|
// Log error and continue to receive other metric
|
|
|
|
// values
|
2024-04-04 08:04:40 -04:00
|
|
|
bugLogIf(GlobalContext, err)
|
2023-12-14 17:02:52 -05:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
h := dtoMetric.GetHistogram()
|
|
|
|
for _, b := range h.Bucket {
|
|
|
|
labels := make(map[string]string)
|
|
|
|
for _, lp := range dtoMetric.GetLabel() {
|
2024-03-04 13:05:56 -05:00
|
|
|
if *lp.Name == "api" && toLowerAPILabels {
|
|
|
|
labels[*lp.Name] = strings.ToLower(*lp.Value)
|
|
|
|
} else {
|
|
|
|
labels[*lp.Name] = *lp.Value
|
|
|
|
}
|
2023-12-14 17:02:52 -05:00
|
|
|
}
|
|
|
|
labels["le"] = fmt.Sprintf("%.3f", *b.UpperBound)
|
2024-03-10 05:15:15 -04:00
|
|
|
metric := MetricV2{
|
2023-12-14 17:02:52 -05:00
|
|
|
Description: desc,
|
|
|
|
VariableLabels: labels,
|
|
|
|
Value: float64(b.GetCumulativeCount()),
|
|
|
|
}
|
|
|
|
metrics = append(metrics, metric)
|
|
|
|
}
|
2024-01-18 17:51:28 -05:00
|
|
|
// add metrics with +Inf label
|
|
|
|
labels1 := make(map[string]string)
|
|
|
|
for _, lp := range dtoMetric.GetLabel() {
|
|
|
|
labels1[*lp.Name] = *lp.Value
|
|
|
|
}
|
|
|
|
labels1["le"] = fmt.Sprintf("%.3f", math.Inf(+1))
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2024-01-18 17:51:28 -05:00
|
|
|
Description: desc,
|
|
|
|
VariableLabels: labels1,
|
|
|
|
Value: dtoMetric.Counter.GetValue(),
|
|
|
|
})
|
2023-12-14 17:02:52 -05:00
|
|
|
}
|
|
|
|
return metrics
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getBucketTTFBMetric() *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) []MetricV2 {
|
2024-03-04 13:05:56 -05:00
|
|
|
return getHistogramMetrics(bucketHTTPRequestsDuration,
|
|
|
|
getBucketTTFBDistributionMD(), true)
|
2023-07-19 01:25:12 -04:00
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getS3TTFBMetric() *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2022-12-26 11:35:32 -05:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) []MetricV2 {
|
2024-03-04 13:05:56 -05:00
|
|
|
return getHistogramMetrics(httpRequestsDuration,
|
|
|
|
getS3TTFBDistributionMD(), true)
|
2021-12-17 13:11:04 -05:00
|
|
|
})
|
|
|
|
return mg
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getTierMetrics() *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2023-12-20 23:13:40 -05:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) []MetricV2 {
|
2023-12-20 23:13:40 -05:00
|
|
|
return globalTierMetrics.Report()
|
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2021-08-17 13:21:19 -04:00
|
|
|
func getTransitionPendingTasksMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: ilmSubsystem,
|
|
|
|
Name: transitionPendingTasks,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Number of pending ILM transition tasks in the queue",
|
2021-08-17 13:21:19 -04:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getTransitionActiveTasksMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: ilmSubsystem,
|
|
|
|
Name: transitionActiveTasks,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Number of active ILM transition tasks",
|
2021-08-17 13:21:19 -04:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-02 16:02:12 -05:00
|
|
|
func getTransitionMissedTasksMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: ilmSubsystem,
|
|
|
|
Name: transitionMissedTasks,
|
|
|
|
Help: "Number of missed immediate ILM transition tasks",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-17 13:21:19 -04:00
|
|
|
func getExpiryPendingTasksMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: ilmSubsystem,
|
|
|
|
Name: expiryPendingTasks,
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Number of pending ILM expiry tasks in the queue",
|
2021-08-17 13:21:19 -04:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-21 12:41:59 -04:00
|
|
|
func getBucketS3RequestsInFlightMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: requestsSubsystem,
|
|
|
|
Name: inflightTotal,
|
|
|
|
Help: "Total number of S3 requests currently in flight on a bucket",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getBucketS3RequestsTotalMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: requestsSubsystem,
|
|
|
|
Name: total,
|
|
|
|
Help: "Total number of S3 requests on a bucket",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getBucketS3Requests4xxErrorsMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: requestsSubsystem,
|
|
|
|
Name: "4xx_" + errorsTotal,
|
|
|
|
Help: "Total number of S3 requests with (4xx) errors on a bucket",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getBucketS3Requests5xxErrorsMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: requestsSubsystem,
|
|
|
|
Name: "5xx_" + errorsTotal,
|
|
|
|
Help: "Total number of S3 requests with (5xx) errors on a bucket",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getBucketS3RequestsCanceledMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: requestsSubsystem,
|
|
|
|
Name: canceledTotal,
|
|
|
|
Help: "Total number of S3 requests that were canceled from the client while processing on a bucket",
|
|
|
|
Type: counterMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getILMNodeMetrics() *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2022-12-26 11:35:32 -05:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(_ context.Context) []MetricV2 {
|
|
|
|
expPendingTasks := MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getExpiryPendingTasksMD(),
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
expMissedTasks := MetricV2{
|
2024-03-02 00:11:03 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: ilmSubsystem,
|
|
|
|
Name: expiryMissedTasks,
|
|
|
|
Help: "Number of object version expiry missed due to busy system",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
expMissedFreeVersions := MetricV2{
|
2024-03-02 00:11:03 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: ilmSubsystem,
|
|
|
|
Name: expiryMissedFreeVersions,
|
|
|
|
Help: "Number of free versions expiry missed due to busy system",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
expMissedTierJournalTasks := MetricV2{
|
2024-03-02 00:11:03 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: ilmSubsystem,
|
|
|
|
Name: expiryMissedTierJournalTasks,
|
|
|
|
Help: "Number of tier journal entries cleanup missed due to busy system",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
expNumWorkers := MetricV2{
|
2024-03-02 00:11:03 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: ilmSubsystem,
|
|
|
|
Name: expiryNumWorkers,
|
|
|
|
Help: "Number of workers expiring object versions currently",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
},
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
trPendingTasks := MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getTransitionPendingTasksMD(),
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
trActiveTasks := MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getTransitionActiveTasksMD(),
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
trMissedTasks := MetricV2{
|
2023-12-02 16:02:12 -05:00
|
|
|
Description: getTransitionMissedTasksMD(),
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
if globalExpiryState != nil {
|
|
|
|
expPendingTasks.Value = float64(globalExpiryState.PendingTasks())
|
2024-03-02 00:11:03 -05:00
|
|
|
expMissedTasks.Value = float64(globalExpiryState.stats.MissedTasks())
|
|
|
|
expMissedFreeVersions.Value = float64(globalExpiryState.stats.MissedFreeVersTasks())
|
|
|
|
expMissedTierJournalTasks.Value = float64(globalExpiryState.stats.MissedTierJournalTasks())
|
|
|
|
expNumWorkers.Value = float64(globalExpiryState.stats.NumWorkers())
|
2021-12-17 13:11:04 -05:00
|
|
|
}
|
|
|
|
if globalTransitionState != nil {
|
|
|
|
trPendingTasks.Value = float64(globalTransitionState.PendingTasks())
|
|
|
|
trActiveTasks.Value = float64(globalTransitionState.ActiveTasks())
|
2023-12-02 16:02:12 -05:00
|
|
|
trMissedTasks.Value = float64(globalTransitionState.MissedImmediateTasks())
|
2021-12-17 13:11:04 -05:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
return []MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
expPendingTasks,
|
2024-03-02 00:11:03 -05:00
|
|
|
expMissedTasks,
|
|
|
|
expMissedFreeVersions,
|
|
|
|
expMissedTierJournalTasks,
|
|
|
|
expNumWorkers,
|
2021-12-17 13:11:04 -05:00
|
|
|
trPendingTasks,
|
|
|
|
trActiveTasks,
|
2023-12-02 16:02:12 -05:00
|
|
|
trMissedTasks,
|
2021-12-17 13:11:04 -05:00
|
|
|
}
|
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getScannerNodeMetrics() *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2022-12-26 11:35:32 -05:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(_ context.Context) []MetricV2 {
|
|
|
|
metrics := []MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
{
|
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: scannerSubsystem,
|
|
|
|
Name: "objects_scanned",
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Total number of unique objects scanned since server start",
|
2021-12-17 13:11:04 -05:00
|
|
|
Type: counterMetric,
|
2021-10-02 12:31:05 -04:00
|
|
|
},
|
2022-07-05 17:45:49 -04:00
|
|
|
Value: float64(globalScannerMetrics.lifetime(scannerMetricScanObject)),
|
2021-12-17 13:11:04 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: scannerSubsystem,
|
|
|
|
Name: "versions_scanned",
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Total number of object versions scanned since server start",
|
2021-12-17 13:11:04 -05:00
|
|
|
Type: counterMetric,
|
2021-10-02 12:31:05 -04:00
|
|
|
},
|
2022-07-05 17:45:49 -04:00
|
|
|
Value: float64(globalScannerMetrics.lifetime(scannerMetricApplyVersion)),
|
2021-12-17 13:11:04 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: scannerSubsystem,
|
|
|
|
Name: "directories_scanned",
|
2022-06-14 18:14:24 -04:00
|
|
|
Help: "Total number of directories scanned since server start",
|
2021-12-17 13:11:04 -05:00
|
|
|
Type: counterMetric,
|
2021-10-02 12:31:05 -04:00
|
|
|
},
|
2022-07-05 17:45:49 -04:00
|
|
|
Value: float64(globalScannerMetrics.lifetime(scannerMetricScanFolder)),
|
2021-12-17 13:11:04 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: scannerSubsystem,
|
|
|
|
Name: "bucket_scans_started",
|
|
|
|
Help: "Total number of bucket scans started since server start",
|
|
|
|
Type: counterMetric,
|
2021-10-02 12:31:05 -04:00
|
|
|
},
|
2022-12-01 17:31:35 -05:00
|
|
|
Value: float64(globalScannerMetrics.lifetime(scannerMetricScanBucketDrive) + uint64(globalScannerMetrics.activeDrives())),
|
2021-12-17 13:11:04 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: scannerSubsystem,
|
|
|
|
Name: "bucket_scans_finished",
|
|
|
|
Help: "Total number of bucket scans finished since server start",
|
|
|
|
Type: counterMetric,
|
2021-10-02 12:31:05 -04:00
|
|
|
},
|
2022-12-01 17:31:35 -05:00
|
|
|
Value: float64(globalScannerMetrics.lifetime(scannerMetricScanBucketDrive)),
|
2021-12-17 13:11:04 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: ilmSubsystem,
|
|
|
|
Name: "versions_scanned",
|
|
|
|
Help: "Total number of object versions checked for ilm actions since server start",
|
|
|
|
Type: counterMetric,
|
2021-10-02 12:31:05 -04:00
|
|
|
},
|
2022-07-05 17:45:49 -04:00
|
|
|
Value: float64(globalScannerMetrics.lifetime(scannerMetricILM)),
|
2021-12-17 13:11:04 -05:00
|
|
|
},
|
|
|
|
}
|
2022-07-05 17:45:49 -04:00
|
|
|
for i := range globalScannerMetrics.actions {
|
2021-12-17 13:11:04 -05:00
|
|
|
action := lifecycle.Action(i)
|
2022-07-05 17:45:49 -04:00
|
|
|
v := globalScannerMetrics.lifetimeActions(action)
|
2021-12-17 13:11:04 -05:00
|
|
|
if v == 0 {
|
|
|
|
continue
|
2021-10-02 12:31:05 -04:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: ilmSubsystem,
|
|
|
|
Name: MetricName("action_count_" + toSnake(action.String())),
|
|
|
|
Help: "Total action outcome of lifecycle checks since server start",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
Value: float64(v),
|
2021-01-18 23:35:38 -05:00
|
|
|
})
|
2021-12-17 13:11:04 -05:00
|
|
|
}
|
|
|
|
return metrics
|
|
|
|
})
|
|
|
|
return mg
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getIAMNodeMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
metricsGroupOpts: opts,
|
2022-12-26 11:35:32 -05:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(_ context.Context) (metrics []MetricV2) {
|
2022-04-03 16:08:59 -04:00
|
|
|
lastSyncTime := atomic.LoadUint64(&globalIAMSys.LastRefreshTimeUnixNano)
|
|
|
|
var sinceLastSyncMillis uint64
|
|
|
|
if lastSyncTime != 0 {
|
|
|
|
sinceLastSyncMillis = (uint64(time.Now().UnixNano()) - lastSyncTime) / uint64(time.Millisecond)
|
|
|
|
}
|
|
|
|
|
2023-02-27 12:55:18 -05:00
|
|
|
pluginAuthNMetrics := globalAuthNPlugin.Metrics()
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = []MetricV2{
|
2022-04-03 16:08:59 -04:00
|
|
|
{
|
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: iamSubsystem,
|
|
|
|
Name: "last_sync_duration_millis",
|
|
|
|
Help: "Last successful IAM data sync duration in milliseconds",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
},
|
|
|
|
Value: float64(atomic.LoadUint64(&globalIAMSys.LastRefreshDurationMilliseconds)),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: iamSubsystem,
|
|
|
|
Name: "since_last_sync_millis",
|
2023-06-21 12:41:59 -04:00
|
|
|
Help: "Time (in milliseconds) since last successful IAM data sync.",
|
2022-04-03 16:08:59 -04:00
|
|
|
Type: gaugeMetric,
|
|
|
|
},
|
|
|
|
Value: float64(sinceLastSyncMillis),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: iamSubsystem,
|
|
|
|
Name: "sync_successes",
|
|
|
|
Help: "Number of successful IAM data syncs since server start.",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
Value: float64(atomic.LoadUint64(&globalIAMSys.TotalRefreshSuccesses)),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: iamSubsystem,
|
|
|
|
Name: "sync_failures",
|
|
|
|
Help: "Number of failed IAM data syncs since server start.",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
Value: float64(atomic.LoadUint64(&globalIAMSys.TotalRefreshFailures)),
|
|
|
|
},
|
2023-02-27 12:55:18 -05:00
|
|
|
{
|
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: iamSubsystem,
|
|
|
|
Name: "plugin_authn_service_last_succ_seconds",
|
|
|
|
Help: "When plugin authentication is configured, returns time (in seconds) since the last successful request to the service",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
},
|
|
|
|
Value: pluginAuthNMetrics.LastReachableSecs,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: iamSubsystem,
|
|
|
|
Name: "plugin_authn_service_last_fail_seconds",
|
|
|
|
Help: "When plugin authentication is configured, returns time (in seconds) since the last failed request to the service",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
},
|
|
|
|
Value: pluginAuthNMetrics.LastUnreachableSecs,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: iamSubsystem,
|
|
|
|
Name: "plugin_authn_service_total_requests_minute",
|
|
|
|
Help: "When plugin authentication is configured, returns total requests count in the last full minute",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
},
|
|
|
|
Value: float64(pluginAuthNMetrics.TotalRequests),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: iamSubsystem,
|
|
|
|
Name: "plugin_authn_service_failed_requests_minute",
|
|
|
|
Help: "When plugin authentication is configured, returns failed requests count in the last full minute",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
},
|
|
|
|
Value: float64(pluginAuthNMetrics.FailedRequests),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: iamSubsystem,
|
|
|
|
Name: "plugin_authn_service_succ_avg_rtt_ms_minute",
|
|
|
|
Help: "When plugin authentication is configured, returns average round-trip-time of successful requests in the last full minute",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
},
|
|
|
|
Value: pluginAuthNMetrics.AvgSuccRTTMs,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: nodeMetricNamespace,
|
|
|
|
Subsystem: iamSubsystem,
|
|
|
|
Name: "plugin_authn_service_succ_max_rtt_ms_minute",
|
|
|
|
Help: "When plugin authentication is configured, returns maximum round-trip-time of successful requests in the last full minute",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
},
|
|
|
|
Value: pluginAuthNMetrics.MaxSuccRTTMs,
|
|
|
|
},
|
2022-04-03 16:08:59 -04:00
|
|
|
}
|
2023-02-27 12:55:18 -05:00
|
|
|
|
2022-04-03 16:08:59 -04:00
|
|
|
return metrics
|
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2023-08-30 04:00:59 -04:00
|
|
|
// replication metrics for each node - published to the cluster endpoint with nodename as label
|
2024-03-10 05:15:15 -04:00
|
|
|
func getReplicationNodeMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval: 1 * time.Minute,
|
|
|
|
metricsGroupOpts: opts,
|
2023-08-30 04:00:59 -04:00
|
|
|
}
|
|
|
|
const (
|
|
|
|
Online = 1
|
|
|
|
Offline = 0
|
|
|
|
)
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(_ context.Context) []MetricV2 {
|
|
|
|
var ml []MetricV2
|
2023-08-30 04:00:59 -04:00
|
|
|
// common operational metrics for bucket replication and site replication - published
|
|
|
|
// at cluster level
|
2023-09-05 13:26:18 -04:00
|
|
|
if globalReplicationStats != nil {
|
|
|
|
qs := globalReplicationStats.getNodeQueueStatsSummary()
|
2024-03-10 05:15:15 -04:00
|
|
|
activeWorkersCount := MetricV2{
|
2024-01-29 15:32:44 -05:00
|
|
|
Description: getClusterReplActiveWorkersCountMD(),
|
2023-09-05 13:26:18 -04:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
avgActiveWorkersCount := MetricV2{
|
2024-01-29 15:32:44 -05:00
|
|
|
Description: getClusterReplAvgActiveWorkersCountMD(),
|
2023-09-05 13:26:18 -04:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
maxActiveWorkersCount := MetricV2{
|
2024-01-29 15:32:44 -05:00
|
|
|
Description: getClusterReplMaxActiveWorkersCountMD(),
|
2023-09-05 13:26:18 -04:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
currInQueueCount := MetricV2{
|
2024-01-29 15:32:44 -05:00
|
|
|
Description: getClusterReplCurrQueuedOperationsMD(),
|
2023-09-05 13:26:18 -04:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
currInQueueBytes := MetricV2{
|
2024-01-29 15:32:44 -05:00
|
|
|
Description: getClusterReplCurrQueuedBytesMD(),
|
2023-09-05 13:26:18 -04:00
|
|
|
}
|
2023-08-30 04:00:59 -04:00
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
currTransferRate := MetricV2{
|
2024-01-29 15:32:44 -05:00
|
|
|
Description: getClusterReplCurrentTransferRateMD(),
|
2023-09-05 13:26:18 -04:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
avgQueueCount := MetricV2{
|
2024-01-29 15:32:44 -05:00
|
|
|
Description: getClusterReplAvgQueuedOperationsMD(),
|
2023-09-05 13:26:18 -04:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
avgQueueBytes := MetricV2{
|
2024-01-29 15:32:44 -05:00
|
|
|
Description: getClusterReplAvgQueuedBytesMD(),
|
2023-09-05 13:26:18 -04:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
maxQueueCount := MetricV2{
|
2024-01-29 15:32:44 -05:00
|
|
|
Description: getClusterReplMaxQueuedOperationsMD(),
|
2023-09-05 13:26:18 -04:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
maxQueueBytes := MetricV2{
|
2024-01-29 15:32:44 -05:00
|
|
|
Description: getClusterReplMaxQueuedBytesMD(),
|
2023-09-05 13:26:18 -04:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
avgTransferRate := MetricV2{
|
2024-01-29 15:32:44 -05:00
|
|
|
Description: getClusterReplAvgTransferRateMD(),
|
2023-09-05 13:26:18 -04:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
maxTransferRate := MetricV2{
|
2024-01-29 15:32:44 -05:00
|
|
|
Description: getClusterReplMaxTransferRateMD(),
|
2023-09-05 13:26:18 -04:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mrfCount := MetricV2{
|
2024-01-29 15:32:44 -05:00
|
|
|
Description: getClusterReplMRFFailedOperationsMD(),
|
|
|
|
Value: float64(qs.MRFStats.LastFailedCount),
|
2023-09-05 13:26:18 -04:00
|
|
|
}
|
2023-08-30 04:00:59 -04:00
|
|
|
|
2023-09-05 13:26:18 -04:00
|
|
|
if qs.QStats.Avg.Count > 0 || qs.QStats.Curr.Count > 0 {
|
|
|
|
qt := qs.QStats
|
|
|
|
currInQueueBytes.Value = qt.Curr.Bytes
|
|
|
|
currInQueueCount.Value = qt.Curr.Count
|
|
|
|
avgQueueBytes.Value = qt.Avg.Bytes
|
|
|
|
avgQueueCount.Value = qt.Avg.Count
|
|
|
|
maxQueueBytes.Value = qt.Max.Bytes
|
|
|
|
maxQueueCount.Value = qt.Max.Count
|
|
|
|
}
|
|
|
|
activeWorkersCount.Value = float64(qs.ActiveWorkers.Curr)
|
|
|
|
avgActiveWorkersCount.Value = float64(qs.ActiveWorkers.Avg)
|
|
|
|
maxActiveWorkersCount.Value = float64(qs.ActiveWorkers.Max)
|
|
|
|
|
|
|
|
if len(qs.XferStats) > 0 {
|
|
|
|
tots := qs.XferStats[Total]
|
|
|
|
currTransferRate.Value = tots.Curr
|
|
|
|
avgTransferRate.Value = tots.Avg
|
|
|
|
maxTransferRate.Value = tots.Peak
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = []MetricV2{
|
2023-09-05 13:26:18 -04:00
|
|
|
activeWorkersCount,
|
|
|
|
avgActiveWorkersCount,
|
|
|
|
maxActiveWorkersCount,
|
|
|
|
currInQueueCount,
|
|
|
|
currInQueueBytes,
|
|
|
|
avgQueueCount,
|
|
|
|
avgQueueBytes,
|
|
|
|
maxQueueCount,
|
|
|
|
maxQueueBytes,
|
|
|
|
currTransferRate,
|
|
|
|
avgTransferRate,
|
|
|
|
maxTransferRate,
|
|
|
|
mrfCount,
|
|
|
|
}
|
2023-08-30 04:00:59 -04:00
|
|
|
}
|
|
|
|
for ep, health := range globalBucketTargetSys.healthStats() {
|
|
|
|
// link latency current
|
2024-03-10 05:15:15 -04:00
|
|
|
m := MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getClusterRepLinkLatencyCurrMD(),
|
|
|
|
VariableLabels: map[string]string{
|
|
|
|
"endpoint": ep,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
m.Value = float64(health.latency.curr / time.Millisecond)
|
|
|
|
ml = append(ml, m)
|
|
|
|
|
|
|
|
// link latency average
|
2024-03-10 05:15:15 -04:00
|
|
|
m = MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getClusterRepLinkLatencyAvgMD(),
|
|
|
|
VariableLabels: map[string]string{
|
|
|
|
"endpoint": ep,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
m.Value = float64(health.latency.avg / time.Millisecond)
|
|
|
|
ml = append(ml, m)
|
|
|
|
|
|
|
|
// link latency max
|
2024-03-10 05:15:15 -04:00
|
|
|
m = MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getClusterRepLinkLatencyMaxMD(),
|
|
|
|
VariableLabels: map[string]string{
|
|
|
|
"endpoint": ep,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
m.Value = float64(health.latency.peak / time.Millisecond)
|
|
|
|
ml = append(ml, m)
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
linkOnline := MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getClusterRepLinkOnlineMD(),
|
|
|
|
VariableLabels: map[string]string{
|
|
|
|
"endpoint": ep,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
online := Offline
|
|
|
|
if health.Online {
|
|
|
|
online = Online
|
|
|
|
}
|
|
|
|
linkOnline.Value = float64(online)
|
|
|
|
ml = append(ml, linkOnline)
|
2024-03-10 05:15:15 -04:00
|
|
|
offlineDuration := MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getClusterRepLinkCurrOfflineDurationMD(),
|
|
|
|
VariableLabels: map[string]string{
|
|
|
|
"endpoint": ep,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
currDowntime := time.Duration(0)
|
|
|
|
if !health.Online && !health.lastOnline.IsZero() {
|
|
|
|
currDowntime = UTCNow().Sub(health.lastOnline)
|
|
|
|
}
|
|
|
|
offlineDuration.Value = float64(currDowntime / time.Second)
|
|
|
|
ml = append(ml, offlineDuration)
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
downtimeDuration := MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getClusterRepLinkTotalOfflineDurationMD(),
|
|
|
|
VariableLabels: map[string]string{
|
|
|
|
"endpoint": ep,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
dwntime := currDowntime
|
|
|
|
if health.offlineDuration > currDowntime {
|
|
|
|
dwntime = health.offlineDuration
|
|
|
|
}
|
|
|
|
downtimeDuration.Value = float64(dwntime / time.Second)
|
|
|
|
ml = append(ml, downtimeDuration)
|
|
|
|
|
|
|
|
}
|
|
|
|
return ml
|
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
|
|
|
// replication metrics for site replication
|
2024-03-10 05:15:15 -04:00
|
|
|
func getReplicationSiteMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval: 1 * time.Minute,
|
|
|
|
metricsGroupOpts: opts,
|
2023-08-30 04:00:59 -04:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(_ context.Context) []MetricV2 {
|
|
|
|
ml := []MetricV2{}
|
2023-08-30 04:00:59 -04:00
|
|
|
|
|
|
|
// metrics pertinent to site replication - overall roll up.
|
|
|
|
if globalSiteReplicationSys.isEnabled() {
|
|
|
|
m, err := globalSiteReplicationSys.getSiteMetrics(GlobalContext)
|
|
|
|
if err != nil {
|
2024-04-04 08:04:40 -04:00
|
|
|
metricsLogIf(GlobalContext, err)
|
2023-08-30 04:00:59 -04:00
|
|
|
return ml
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepReceivedBytesMD(clusterMetricNamespace),
|
|
|
|
Value: float64(m.ReplicaSize),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepReceivedOperationsMD(clusterMetricNamespace),
|
|
|
|
Value: float64(m.ReplicaCount),
|
|
|
|
})
|
|
|
|
|
|
|
|
for _, stat := range m.Metrics {
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepFailedBytesLastMinuteMD(clusterMetricNamespace),
|
|
|
|
Value: float64(stat.Failed.LastMinute.Bytes),
|
|
|
|
VariableLabels: map[string]string{"endpoint": stat.Endpoint},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepFailedOperationsLastMinuteMD(clusterMetricNamespace),
|
|
|
|
Value: stat.Failed.LastMinute.Count,
|
|
|
|
VariableLabels: map[string]string{"endpoint": stat.Endpoint},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepFailedBytesLastHourMD(clusterMetricNamespace),
|
|
|
|
Value: float64(stat.Failed.LastHour.Bytes),
|
|
|
|
VariableLabels: map[string]string{"endpoint": stat.Endpoint},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepFailedOperationsLastHourMD(clusterMetricNamespace),
|
|
|
|
Value: stat.Failed.LastHour.Count,
|
|
|
|
VariableLabels: map[string]string{"endpoint": stat.Endpoint},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepFailedBytesTotalMD(clusterMetricNamespace),
|
|
|
|
Value: float64(stat.Failed.Totals.Bytes),
|
|
|
|
VariableLabels: map[string]string{"endpoint": stat.Endpoint},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepFailedOperationsTotalMD(clusterMetricNamespace),
|
|
|
|
Value: stat.Failed.Totals.Count,
|
|
|
|
VariableLabels: map[string]string{"endpoint": stat.Endpoint},
|
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepSentBytesMD(clusterMetricNamespace),
|
|
|
|
Value: float64(stat.ReplicatedSize),
|
|
|
|
VariableLabels: map[string]string{"endpoint": stat.Endpoint},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepSentOperationsMD(clusterMetricNamespace),
|
|
|
|
Value: float64(stat.ReplicatedCount),
|
|
|
|
VariableLabels: map[string]string{"endpoint": stat.Endpoint},
|
|
|
|
})
|
|
|
|
|
|
|
|
if c, ok := stat.Failed.ErrCounts["AccessDenied"]; ok {
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getClusterRepCredentialErrorsMD(clusterMetricNamespace),
|
|
|
|
Value: float64(c),
|
|
|
|
VariableLabels: map[string]string{"endpoint": stat.Endpoint},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedGetOperationsMD(clusterMetricNamespace),
|
|
|
|
Value: float64(m.Proxied.GetTotal),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedHeadOperationsMD(clusterMetricNamespace),
|
|
|
|
Value: float64(m.Proxied.HeadTotal),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedPutTaggingOperationsMD(clusterMetricNamespace),
|
|
|
|
Value: float64(m.Proxied.PutTagTotal),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedGetTaggingOperationsMD(clusterMetricNamespace),
|
|
|
|
Value: float64(m.Proxied.GetTagTotal),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedRmvTaggingOperationsMD(clusterMetricNamespace),
|
|
|
|
Value: float64(m.Proxied.RmvTagTotal),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedGetFailedOperationsMD(clusterMetricNamespace),
|
|
|
|
Value: float64(m.Proxied.GetFailedTotal),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedHeadFailedOperationsMD(clusterMetricNamespace),
|
|
|
|
Value: float64(m.Proxied.HeadFailedTotal),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedPutTaggingFailedOperationsMD(clusterMetricNamespace),
|
|
|
|
Value: float64(m.Proxied.PutTagFailedTotal),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedGetTaggingFailedOperationsMD(clusterMetricNamespace),
|
|
|
|
Value: float64(m.Proxied.GetTagFailedTotal),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
ml = append(ml, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedRmvTaggingFailedOperationsMD(clusterMetricNamespace),
|
|
|
|
Value: float64(m.Proxied.RmvTagFailedTotal),
|
|
|
|
})
|
2023-08-30 04:00:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return ml
|
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getMinioVersionMetrics() *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2022-12-26 11:35:32 -05:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(_ context.Context) (metrics []MetricV2) {
|
|
|
|
metrics = append(metrics, MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getMinIOCommitMD(),
|
|
|
|
VariableLabels: map[string]string{"commit": CommitID},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getMinIOVersionMD(),
|
|
|
|
VariableLabels: map[string]string{"version": Version},
|
|
|
|
})
|
|
|
|
return
|
|
|
|
})
|
|
|
|
return mg
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getNodeHealthMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval: 1 * time.Minute,
|
|
|
|
metricsGroupOpts: opts,
|
2022-12-26 11:35:32 -05:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(_ context.Context) (metrics []MetricV2) {
|
|
|
|
metrics = make([]MetricV2, 0, 16)
|
2022-06-08 05:43:13 -04:00
|
|
|
nodesUp, nodesDown := globalNotificationSys.GetPeerOnlineCount()
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getNodeOnlineTotalMD(),
|
|
|
|
Value: float64(nodesUp),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getNodeOfflineTotalMD(),
|
|
|
|
Value: float64(nodesDown),
|
|
|
|
})
|
|
|
|
return
|
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
2021-04-03 12:03:42 -04:00
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getMinioHealingMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
metricsGroupOpts: opts,
|
2022-12-26 11:35:32 -05:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(_ context.Context) (metrics []MetricV2) {
|
2021-12-17 13:11:04 -05:00
|
|
|
bgSeq, exists := globalBackgroundHealState.getHealSequenceByToken(bgHealingUUID)
|
|
|
|
if !exists {
|
|
|
|
return
|
|
|
|
}
|
2021-04-03 12:03:42 -04:00
|
|
|
|
2021-12-17 13:11:04 -05:00
|
|
|
if bgSeq.lastHealActivity.IsZero() {
|
2021-03-19 03:04:29 -04:00
|
|
|
return
|
2021-12-17 13:11:04 -05:00
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = make([]MetricV2, 0, 5)
|
|
|
|
metrics = append(metrics, MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getHealLastActivityTimeMD(),
|
|
|
|
Value: float64(time.Since(bgSeq.lastHealActivity)),
|
|
|
|
})
|
|
|
|
metrics = append(metrics, getObjectsScanned(bgSeq)...)
|
|
|
|
metrics = append(metrics, getHealedItems(bgSeq)...)
|
|
|
|
metrics = append(metrics, getFailedItems(bgSeq)...)
|
|
|
|
return
|
|
|
|
})
|
|
|
|
return mg
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getFailedItems(seq *healSequence) (m []MetricV2) {
|
2024-04-02 02:48:36 -04:00
|
|
|
items := seq.getHealFailedItemsMap()
|
2024-03-10 05:15:15 -04:00
|
|
|
m = make([]MetricV2, 0, len(items))
|
2023-07-14 14:02:45 -04:00
|
|
|
for k, v := range items {
|
2021-01-18 23:35:38 -05:00
|
|
|
s := strings.Split(k, ",")
|
2024-03-10 05:15:15 -04:00
|
|
|
m = append(m, MetricV2{
|
2021-01-18 23:35:38 -05:00
|
|
|
Description: getHealObjectsFailTotalMD(),
|
|
|
|
VariableLabels: map[string]string{
|
|
|
|
"mount_path": s[0],
|
|
|
|
"volume_status": s[1],
|
|
|
|
},
|
|
|
|
Value: float64(v),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getHealedItems(seq *healSequence) (m []MetricV2) {
|
2021-03-25 15:58:43 -04:00
|
|
|
items := seq.getHealedItemsMap()
|
2024-03-10 05:15:15 -04:00
|
|
|
m = make([]MetricV2, 0, len(items))
|
2021-03-25 15:58:43 -04:00
|
|
|
for k, v := range items {
|
2024-03-10 05:15:15 -04:00
|
|
|
m = append(m, MetricV2{
|
2021-01-18 23:35:38 -05:00
|
|
|
Description: getHealObjectsHealTotalMD(),
|
|
|
|
VariableLabels: map[string]string{"type": string(k)},
|
|
|
|
Value: float64(v),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getObjectsScanned(seq *healSequence) (m []MetricV2) {
|
2021-06-17 23:27:04 -04:00
|
|
|
items := seq.getScannedItemsMap()
|
2024-03-10 05:15:15 -04:00
|
|
|
m = make([]MetricV2, 0, len(items))
|
2021-06-17 23:27:04 -04:00
|
|
|
for k, v := range items {
|
2024-03-10 05:15:15 -04:00
|
|
|
m = append(m, MetricV2{
|
2021-01-18 23:35:38 -05:00
|
|
|
Description: getHealObjectsTotalMD(),
|
|
|
|
VariableLabels: map[string]string{"type": string(k)},
|
|
|
|
Value: float64(v),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
2021-06-17 23:27:04 -04:00
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getDistLockMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval: 1 * time.Second,
|
|
|
|
metricsGroupOpts: opts,
|
2023-04-04 00:23:24 -04:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) []MetricV2 {
|
2023-04-04 00:23:24 -04:00
|
|
|
if !globalIsDistErasure {
|
2024-03-10 05:15:15 -04:00
|
|
|
return []MetricV2{}
|
2023-04-04 00:23:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
st := globalLockServer.stats()
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics := make([]MetricV2, 0, 3)
|
|
|
|
metrics = append(metrics, MetricV2{
|
2023-04-04 00:23:24 -04:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: minioNamespace,
|
|
|
|
Subsystem: "locks",
|
|
|
|
Name: "total",
|
|
|
|
Help: "Number of current locks on this peer",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
},
|
|
|
|
Value: float64(st.Total),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-04-04 00:23:24 -04:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: minioNamespace,
|
|
|
|
Subsystem: "locks",
|
|
|
|
Name: "write_total",
|
|
|
|
Help: "Number of current WRITE locks on this peer",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
},
|
|
|
|
Value: float64(st.Writes),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-04-04 00:23:24 -04:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: minioNamespace,
|
|
|
|
Subsystem: "locks",
|
|
|
|
Name: "read_total",
|
|
|
|
Help: "Number of current READ locks on this peer",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
},
|
|
|
|
Value: float64(st.Reads),
|
|
|
|
})
|
|
|
|
return metrics
|
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getNotificationMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
metricsGroupOpts: opts,
|
2022-12-26 11:35:32 -05:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) []MetricV2 {
|
|
|
|
metrics := make([]MetricV2, 0, 3)
|
2023-10-09 20:28:17 -04:00
|
|
|
|
|
|
|
if globalEventNotifier != nil {
|
|
|
|
nstats := globalEventNotifier.targetList.Stats()
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-11-08 19:36:47 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: minioNamespace,
|
|
|
|
Subsystem: notifySubsystem,
|
2023-10-09 20:28:17 -04:00
|
|
|
Name: "current_send_in_progress",
|
2023-12-14 12:09:26 -05:00
|
|
|
Help: "Number of concurrent async Send calls active to all targets (deprecated, please use 'minio_notify_target_current_send_in_progress' instead)",
|
2022-11-08 19:36:47 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
},
|
2023-10-09 20:28:17 -04:00
|
|
|
Value: float64(nstats.CurrentSendCalls),
|
2022-11-08 19:36:47 -05:00
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-10-12 18:39:22 -04:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: minioNamespace,
|
|
|
|
Subsystem: notifySubsystem,
|
|
|
|
Name: "events_skipped_total",
|
2023-12-14 12:09:26 -05:00
|
|
|
Help: "Events that were skipped to be sent to the targets due to the in-memory queue being full",
|
2023-10-12 18:39:22 -04:00
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
Value: float64(nstats.EventsSkipped),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-10-12 18:39:22 -04:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: minioNamespace,
|
|
|
|
Subsystem: notifySubsystem,
|
2023-12-07 19:21:17 -05:00
|
|
|
Name: "events_errors_total",
|
2023-12-14 12:09:26 -05:00
|
|
|
Help: "Events that were failed to be sent to the targets (deprecated, please use 'minio_notify_target_failed_events' instead)",
|
2023-12-07 19:21:17 -05:00
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
Value: float64(nstats.EventsErrorsTotal),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-12-07 19:21:17 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: minioNamespace,
|
|
|
|
Subsystem: notifySubsystem,
|
2023-10-12 18:39:22 -04:00
|
|
|
Name: "events_sent_total",
|
2023-12-14 12:09:26 -05:00
|
|
|
Help: "Total number of events sent to the targets (deprecated, please use 'minio_notify_target_total_events' instead)",
|
2023-10-12 18:39:22 -04:00
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
Value: float64(nstats.TotalEvents),
|
|
|
|
})
|
2023-12-14 12:09:26 -05:00
|
|
|
for id, st := range nstats.TargetStats {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-12-14 12:09:26 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: minioNamespace,
|
|
|
|
Subsystem: notifySubsystem,
|
|
|
|
Name: "target_total_events",
|
|
|
|
Help: "Total number of events sent (or) queued to the target",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
VariableLabels: map[string]string{"target_id": id.ID, "target_name": id.Name},
|
|
|
|
Value: float64(st.TotalEvents),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-12-14 12:09:26 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: minioNamespace,
|
|
|
|
Subsystem: notifySubsystem,
|
|
|
|
Name: "target_failed_events",
|
|
|
|
Help: "Number of events failed to be sent (or) queued to the target",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
VariableLabels: map[string]string{"target_id": id.ID, "target_name": id.Name},
|
|
|
|
Value: float64(st.FailedEvents),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-12-14 12:09:26 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: minioNamespace,
|
|
|
|
Subsystem: notifySubsystem,
|
|
|
|
Name: "target_current_send_in_progress",
|
|
|
|
Help: "Number of concurrent async Send calls active to the target",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
},
|
|
|
|
VariableLabels: map[string]string{"target_id": id.ID, "target_name": id.Name},
|
|
|
|
Value: float64(st.CurrentSendCalls),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-10-09 20:28:17 -04:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: minioNamespace,
|
|
|
|
Subsystem: notifySubsystem,
|
|
|
|
Name: "target_queue_length",
|
2023-12-14 12:09:26 -05:00
|
|
|
Help: "Number of events currently staged in the queue_dir configured for the target",
|
2023-10-09 20:28:17 -04:00
|
|
|
Type: gaugeMetric,
|
|
|
|
},
|
2023-12-14 12:09:26 -05:00
|
|
|
VariableLabels: map[string]string{"target_id": id.ID, "target_name": id.Name},
|
2023-10-09 20:28:17 -04:00
|
|
|
Value: float64(st.CurrentQueue),
|
|
|
|
})
|
|
|
|
}
|
2022-11-08 19:36:47 -05:00
|
|
|
}
|
2023-03-07 11:12:41 -05:00
|
|
|
|
|
|
|
lstats := globalLambdaTargetList.Stats()
|
|
|
|
for _, st := range lstats.TargetStats {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-03-07 11:12:41 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: minioNamespace,
|
|
|
|
Subsystem: lambdaSubsystem,
|
|
|
|
Name: "active_requests",
|
|
|
|
Help: "Number of in progress requests",
|
|
|
|
},
|
|
|
|
VariableLabels: map[string]string{"target_id": st.ID.ID, "target_name": st.ID.Name},
|
|
|
|
Value: float64(st.ActiveRequests),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-03-07 11:12:41 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: minioNamespace,
|
|
|
|
Subsystem: lambdaSubsystem,
|
|
|
|
Name: "total_requests",
|
|
|
|
Help: "Total number of requests sent since start",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
VariableLabels: map[string]string{"target_id": st.ID.ID, "target_name": st.ID.Name},
|
|
|
|
Value: float64(st.TotalRequests),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-03-07 11:12:41 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: minioNamespace,
|
|
|
|
Subsystem: lambdaSubsystem,
|
|
|
|
Name: "failed_requests",
|
|
|
|
Help: "Total number of requests that failed to send since start",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
VariableLabels: map[string]string{"target_id": st.ID.ID, "target_name": st.ID.Name},
|
|
|
|
Value: float64(st.FailedRequests),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-11-10 13:20:21 -05:00
|
|
|
// Audit and system:
|
|
|
|
audit := logger.CurrentStats()
|
|
|
|
for id, st := range audit {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-11-10 13:20:21 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: minioNamespace,
|
|
|
|
Subsystem: auditSubsystem,
|
|
|
|
Name: "target_queue_length",
|
|
|
|
Help: "Number of unsent messages in queue for target",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
},
|
|
|
|
VariableLabels: map[string]string{"target_id": id},
|
|
|
|
Value: float64(st.QueueLength),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-11-10 13:20:21 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: minioNamespace,
|
|
|
|
Subsystem: auditSubsystem,
|
|
|
|
Name: "total_messages",
|
|
|
|
Help: "Total number of messages sent since start",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
VariableLabels: map[string]string{"target_id": id},
|
|
|
|
Value: float64(st.TotalMessages),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-11-10 13:20:21 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: minioNamespace,
|
|
|
|
Subsystem: auditSubsystem,
|
|
|
|
Name: "failed_messages",
|
|
|
|
Help: "Total number of messages that failed to send since start",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
VariableLabels: map[string]string{"target_id": id},
|
|
|
|
Value: float64(st.FailedMessages),
|
|
|
|
})
|
|
|
|
}
|
2022-11-08 19:36:47 -05:00
|
|
|
return metrics
|
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getHTTPMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
metricsGroupOpts: opts,
|
2022-12-26 11:35:32 -05:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) (metrics []MetricV2) {
|
2024-01-10 18:21:52 -05:00
|
|
|
if !mg.metricsGroupOpts.bucketOnly {
|
2024-03-04 13:05:56 -05:00
|
|
|
httpStats := globalHTTPStats.toServerHTTPStats(true)
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = make([]MetricV2, 0, 3+
|
2023-07-19 01:25:12 -04:00
|
|
|
len(httpStats.CurrentS3Requests.APIStats)+
|
|
|
|
len(httpStats.TotalS3Requests.APIStats)+
|
|
|
|
len(httpStats.TotalS3Errors.APIStats)+
|
|
|
|
len(httpStats.TotalS35xxErrors.APIStats)+
|
|
|
|
len(httpStats.TotalS34xxErrors.APIStats))
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getS3RejectedAuthRequestsTotalMD(),
|
|
|
|
Value: float64(httpStats.TotalS3RejectedAuth),
|
2021-03-31 02:19:36 -04:00
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getS3RejectedTimestampRequestsTotalMD(),
|
|
|
|
Value: float64(httpStats.TotalS3RejectedTime),
|
2021-03-31 02:19:36 -04:00
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getS3RejectedHeaderRequestsTotalMD(),
|
|
|
|
Value: float64(httpStats.TotalS3RejectedHeader),
|
2021-03-31 02:19:36 -04:00
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getS3RejectedInvalidRequestsTotalMD(),
|
|
|
|
Value: float64(httpStats.TotalS3RejectedInvalid),
|
2022-06-08 14:22:34 -04:00
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getS3RequestsInQueueMD(),
|
|
|
|
Value: float64(httpStats.S3RequestsInQueue),
|
2022-06-08 14:22:34 -04:00
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getIncomingS3RequestsMD(),
|
|
|
|
Value: float64(httpStats.S3RequestsIncoming),
|
2021-02-20 03:21:55 -05:00
|
|
|
})
|
2023-07-19 01:25:12 -04:00
|
|
|
|
|
|
|
for api, value := range httpStats.CurrentS3Requests.APIStats {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getS3RequestsInFlightMD(),
|
|
|
|
Value: float64(value),
|
|
|
|
VariableLabels: map[string]string{"api": api},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
for api, value := range httpStats.TotalS3Requests.APIStats {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getS3RequestsTotalMD(),
|
|
|
|
Value: float64(value),
|
|
|
|
VariableLabels: map[string]string{"api": api},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
for api, value := range httpStats.TotalS3Errors.APIStats {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getS3RequestsErrorsMD(),
|
|
|
|
Value: float64(value),
|
|
|
|
VariableLabels: map[string]string{"api": api},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
for api, value := range httpStats.TotalS35xxErrors.APIStats {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getS3Requests5xxErrorsMD(),
|
|
|
|
Value: float64(value),
|
|
|
|
VariableLabels: map[string]string{"api": api},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
for api, value := range httpStats.TotalS34xxErrors.APIStats {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getS3Requests4xxErrorsMD(),
|
|
|
|
Value: float64(value),
|
|
|
|
VariableLabels: map[string]string{"api": api},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
for api, value := range httpStats.TotalS3Canceled.APIStats {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getS3RequestsCanceledMD(),
|
|
|
|
Value: float64(value),
|
|
|
|
VariableLabels: map[string]string{"api": api},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return
|
2021-12-17 13:11:04 -05:00
|
|
|
}
|
2023-07-11 10:46:24 -04:00
|
|
|
|
|
|
|
for bucket, inOut := range globalBucketConnStats.getS3InOutBytes() {
|
|
|
|
recvBytes := inOut.In
|
|
|
|
if recvBytes > 0 {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-11 10:46:24 -04:00
|
|
|
Description: getBucketTrafficReceivedBytes(),
|
|
|
|
Value: float64(recvBytes),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
sentBytes := inOut.Out
|
|
|
|
if sentBytes > 0 {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-11 10:46:24 -04:00
|
|
|
Description: getBucketTrafficSentBytes(),
|
|
|
|
Value: float64(sentBytes),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
httpStats := globalBucketHTTPStats.load(bucket)
|
2024-03-04 13:05:56 -05:00
|
|
|
for k, v := range httpStats.currentS3Requests.Load(true) {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-11 10:46:24 -04:00
|
|
|
Description: getBucketS3RequestsInFlightMD(),
|
|
|
|
Value: float64(v),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket, "api": k},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-03-04 13:05:56 -05:00
|
|
|
for k, v := range httpStats.totalS3Requests.Load(true) {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-11 10:46:24 -04:00
|
|
|
Description: getBucketS3RequestsTotalMD(),
|
|
|
|
Value: float64(v),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket, "api": k},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-03-04 13:05:56 -05:00
|
|
|
for k, v := range httpStats.totalS3Canceled.Load(true) {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-11 10:46:24 -04:00
|
|
|
Description: getBucketS3RequestsCanceledMD(),
|
|
|
|
Value: float64(v),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket, "api": k},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-03-04 13:05:56 -05:00
|
|
|
for k, v := range httpStats.totalS34xxErrors.Load(true) {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-11 10:46:24 -04:00
|
|
|
Description: getBucketS3Requests4xxErrorsMD(),
|
|
|
|
Value: float64(v),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket, "api": k},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-03-04 13:05:56 -05:00
|
|
|
for k, v := range httpStats.totalS35xxErrors.Load(true) {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-11 10:46:24 -04:00
|
|
|
Description: getBucketS3Requests5xxErrorsMD(),
|
|
|
|
Value: float64(v),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket, "api": k},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-17 13:11:04 -05:00
|
|
|
return
|
|
|
|
})
|
|
|
|
return mg
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getNetworkMetrics() *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2022-12-26 11:35:32 -05:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) (metrics []MetricV2) {
|
|
|
|
metrics = make([]MetricV2, 0, 10)
|
2021-12-17 13:11:04 -05:00
|
|
|
connStats := globalConnStats.toServerConnStats()
|
2022-09-26 12:04:26 -04:00
|
|
|
rpcStats := rest.GetRPCStats()
|
2022-06-11 03:50:31 -04:00
|
|
|
if globalIsDistErasure {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-06-11 03:50:31 -04:00
|
|
|
Description: getInternodeFailedRequests(),
|
2022-09-26 12:04:26 -04:00
|
|
|
Value: float64(rpcStats.Errs),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-09-26 12:04:26 -04:00
|
|
|
Description: getInternodeTCPDialTimeout(),
|
|
|
|
Value: float64(rpcStats.DialErrs),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-09-26 12:04:26 -04:00
|
|
|
Description: getInternodeTCPAvgDuration(),
|
|
|
|
Value: float64(rpcStats.DialAvgDuration),
|
2022-06-11 03:50:31 -04:00
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-06-11 03:50:31 -04:00
|
|
|
Description: getInterNodeSentBytesMD(),
|
2023-07-08 10:35:11 -04:00
|
|
|
Value: float64(connStats.internodeOutputBytes),
|
2022-06-11 03:50:31 -04:00
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-06-11 03:50:31 -04:00
|
|
|
Description: getInterNodeReceivedBytesMD(),
|
2023-07-08 10:35:11 -04:00
|
|
|
Value: float64(connStats.internodeInputBytes),
|
2022-06-11 03:50:31 -04:00
|
|
|
})
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getS3SentBytesMD(),
|
2023-07-08 10:35:11 -04:00
|
|
|
Value: float64(connStats.s3OutputBytes),
|
2021-12-17 13:11:04 -05:00
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getS3ReceivedBytesMD(),
|
2023-07-08 10:35:11 -04:00
|
|
|
Value: float64(connStats.s3InputBytes),
|
2021-12-17 13:11:04 -05:00
|
|
|
})
|
|
|
|
return
|
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getClusterUsageMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval: 1 * time.Minute,
|
|
|
|
metricsGroupOpts: opts,
|
2023-07-19 01:25:12 -04:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) (metrics []MetricV2) {
|
2023-07-19 01:25:12 -04:00
|
|
|
objLayer := newObjectLayerFn()
|
2024-01-19 17:51:36 -05:00
|
|
|
if objLayer == nil {
|
|
|
|
return
|
|
|
|
}
|
2023-07-19 01:25:12 -04:00
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = make([]MetricV2, 0, 50)
|
2023-07-19 01:25:12 -04:00
|
|
|
dataUsageInfo, err := loadDataUsageFromBackend(ctx, objLayer)
|
|
|
|
if err != nil {
|
2024-04-04 08:04:40 -04:00
|
|
|
metricsLogIf(ctx, err)
|
2023-07-19 01:25:12 -04:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// data usage has not captured any data yet.
|
|
|
|
if dataUsageInfo.LastUpdate.IsZero() {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getUsageLastScanActivityMD(),
|
|
|
|
Value: float64(time.Since(dataUsageInfo.LastUpdate)),
|
|
|
|
})
|
|
|
|
|
|
|
|
var (
|
2023-07-20 10:52:32 -04:00
|
|
|
clusterSize uint64
|
|
|
|
clusterBuckets uint64
|
|
|
|
clusterObjectsCount uint64
|
|
|
|
clusterVersionsCount uint64
|
|
|
|
clusterDeleteMarkersCount uint64
|
2023-07-19 01:25:12 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
clusterObjectSizesHistogram := map[string]uint64{}
|
|
|
|
clusterVersionsHistogram := map[string]uint64{}
|
|
|
|
for _, usage := range dataUsageInfo.BucketsUsage {
|
|
|
|
clusterBuckets++
|
|
|
|
clusterSize += usage.Size
|
|
|
|
clusterObjectsCount += usage.ObjectsCount
|
|
|
|
clusterVersionsCount += usage.VersionsCount
|
2023-07-20 10:52:32 -04:00
|
|
|
clusterDeleteMarkersCount += usage.DeleteMarkersCount
|
2023-07-19 01:25:12 -04:00
|
|
|
for k, v := range usage.ObjectSizesHistogram {
|
|
|
|
v1, ok := clusterObjectSizesHistogram[k]
|
|
|
|
if !ok {
|
|
|
|
clusterObjectSizesHistogram[k] = v
|
|
|
|
} else {
|
|
|
|
v1 += v
|
|
|
|
clusterObjectSizesHistogram[k] = v1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for k, v := range usage.ObjectVersionsHistogram {
|
|
|
|
v1, ok := clusterVersionsHistogram[k]
|
|
|
|
if !ok {
|
|
|
|
clusterVersionsHistogram[k] = v
|
|
|
|
} else {
|
|
|
|
v1 += v
|
|
|
|
clusterVersionsHistogram[k] = v1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getClusterUsageTotalBytesMD(),
|
|
|
|
Value: float64(clusterSize),
|
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getClusterUsageObjectsTotalMD(),
|
|
|
|
Value: float64(clusterObjectsCount),
|
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getClusterUsageVersionsTotalMD(),
|
|
|
|
Value: float64(clusterVersionsCount),
|
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-20 10:52:32 -04:00
|
|
|
Description: getClusterUsageDeleteMarkersTotalMD(),
|
|
|
|
Value: float64(clusterDeleteMarkersCount),
|
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getClusterObjectDistributionMD(),
|
|
|
|
Histogram: clusterObjectSizesHistogram,
|
|
|
|
HistogramBucketLabel: "range",
|
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getClusterObjectVersionsMD(),
|
|
|
|
Histogram: clusterVersionsHistogram,
|
|
|
|
HistogramBucketLabel: "range",
|
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-19 01:25:12 -04:00
|
|
|
Description: getClusterBucketsTotalMD(),
|
|
|
|
Value: float64(clusterBuckets),
|
|
|
|
})
|
|
|
|
|
|
|
|
return
|
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getBucketUsageMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval: 1 * time.Minute,
|
|
|
|
metricsGroupOpts: opts,
|
2021-12-17 14:40:09 -05:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) (metrics []MetricV2) {
|
2021-12-17 13:11:04 -05:00
|
|
|
objLayer := newObjectLayerFn()
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = make([]MetricV2, 0, 50)
|
2021-12-17 13:11:04 -05:00
|
|
|
dataUsageInfo, err := loadDataUsageFromBackend(ctx, objLayer)
|
|
|
|
if err != nil {
|
2024-04-04 08:04:40 -04:00
|
|
|
metricsLogIf(ctx, err)
|
2021-12-17 13:11:04 -05:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// data usage has not captured any data yet.
|
|
|
|
if dataUsageInfo.LastUpdate.IsZero() {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getUsageLastScanActivityMD(),
|
|
|
|
Value: float64(time.Since(dataUsageInfo.LastUpdate)),
|
|
|
|
})
|
|
|
|
|
2023-08-30 04:00:59 -04:00
|
|
|
var bucketReplStats map[string]BucketStats
|
|
|
|
if !globalSiteReplicationSys.isEnabled() {
|
|
|
|
bucketReplStats = globalReplicationStats.getAllLatest(dataUsageInfo.BucketsUsage)
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
for bucket, usage := range dataUsageInfo.BucketsUsage {
|
2022-01-31 20:27:43 -05:00
|
|
|
quota, _ := globalBucketQuotaSys.Get(ctx, bucket)
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getBucketUsageTotalBytesMD(),
|
|
|
|
Value: float64(usage.Size),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket},
|
2021-01-18 23:35:38 -05:00
|
|
|
})
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getBucketUsageObjectsTotalMD(),
|
|
|
|
Value: float64(usage.ObjectsCount),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket},
|
2023-04-12 23:08:07 -04:00
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-04-12 23:08:07 -04:00
|
|
|
Description: getBucketUsageVersionsTotalMD(),
|
|
|
|
Value: float64(usage.VersionsCount),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket},
|
2021-01-18 23:35:38 -05:00
|
|
|
})
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-20 10:52:32 -04:00
|
|
|
Description: getBucketUsageDeleteMarkersTotalMD(),
|
|
|
|
Value: float64(usage.DeleteMarkersCount),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket},
|
|
|
|
})
|
|
|
|
|
2022-01-31 20:27:43 -05:00
|
|
|
if quota != nil && quota.Quota > 0 {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-01-31 20:27:43 -05:00
|
|
|
Description: getBucketUsageQuotaTotalBytesMD(),
|
|
|
|
Value: float64(quota.Quota),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket},
|
|
|
|
})
|
|
|
|
}
|
2023-08-30 04:00:59 -04:00
|
|
|
if !globalSiteReplicationSys.isEnabled() {
|
2023-09-05 13:26:18 -04:00
|
|
|
var stats BucketReplicationStats
|
|
|
|
s, ok := bucketReplStats[bucket]
|
|
|
|
if ok {
|
|
|
|
stats = s.ReplicationStats
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-09-05 13:26:18 -04:00
|
|
|
Description: getRepReceivedBytesMD(bucketMetricNamespace),
|
|
|
|
Value: float64(stats.ReplicaSize),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-09-05 13:26:18 -04:00
|
|
|
Description: getRepReceivedOperationsMD(bucketMetricNamespace),
|
|
|
|
Value: float64(stats.ReplicaCount),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedGetOperationsMD(bucketMetricNamespace),
|
|
|
|
Value: float64(s.ProxyStats.GetTotal),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedHeadOperationsMD(bucketMetricNamespace),
|
|
|
|
Value: float64(s.ProxyStats.HeadTotal),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedPutTaggingOperationsMD(bucketMetricNamespace),
|
|
|
|
Value: float64(s.ProxyStats.PutTagTotal),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedGetTaggingOperationsMD(bucketMetricNamespace),
|
|
|
|
Value: float64(s.ProxyStats.GetTagTotal),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedRmvTaggingOperationsMD(bucketMetricNamespace),
|
|
|
|
Value: float64(s.ProxyStats.RmvTagTotal),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedGetFailedOperationsMD(bucketMetricNamespace),
|
|
|
|
Value: float64(s.ProxyStats.GetFailedTotal),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedHeadFailedOperationsMD(bucketMetricNamespace),
|
|
|
|
Value: float64(s.ProxyStats.HeadFailedTotal),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedPutTaggingFailedOperationsMD(bucketMetricNamespace),
|
|
|
|
Value: float64(s.ProxyStats.PutTagFailedTotal),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2024-02-06 01:00:45 -05:00
|
|
|
Description: getClusterReplProxiedGetTaggingFailedOperationsMD(bucketMetricNamespace),
|
|
|
|
Value: float64(s.ProxyStats.GetTagFailedTotal),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2024-02-12 16:02:27 -05:00
|
|
|
Description: getClusterReplProxiedRmvTaggingFailedOperationsMD(bucketMetricNamespace),
|
2024-02-06 01:00:45 -05:00
|
|
|
Value: float64(s.ProxyStats.RmvTagFailedTotal),
|
|
|
|
})
|
2023-09-05 13:26:18 -04:00
|
|
|
}
|
2023-08-30 04:00:59 -04:00
|
|
|
if stats.hasReplicationUsage() {
|
|
|
|
for arn, stat := range stats.Stats {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepFailedBytesLastMinuteMD(bucketMetricNamespace),
|
|
|
|
Value: float64(stat.Failed.LastMinute.Bytes),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket, "targetArn": arn},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepFailedOperationsLastMinuteMD(bucketMetricNamespace),
|
|
|
|
Value: stat.Failed.LastMinute.Count,
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket, "targetArn": arn},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepFailedBytesLastHourMD(bucketMetricNamespace),
|
|
|
|
Value: float64(stat.Failed.LastHour.Bytes),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket, "targetArn": arn},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepFailedOperationsLastHourMD(bucketMetricNamespace),
|
|
|
|
Value: stat.Failed.LastHour.Count,
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket, "targetArn": arn},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepFailedBytesTotalMD(bucketMetricNamespace),
|
|
|
|
Value: float64(stat.Failed.Totals.Bytes),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket, "targetArn": arn},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepFailedOperationsTotalMD(bucketMetricNamespace),
|
|
|
|
Value: stat.Failed.Totals.Count,
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket, "targetArn": arn},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepSentBytesMD(bucketMetricNamespace),
|
|
|
|
Value: float64(stat.ReplicatedSize),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket, "targetArn": arn},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getRepSentOperationsMD(bucketMetricNamespace),
|
|
|
|
Value: float64(stat.ReplicatedCount),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket, "targetArn": arn},
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getBucketRepLatencyMD(),
|
|
|
|
HistogramBucketLabel: "range",
|
|
|
|
Histogram: stat.Latency.getUploadLatency(),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket, "operation": "upload", "targetArn": arn},
|
|
|
|
})
|
|
|
|
if c, ok := stat.Failed.ErrCounts["AccessDenied"]; ok {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-08-30 04:00:59 -04:00
|
|
|
Description: getClusterRepCredentialErrorsMD(bucketMetricNamespace),
|
|
|
|
Value: float64(c),
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket, "targetArn": arn},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
}
|
2023-08-30 04:00:59 -04:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2024-01-22 11:45:36 -05:00
|
|
|
Description: getBucketObjectDistributionMD(),
|
|
|
|
Histogram: usage.ObjectSizesHistogram,
|
|
|
|
HistogramBucketLabel: "range",
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket},
|
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2024-01-22 11:45:36 -05:00
|
|
|
Description: getBucketObjectVersionsMD(),
|
|
|
|
Histogram: usage.ObjectVersionsHistogram,
|
|
|
|
HistogramBucketLabel: "range",
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket},
|
|
|
|
})
|
2021-12-17 13:11:04 -05:00
|
|
|
}
|
|
|
|
return
|
|
|
|
})
|
|
|
|
return mg
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
2021-03-02 20:28:04 -05:00
|
|
|
|
2022-02-08 15:45:28 -05:00
|
|
|
func getClusterTransitionedBytesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: ilmSubsystem,
|
|
|
|
Name: transitionedBytes,
|
|
|
|
Help: "Total bytes transitioned to a tier",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterTransitionedObjectsMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: ilmSubsystem,
|
|
|
|
Name: transitionedObjects,
|
|
|
|
Help: "Total number of objects transitioned to a tier",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterTransitionedVersionsMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: ilmSubsystem,
|
|
|
|
Name: transitionedVersions,
|
|
|
|
Help: "Total number of versions transitioned to a tier",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getClusterTierMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval: 1 * time.Minute,
|
|
|
|
metricsGroupOpts: opts,
|
2022-02-08 15:45:28 -05:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) (metrics []MetricV2) {
|
2022-02-08 15:45:28 -05:00
|
|
|
objLayer := newObjectLayerFn()
|
2024-01-10 18:21:52 -05:00
|
|
|
|
2022-03-29 13:10:06 -04:00
|
|
|
if globalTierConfigMgr.Empty() {
|
|
|
|
return
|
|
|
|
}
|
2022-02-08 15:45:28 -05:00
|
|
|
|
2023-01-12 16:02:00 -05:00
|
|
|
dui, err := loadDataUsageFromBackend(ctx, objLayer)
|
2022-02-08 15:45:28 -05:00
|
|
|
if err != nil {
|
2024-04-04 08:04:40 -04:00
|
|
|
metricsLogIf(ctx, err)
|
2022-02-08 15:45:28 -05:00
|
|
|
return
|
|
|
|
}
|
2022-03-07 13:59:32 -05:00
|
|
|
// data usage has not captured any tier stats yet.
|
|
|
|
if dui.TierStats == nil {
|
2022-02-08 15:45:28 -05:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-03-08 15:08:29 -05:00
|
|
|
return dui.tierMetrics()
|
2022-02-08 15:45:28 -05:00
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getLocalStorageMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval: 1 * time.Minute,
|
|
|
|
metricsGroupOpts: opts,
|
2021-12-17 14:40:09 -05:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) (metrics []MetricV2) {
|
2021-12-17 13:11:04 -05:00
|
|
|
objLayer := newObjectLayerFn()
|
2021-01-18 23:35:38 -05:00
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = make([]MetricV2, 0, 50)
|
2023-12-21 19:56:43 -05:00
|
|
|
storageInfo := objLayer.LocalStorageInfo(ctx, true)
|
2022-12-01 17:31:35 -05:00
|
|
|
onlineDrives, offlineDrives := getOnlineOfflineDisksStats(storageInfo.Disks)
|
|
|
|
totalDrives := onlineDrives.Merge(offlineDrives)
|
|
|
|
|
2021-12-17 13:11:04 -05:00
|
|
|
for _, disk := range storageInfo.Disks {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-12-01 17:31:35 -05:00
|
|
|
Description: getNodeDriveUsedBytesMD(),
|
2021-12-17 13:11:04 -05:00
|
|
|
Value: float64(disk.UsedSpace),
|
2023-08-15 13:55:47 -04:00
|
|
|
VariableLabels: map[string]string{"drive": disk.DrivePath},
|
2021-01-18 23:35:38 -05:00
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-12-01 17:31:35 -05:00
|
|
|
Description: getNodeDriveFreeBytesMD(),
|
2021-12-17 13:11:04 -05:00
|
|
|
Value: float64(disk.AvailableSpace),
|
2023-08-15 13:55:47 -04:00
|
|
|
VariableLabels: map[string]string{"drive": disk.DrivePath},
|
2021-01-18 23:35:38 -05:00
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-12-01 17:31:35 -05:00
|
|
|
Description: getNodeDriveTotalBytesMD(),
|
2021-12-17 13:11:04 -05:00
|
|
|
Value: float64(disk.TotalSpace),
|
2023-08-15 13:55:47 -04:00
|
|
|
VariableLabels: map[string]string{"drive": disk.DrivePath},
|
2021-01-18 23:35:38 -05:00
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-09-30 16:40:20 -04:00
|
|
|
Description: getNodeDrivesFreeInodesMD(),
|
2021-12-17 13:11:04 -05:00
|
|
|
Value: float64(disk.FreeInodes),
|
2023-08-15 13:55:47 -04:00
|
|
|
VariableLabels: map[string]string{"drive": disk.DrivePath},
|
2021-01-18 23:35:38 -05:00
|
|
|
})
|
2023-08-15 13:55:47 -04:00
|
|
|
|
|
|
|
if disk.Metrics != nil {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-08-15 13:55:47 -04:00
|
|
|
Description: getNodeDriveTimeoutErrorsMD(),
|
|
|
|
Value: float64(disk.Metrics.TotalErrorsTimeout),
|
|
|
|
VariableLabels: map[string]string{"drive": disk.DrivePath},
|
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2024-02-22 01:26:06 -05:00
|
|
|
Description: getNodeDriveAvailabilityErrorsMD(),
|
2023-08-15 13:55:47 -04:00
|
|
|
Value: float64(disk.Metrics.TotalErrorsAvailability),
|
|
|
|
VariableLabels: map[string]string{"drive": disk.DrivePath},
|
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2024-01-19 17:51:36 -05:00
|
|
|
Description: getNodeDriveWaitingIOMD(),
|
|
|
|
Value: float64(disk.Metrics.TotalWaiting),
|
|
|
|
VariableLabels: map[string]string{"drive": disk.DrivePath},
|
|
|
|
})
|
|
|
|
|
2023-08-15 13:55:47 -04:00
|
|
|
for apiName, latency := range disk.Metrics.LastMinute {
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-08-15 13:55:47 -04:00
|
|
|
Description: getNodeDriveAPILatencyMD(),
|
|
|
|
Value: float64(latency.Avg().Microseconds()),
|
|
|
|
VariableLabels: map[string]string{"drive": disk.DrivePath, "api": "storage." + apiName},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2023-05-04 17:44:30 -04:00
|
|
|
}
|
2022-01-25 19:31:44 -05:00
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-05-04 17:44:30 -04:00
|
|
|
Description: getNodeDrivesOfflineTotalMD(),
|
|
|
|
Value: float64(offlineDrives.Sum()),
|
|
|
|
})
|
2022-12-01 17:31:35 -05:00
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-05-04 17:44:30 -04:00
|
|
|
Description: getNodeDrivesOnlineTotalMD(),
|
|
|
|
Value: float64(onlineDrives.Sum()),
|
|
|
|
})
|
2022-12-01 17:31:35 -05:00
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-05-04 17:44:30 -04:00
|
|
|
Description: getNodeDrivesTotalMD(),
|
|
|
|
Value: float64(totalDrives.Sum()),
|
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-05-04 17:44:30 -04:00
|
|
|
Description: getNodeStandardParityMD(),
|
|
|
|
Value: float64(storageInfo.Backend.StandardSCParity),
|
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-05-04 17:44:30 -04:00
|
|
|
Description: getNodeRRSParityMD(),
|
|
|
|
Value: float64(storageInfo.Backend.RRSCParity),
|
|
|
|
})
|
2022-12-01 17:31:35 -05:00
|
|
|
|
2022-01-25 19:31:44 -05:00
|
|
|
return
|
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2023-07-28 04:16:53 -04:00
|
|
|
func getClusterWriteQuorumMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: "write",
|
|
|
|
Name: "quorum",
|
|
|
|
Help: "Maximum write quorum across all pools and sets",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterHealthStatusMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: "health",
|
|
|
|
Name: "status",
|
|
|
|
Help: "Get current cluster health status",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-28 15:53:59 -05:00
|
|
|
func getClusterErasureSetHealthStatusMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: "health",
|
|
|
|
Name: "erasure_set_status",
|
|
|
|
Help: "Get current health status for this erasure set",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-04 18:05:13 -05:00
|
|
|
func getClusterErasureSetReadQuorumMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: "health",
|
|
|
|
Name: "erasure_set_read_quorum",
|
|
|
|
Help: "Get the read quorum for this erasure set",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-21 19:56:43 -05:00
|
|
|
func getClusterErasureSetWriteQuorumMD() MetricDescription {
|
2023-11-13 03:59:48 -05:00
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: "health",
|
2023-12-21 19:56:43 -05:00
|
|
|
Name: "erasure_set_write_quorum",
|
|
|
|
Help: "Get the write quorum for this erasure set",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterErasureSetOnlineDrivesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: "health",
|
|
|
|
Name: "erasure_set_online_drives",
|
|
|
|
Help: "Get the count of the online drives in this erasure set",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getClusterErasureSetHealingDrivesMD() MetricDescription {
|
|
|
|
return MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: "health",
|
|
|
|
Name: "erasure_set_healing_drives",
|
|
|
|
Help: "Get the count of healing drives of this erasure set",
|
2023-11-13 03:59:48 -05:00
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getClusterHealthMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
metricsGroupOpts: opts,
|
2023-07-28 04:16:53 -04:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) (metrics []MetricV2) {
|
2023-07-28 04:16:53 -04:00
|
|
|
objLayer := newObjectLayerFn()
|
|
|
|
|
|
|
|
opts := HealthOptions{}
|
|
|
|
result := objLayer.Health(ctx, opts)
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = make([]MetricV2, 0, 2+4*len(result.ESHealth))
|
2023-12-21 19:56:43 -05:00
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-28 04:16:53 -04:00
|
|
|
Description: getClusterWriteQuorumMD(),
|
|
|
|
Value: float64(result.WriteQuorum),
|
|
|
|
})
|
|
|
|
|
|
|
|
health := 1
|
|
|
|
if !result.Healthy {
|
|
|
|
health = 0
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-07-28 04:16:53 -04:00
|
|
|
Description: getClusterHealthStatusMD(),
|
|
|
|
Value: float64(health),
|
|
|
|
})
|
|
|
|
|
2023-11-13 03:59:48 -05:00
|
|
|
for _, h := range result.ESHealth {
|
|
|
|
labels := map[string]string{
|
|
|
|
"pool": strconv.Itoa(h.PoolID),
|
|
|
|
"set": strconv.Itoa(h.SetID),
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2024-01-04 18:05:13 -05:00
|
|
|
Description: getClusterErasureSetReadQuorumMD(),
|
|
|
|
VariableLabels: labels,
|
|
|
|
Value: float64(h.ReadQuorum),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-12-21 19:56:43 -05:00
|
|
|
Description: getClusterErasureSetWriteQuorumMD(),
|
|
|
|
VariableLabels: labels,
|
|
|
|
Value: float64(h.WriteQuorum),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-12-21 19:56:43 -05:00
|
|
|
Description: getClusterErasureSetOnlineDrivesMD(),
|
|
|
|
VariableLabels: labels,
|
|
|
|
Value: float64(h.HealthyDrives),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-12-21 19:56:43 -05:00
|
|
|
Description: getClusterErasureSetHealingDrivesMD(),
|
2023-11-13 03:59:48 -05:00
|
|
|
VariableLabels: labels,
|
2023-12-21 19:56:43 -05:00
|
|
|
Value: float64(h.HealingDrives),
|
2023-11-13 03:59:48 -05:00
|
|
|
})
|
2024-01-28 15:53:59 -05:00
|
|
|
|
|
|
|
health := 1
|
|
|
|
if !h.Healthy {
|
|
|
|
health = 0
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2024-01-28 15:53:59 -05:00
|
|
|
Description: getClusterErasureSetHealthStatusMD(),
|
|
|
|
VariableLabels: labels,
|
|
|
|
Value: float64(health),
|
|
|
|
})
|
2023-11-13 03:59:48 -05:00
|
|
|
}
|
|
|
|
|
2023-07-28 04:16:53 -04:00
|
|
|
return
|
|
|
|
})
|
|
|
|
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getBatchJobsMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
metricsGroupOpts: opts,
|
2023-12-02 05:51:33 -05:00
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) (metrics []MetricV2) {
|
2023-12-02 05:51:33 -05:00
|
|
|
var m madmin.RealtimeMetrics
|
|
|
|
mLocal := collectLocalMetrics(madmin.MetricsBatchJobs, collectMetricsOpts{})
|
|
|
|
m.Merge(&mLocal)
|
|
|
|
|
|
|
|
mRemote := collectRemoteMetrics(ctx, madmin.MetricsBatchJobs, collectMetricsOpts{})
|
|
|
|
m.Merge(&mRemote)
|
|
|
|
|
|
|
|
if m.Aggregated.BatchJobs == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, mj := range m.Aggregated.BatchJobs.Jobs {
|
|
|
|
jtype := toSnake(mj.JobType)
|
|
|
|
var objects, objectsFailed float64
|
|
|
|
var bucket string
|
|
|
|
switch madmin.BatchJobType(mj.JobType) {
|
|
|
|
case madmin.BatchJobReplicate:
|
|
|
|
objects = float64(mj.Replicate.Objects)
|
|
|
|
objectsFailed = float64(mj.Replicate.ObjectsFailed)
|
|
|
|
bucket = mj.Replicate.Bucket
|
|
|
|
case madmin.BatchJobKeyRotate:
|
|
|
|
objects = float64(mj.KeyRotate.Objects)
|
|
|
|
objectsFailed = float64(mj.KeyRotate.ObjectsFailed)
|
|
|
|
bucket = mj.KeyRotate.Bucket
|
|
|
|
case madmin.BatchJobExpire:
|
|
|
|
objects = float64(mj.Expired.Objects)
|
|
|
|
objectsFailed = float64(mj.Expired.ObjectsFailed)
|
|
|
|
bucket = mj.Expired.Bucket
|
|
|
|
}
|
|
|
|
metrics = append(metrics,
|
2024-03-10 05:15:15 -04:00
|
|
|
MetricV2{
|
2023-12-02 05:51:33 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: "batch",
|
|
|
|
Name: MetricName(jtype + "_objects"),
|
|
|
|
Help: "Get successfully completed batch job " + jtype + "objects",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
Value: objects,
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket, "jobId": mj.JobID},
|
|
|
|
},
|
2024-03-10 05:15:15 -04:00
|
|
|
MetricV2{
|
2023-12-02 05:51:33 -05:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: bucketMetricNamespace,
|
|
|
|
Subsystem: "batch",
|
|
|
|
Name: MetricName(jtype + "_objects_failed"),
|
|
|
|
Help: "Get failed batch job " + jtype + "objects",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
Value: objectsFailed,
|
|
|
|
VariableLabels: map[string]string{"bucket": bucket, "jobId": mj.JobID},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
}
|
|
|
|
return
|
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getClusterStorageMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval: 1 * time.Minute,
|
|
|
|
metricsGroupOpts: opts,
|
2021-12-17 14:40:09 -05:00
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) (metrics []MetricV2) {
|
2021-12-17 13:11:04 -05:00
|
|
|
objLayer := newObjectLayerFn()
|
2021-01-18 23:35:38 -05:00
|
|
|
|
2021-12-17 13:11:04 -05:00
|
|
|
// Fetch disk space info, ignore errors
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = make([]MetricV2, 0, 10)
|
2023-12-21 19:56:43 -05:00
|
|
|
storageInfo := objLayer.StorageInfo(ctx, true)
|
2022-12-01 17:31:35 -05:00
|
|
|
onlineDrives, offlineDrives := getOnlineOfflineDisksStats(storageInfo.Disks)
|
|
|
|
totalDrives := onlineDrives.Merge(offlineDrives)
|
2021-03-03 14:18:41 -05:00
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getClusterCapacityTotalBytesMD(),
|
|
|
|
Value: float64(GetTotalCapacity(storageInfo.Disks)),
|
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getClusterCapacityFreeBytesMD(),
|
|
|
|
Value: float64(GetTotalCapacityFree(storageInfo.Disks)),
|
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getClusterCapacityUsageBytesMD(),
|
2022-07-06 16:29:49 -04:00
|
|
|
Value: float64(GetTotalUsableCapacity(storageInfo.Disks, storageInfo)),
|
2021-12-17 13:11:04 -05:00
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2021-12-17 13:11:04 -05:00
|
|
|
Description: getClusterCapacityUsageFreeBytesMD(),
|
2022-07-06 16:29:49 -04:00
|
|
|
Value: float64(GetTotalUsableCapacityFree(storageInfo.Disks, storageInfo)),
|
2021-12-17 13:11:04 -05:00
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-12-01 17:31:35 -05:00
|
|
|
Description: getClusterDrivesOfflineTotalMD(),
|
|
|
|
Value: float64(offlineDrives.Sum()),
|
2021-12-17 13:11:04 -05:00
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-12-01 17:31:35 -05:00
|
|
|
Description: getClusterDrivesOnlineTotalMD(),
|
|
|
|
Value: float64(onlineDrives.Sum()),
|
2021-12-17 13:11:04 -05:00
|
|
|
})
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-12-01 17:31:35 -05:00
|
|
|
Description: getClusterDrivesTotalMD(),
|
|
|
|
Value: float64(totalDrives.Sum()),
|
2021-12-17 13:11:04 -05:00
|
|
|
})
|
|
|
|
return
|
|
|
|
})
|
|
|
|
return mg
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getKMSNodeMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
metricsGroupOpts: opts,
|
2022-07-11 12:17:28 -04:00
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) (metrics []MetricV2) {
|
2022-07-11 12:17:28 -04:00
|
|
|
const (
|
|
|
|
Online = 1
|
|
|
|
Offline = 0
|
|
|
|
)
|
|
|
|
desc := MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: kmsSubsystem,
|
|
|
|
Name: kmsOnline,
|
|
|
|
Help: "Reports whether the KMS is online (1) or offline (0)",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
}
|
|
|
|
_, err := GlobalKMS.Metrics(ctx)
|
|
|
|
if _, ok := kes.IsConnError(err); ok {
|
2024-03-10 05:15:15 -04:00
|
|
|
return []MetricV2{{
|
2022-07-11 12:17:28 -04:00
|
|
|
Description: desc,
|
|
|
|
Value: float64(Offline),
|
|
|
|
}}
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
return []MetricV2{{
|
2022-07-11 12:17:28 -04:00
|
|
|
Description: desc,
|
|
|
|
Value: float64(Online),
|
|
|
|
}}
|
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getWebhookMetrics() *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2023-05-11 14:24:37 -04:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) []MetricV2 {
|
2023-05-11 14:24:37 -04:00
|
|
|
tgts := append(logger.SystemTargets(), logger.AuditTargets()...)
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics := make([]MetricV2, 0, len(tgts)*4)
|
2023-05-11 14:24:37 -04:00
|
|
|
for _, t := range tgts {
|
|
|
|
isOnline := 0
|
|
|
|
if t.IsOnline(ctx) {
|
|
|
|
isOnline = 1
|
|
|
|
}
|
|
|
|
labels := map[string]string{
|
|
|
|
"name": t.String(),
|
|
|
|
"endpoint": t.Endpoint(),
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-05-11 14:24:37 -04:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: webhookSubsystem,
|
|
|
|
Name: webhookOnline,
|
|
|
|
Help: "Is the webhook online?",
|
|
|
|
Type: gaugeMetric,
|
|
|
|
},
|
|
|
|
VariableLabels: labels,
|
|
|
|
Value: float64(isOnline),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-05-11 14:24:37 -04:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: webhookSubsystem,
|
|
|
|
Name: webhookQueueLength,
|
|
|
|
Help: "Webhook queue length",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
VariableLabels: labels,
|
|
|
|
Value: float64(t.Stats().QueueLength),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-05-11 14:24:37 -04:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: webhookSubsystem,
|
|
|
|
Name: webhookTotalMessages,
|
|
|
|
Help: "Total number of messages sent to this target",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
VariableLabels: labels,
|
|
|
|
Value: float64(t.Stats().TotalMessages),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2023-05-11 14:24:37 -04:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: webhookSubsystem,
|
|
|
|
Name: webhookFailedMessages,
|
|
|
|
Help: "Number of messages that failed to send",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
VariableLabels: labels,
|
|
|
|
Value: float64(t.Stats().FailedMessages),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return metrics
|
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func getKMSMetrics(opts MetricsGroupOpts) *MetricsGroupV2 {
|
|
|
|
mg := &MetricsGroupV2{
|
2024-01-10 18:21:52 -05:00
|
|
|
cacheInterval: 10 * time.Second,
|
|
|
|
metricsGroupOpts: opts,
|
2022-07-11 12:17:28 -04:00
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
mg.RegisterRead(func(ctx context.Context) []MetricV2 {
|
|
|
|
metrics := make([]MetricV2, 0, 4)
|
2022-07-11 12:17:28 -04:00
|
|
|
metric, err := GlobalKMS.Metrics(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return metrics
|
|
|
|
}
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-07-11 12:17:28 -04:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: kmsSubsystem,
|
|
|
|
Name: kmsRequestsSuccess,
|
|
|
|
Help: "Number of KMS requests that succeeded",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
Value: float64(metric.RequestOK),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-07-11 12:17:28 -04:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: kmsSubsystem,
|
|
|
|
Name: kmsRequestsError,
|
|
|
|
Help: "Number of KMS requests that failed due to some error. (HTTP 4xx status code)",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
Value: float64(metric.RequestErr),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-07-11 12:17:28 -04:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: kmsSubsystem,
|
|
|
|
Name: kmsRequestsFail,
|
|
|
|
Help: "Number of KMS requests that failed due to some internal failure. (HTTP 5xx status code)",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
Value: float64(metric.RequestFail),
|
|
|
|
})
|
2024-03-10 05:15:15 -04:00
|
|
|
metrics = append(metrics, MetricV2{
|
2022-07-11 12:17:28 -04:00
|
|
|
Description: MetricDescription{
|
|
|
|
Namespace: clusterMetricNamespace,
|
|
|
|
Subsystem: kmsSubsystem,
|
|
|
|
Name: kmsUptime,
|
|
|
|
Help: "The time the KMS has been up and running in seconds.",
|
|
|
|
Type: counterMetric,
|
|
|
|
},
|
|
|
|
Value: metric.UpTime.Seconds(),
|
|
|
|
})
|
|
|
|
|
|
|
|
return metrics
|
|
|
|
})
|
|
|
|
return mg
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func collectMetric(metric MetricV2, labels []string, values []string, metricName string, out chan<- prometheus.Metric) {
|
2023-09-30 16:40:20 -04:00
|
|
|
if metric.Description.Type == histogramMetric {
|
|
|
|
if metric.Histogram == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
for k, v := range metric.Histogram {
|
|
|
|
pmetric, err := prometheus.NewConstMetric(
|
|
|
|
prometheus.NewDesc(
|
|
|
|
prometheus.BuildFQName(string(metric.Description.Namespace),
|
|
|
|
string(metric.Description.Subsystem),
|
|
|
|
string(metric.Description.Name)),
|
|
|
|
metric.Description.Help,
|
|
|
|
append(labels, metric.HistogramBucketLabel),
|
|
|
|
metric.StaticLabels,
|
|
|
|
),
|
|
|
|
prometheus.GaugeValue,
|
|
|
|
float64(v),
|
|
|
|
append(values, k)...)
|
|
|
|
if err != nil {
|
|
|
|
// Enable for debugging
|
|
|
|
if serverDebugLog {
|
2024-04-04 08:04:40 -04:00
|
|
|
bugLogIf(GlobalContext, fmt.Errorf("unable to validate prometheus metric (%w) %v+%v", err, values, metric.Histogram))
|
2023-09-30 16:40:20 -04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
out <- pmetric
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
metricType := prometheus.GaugeValue
|
|
|
|
if metric.Description.Type == counterMetric {
|
|
|
|
metricType = prometheus.CounterValue
|
|
|
|
}
|
|
|
|
pmetric, err := prometheus.NewConstMetric(
|
|
|
|
prometheus.NewDesc(
|
|
|
|
prometheus.BuildFQName(string(metric.Description.Namespace),
|
|
|
|
string(metric.Description.Subsystem),
|
|
|
|
string(metric.Description.Name)),
|
|
|
|
metric.Description.Help,
|
|
|
|
labels,
|
|
|
|
metric.StaticLabels,
|
|
|
|
),
|
|
|
|
metricType,
|
|
|
|
metric.Value,
|
|
|
|
values...)
|
|
|
|
if err != nil {
|
|
|
|
// Enable for debugging
|
|
|
|
if serverDebugLog {
|
2024-04-04 08:04:40 -04:00
|
|
|
bugLogIf(GlobalContext, fmt.Errorf("unable to validate prometheus metric (%w) %v", err, values))
|
2023-09-30 16:40:20 -04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
out <- pmetric
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-19 17:54:46 -05:00
|
|
|
//msgp:ignore minioBucketCollector
|
2023-07-19 01:25:12 -04:00
|
|
|
type minioBucketCollector struct {
|
2024-03-10 05:15:15 -04:00
|
|
|
metricsGroups []*MetricsGroupV2
|
2023-07-19 01:25:12 -04:00
|
|
|
desc *prometheus.Desc
|
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func newMinioBucketCollector(metricsGroups []*MetricsGroupV2) *minioBucketCollector {
|
2023-07-19 01:25:12 -04:00
|
|
|
return &minioBucketCollector{
|
|
|
|
metricsGroups: metricsGroups,
|
|
|
|
desc: prometheus.NewDesc("minio_bucket_stats", "Statistics exposed by MinIO server cluster wide per bucket", nil, nil),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Describe sends the super-set of all possible descriptors of metrics
|
|
|
|
func (c *minioBucketCollector) Describe(ch chan<- *prometheus.Desc) {
|
|
|
|
ch <- c.desc
|
|
|
|
}
|
|
|
|
|
|
|
|
// Collect is called by the Prometheus registry when collecting metrics.
|
|
|
|
func (c *minioBucketCollector) Collect(out chan<- prometheus.Metric) {
|
|
|
|
var wg sync.WaitGroup
|
2024-03-10 05:15:15 -04:00
|
|
|
publish := func(in <-chan MetricV2) {
|
2023-07-19 01:25:12 -04:00
|
|
|
defer wg.Done()
|
|
|
|
for metric := range in {
|
|
|
|
labels, values := getOrderedLabelValueArrays(metric.VariableLabels)
|
2023-09-30 16:40:20 -04:00
|
|
|
collectMetric(metric, labels, values, "bucket", out)
|
2023-07-19 01:25:12 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Call peer api to fetch metrics
|
|
|
|
wg.Add(2)
|
|
|
|
go publish(ReportMetrics(GlobalContext, c.metricsGroups))
|
|
|
|
go publish(globalNotificationSys.GetBucketMetrics(GlobalContext))
|
|
|
|
wg.Wait()
|
|
|
|
}
|
|
|
|
|
2024-02-19 17:54:46 -05:00
|
|
|
//msgp:ignore minioClusterCollector
|
2021-01-18 23:35:38 -05:00
|
|
|
type minioClusterCollector struct {
|
2024-03-10 05:15:15 -04:00
|
|
|
metricsGroups []*MetricsGroupV2
|
2021-12-17 13:11:04 -05:00
|
|
|
desc *prometheus.Desc
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
func newMinioClusterCollector(metricsGroups []*MetricsGroupV2) *minioClusterCollector {
|
2021-01-18 23:35:38 -05:00
|
|
|
return &minioClusterCollector{
|
2021-12-17 13:11:04 -05:00
|
|
|
metricsGroups: metricsGroups,
|
|
|
|
desc: prometheus.NewDesc("minio_stats", "Statistics exposed by MinIO server per cluster", nil, nil),
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Describe sends the super-set of all possible descriptors of metrics
|
|
|
|
func (c *minioClusterCollector) Describe(ch chan<- *prometheus.Desc) {
|
|
|
|
ch <- c.desc
|
|
|
|
}
|
|
|
|
|
|
|
|
// Collect is called by the Prometheus registry when collecting metrics.
|
|
|
|
func (c *minioClusterCollector) Collect(out chan<- prometheus.Metric) {
|
|
|
|
var wg sync.WaitGroup
|
2024-03-10 05:15:15 -04:00
|
|
|
publish := func(in <-chan MetricV2) {
|
2021-01-18 23:35:38 -05:00
|
|
|
defer wg.Done()
|
|
|
|
for metric := range in {
|
|
|
|
labels, values := getOrderedLabelValueArrays(metric.VariableLabels)
|
2023-09-30 16:40:20 -04:00
|
|
|
collectMetric(metric, labels, values, "cluster", out)
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Call peer api to fetch metrics
|
|
|
|
wg.Add(2)
|
2022-06-08 05:43:13 -04:00
|
|
|
go publish(ReportMetrics(GlobalContext, c.metricsGroups))
|
|
|
|
go publish(globalNotificationSys.GetClusterMetrics(GlobalContext))
|
2021-01-18 23:35:38 -05:00
|
|
|
wg.Wait()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ReportMetrics reports serialized metrics to the channel passed for the metrics generated.
|
2024-03-10 05:15:15 -04:00
|
|
|
func ReportMetrics(ctx context.Context, metricsGroups []*MetricsGroupV2) <-chan MetricV2 {
|
|
|
|
ch := make(chan MetricV2)
|
2021-01-18 23:35:38 -05:00
|
|
|
go func() {
|
2024-01-28 13:04:17 -05:00
|
|
|
defer xioutil.SafeClose(ch)
|
2024-03-10 05:15:15 -04:00
|
|
|
populateAndPublish(metricsGroups, func(m MetricV2) bool {
|
2021-01-18 23:35:38 -05:00
|
|
|
if m.VariableLabels == nil {
|
|
|
|
m.VariableLabels = make(map[string]string)
|
|
|
|
}
|
2021-03-26 14:37:58 -04:00
|
|
|
m.VariableLabels[serverName] = globalLocalNodeName
|
2021-01-18 23:35:38 -05:00
|
|
|
for {
|
|
|
|
select {
|
|
|
|
case ch <- m:
|
|
|
|
return true
|
|
|
|
case <-ctx.Done():
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}()
|
|
|
|
return ch
|
|
|
|
}
|
|
|
|
|
2021-12-17 13:11:04 -05:00
|
|
|
// minioNodeCollector is the Custom Collector
|
2024-02-19 17:54:46 -05:00
|
|
|
//
|
|
|
|
//msgp:ignore minioNodeCollector
|
2021-12-17 13:11:04 -05:00
|
|
|
type minioNodeCollector struct {
|
2024-03-10 05:15:15 -04:00
|
|
|
metricsGroups []*MetricsGroupV2
|
2021-12-17 13:11:04 -05:00
|
|
|
desc *prometheus.Desc
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Describe sends the super-set of all possible descriptors of metrics
|
2021-12-17 13:11:04 -05:00
|
|
|
func (c *minioNodeCollector) Describe(ch chan<- *prometheus.Desc) {
|
2021-01-18 23:35:38 -05:00
|
|
|
ch <- c.desc
|
|
|
|
}
|
|
|
|
|
|
|
|
// populateAndPublish populates and then publishes the metrics generated by the generator function.
|
2024-03-10 05:15:15 -04:00
|
|
|
func populateAndPublish(metricsGroups []*MetricsGroupV2, publish func(m MetricV2) bool) {
|
2021-12-17 13:11:04 -05:00
|
|
|
for _, mg := range metricsGroups {
|
|
|
|
if mg == nil {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
for _, metric := range mg.Get() {
|
2021-01-18 23:35:38 -05:00
|
|
|
if !publish(metric) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Collect is called by the Prometheus registry when collecting metrics.
|
2021-12-17 13:11:04 -05:00
|
|
|
func (c *minioNodeCollector) Collect(ch chan<- prometheus.Metric) {
|
2021-01-18 23:35:38 -05:00
|
|
|
// Expose MinIO's version information
|
|
|
|
minioVersionInfo.WithLabelValues(Version, CommitID).Set(1.0)
|
|
|
|
|
2024-03-10 05:15:15 -04:00
|
|
|
populateAndPublish(c.metricsGroups, func(metric MetricV2) bool {
|
2021-01-18 23:35:38 -05:00
|
|
|
labels, values := getOrderedLabelValueArrays(metric.VariableLabels)
|
2021-03-26 14:37:58 -04:00
|
|
|
values = append(values, globalLocalNodeName)
|
2021-01-18 23:35:38 -05:00
|
|
|
labels = append(labels, serverName)
|
|
|
|
|
|
|
|
if metric.Description.Type == histogramMetric {
|
|
|
|
if metric.Histogram == nil {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
for k, v := range metric.Histogram {
|
|
|
|
labels = append(labels, metric.HistogramBucketLabel)
|
|
|
|
values = append(values, k)
|
|
|
|
ch <- prometheus.MustNewConstMetric(
|
|
|
|
prometheus.NewDesc(
|
|
|
|
prometheus.BuildFQName(string(metric.Description.Namespace),
|
|
|
|
string(metric.Description.Subsystem),
|
|
|
|
string(metric.Description.Name)),
|
|
|
|
metric.Description.Help,
|
|
|
|
labels,
|
|
|
|
metric.StaticLabels,
|
|
|
|
),
|
|
|
|
prometheus.GaugeValue,
|
|
|
|
float64(v),
|
|
|
|
values...)
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
metricType := prometheus.GaugeValue
|
2023-03-06 11:56:10 -05:00
|
|
|
if metric.Description.Type == counterMetric {
|
2021-01-18 23:35:38 -05:00
|
|
|
metricType = prometheus.CounterValue
|
|
|
|
}
|
|
|
|
ch <- prometheus.MustNewConstMetric(
|
|
|
|
prometheus.NewDesc(
|
|
|
|
prometheus.BuildFQName(string(metric.Description.Namespace),
|
|
|
|
string(metric.Description.Subsystem),
|
|
|
|
string(metric.Description.Name)),
|
|
|
|
metric.Description.Help,
|
|
|
|
labels,
|
|
|
|
metric.StaticLabels,
|
|
|
|
),
|
|
|
|
metricType,
|
|
|
|
metric.Value,
|
|
|
|
values...)
|
|
|
|
return true
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func getOrderedLabelValueArrays(labelsWithValue map[string]string) (labels, values []string) {
|
2023-05-17 18:14:09 -04:00
|
|
|
labels = make([]string, 0, len(labelsWithValue))
|
|
|
|
values = make([]string, 0, len(labelsWithValue))
|
2021-01-18 23:35:38 -05:00
|
|
|
for l, v := range labelsWithValue {
|
|
|
|
labels = append(labels, l)
|
|
|
|
values = append(values, v)
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-12-17 13:11:04 -05:00
|
|
|
// newMinioCollectorNode describes the collector
|
2021-01-18 23:35:38 -05:00
|
|
|
// and returns reference of minioCollector for version 2
|
|
|
|
// It creates the Prometheus Description which is used
|
|
|
|
// to define Metric and help string
|
2024-03-10 05:15:15 -04:00
|
|
|
func newMinioCollectorNode(metricsGroups []*MetricsGroupV2) *minioNodeCollector {
|
2021-12-17 13:11:04 -05:00
|
|
|
return &minioNodeCollector{
|
|
|
|
metricsGroups: metricsGroups,
|
|
|
|
desc: prometheus.NewDesc("minio_stats", "Statistics exposed by MinIO server per node", nil, nil),
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-30 16:40:20 -04:00
|
|
|
func metricsHTTPHandler(c prometheus.Collector, funcName string) http.Handler {
|
2023-07-19 01:25:12 -04:00
|
|
|
registry := prometheus.NewRegistry()
|
|
|
|
|
|
|
|
// Report all other metrics
|
2023-09-30 16:40:20 -04:00
|
|
|
logger.CriticalIf(GlobalContext, registry.Register(c))
|
2023-07-19 01:25:12 -04:00
|
|
|
|
|
|
|
// DefaultGatherers include golang metrics and process metrics.
|
|
|
|
gatherers := prometheus.Gatherers{
|
|
|
|
registry,
|
|
|
|
}
|
|
|
|
|
|
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
tc, ok := r.Context().Value(mcontext.ContextTraceKey).(*mcontext.TraceCtxt)
|
|
|
|
if ok {
|
2023-09-30 16:40:20 -04:00
|
|
|
tc.FuncName = funcName
|
2023-07-19 01:25:12 -04:00
|
|
|
tc.ResponseRecorder.LogErrBody = true
|
|
|
|
}
|
|
|
|
|
|
|
|
mfs, err := gatherers.Gather()
|
2023-09-30 16:40:20 -04:00
|
|
|
if err != nil && len(mfs) == 0 {
|
|
|
|
writeErrorResponseJSON(r.Context(), w, toAdminAPIErr(r.Context(), err), r.URL)
|
|
|
|
return
|
2023-07-19 01:25:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
contentType := expfmt.Negotiate(r.Header)
|
|
|
|
w.Header().Set("Content-Type", string(contentType))
|
|
|
|
|
|
|
|
enc := expfmt.NewEncoder(w, contentType)
|
|
|
|
for _, mf := range mfs {
|
|
|
|
if err := enc.Encode(mf); err != nil {
|
|
|
|
// client may disconnect for any reasons
|
|
|
|
// we do not have to log this.
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if closer, ok := enc.(expfmt.Closer); ok {
|
|
|
|
closer.Close()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-09-30 16:40:20 -04:00
|
|
|
func metricsBucketHandler() http.Handler {
|
|
|
|
return metricsHTTPHandler(bucketCollector, "handler.MetricsBucket")
|
|
|
|
}
|
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
func metricsServerHandler() http.Handler {
|
|
|
|
registry := prometheus.NewRegistry()
|
|
|
|
|
|
|
|
// Report all other metrics
|
2022-07-01 16:18:39 -04:00
|
|
|
logger.CriticalIf(GlobalContext, registry.Register(clusterCollector))
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2021-01-18 23:35:38 -05:00
|
|
|
// DefaultGatherers include golang metrics and process metrics.
|
|
|
|
gatherers := prometheus.Gatherers{
|
|
|
|
registry,
|
|
|
|
}
|
2021-12-17 13:11:04 -05:00
|
|
|
|
2022-07-01 16:18:39 -04:00
|
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
2022-12-06 12:27:26 -05:00
|
|
|
tc, ok := r.Context().Value(mcontext.ContextTraceKey).(*mcontext.TraceCtxt)
|
2022-07-01 16:18:39 -04:00
|
|
|
if ok {
|
2022-12-06 12:27:26 -05:00
|
|
|
tc.FuncName = "handler.MetricsCluster"
|
|
|
|
tc.ResponseRecorder.LogErrBody = true
|
2022-07-01 16:18:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
mfs, err := gatherers.Gather()
|
2023-09-20 18:49:55 -04:00
|
|
|
if err != nil && len(mfs) == 0 {
|
|
|
|
writeErrorResponseJSON(r.Context(), w, toAdminAPIErr(r.Context(), err), r.URL)
|
|
|
|
return
|
2022-07-01 16:18:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
contentType := expfmt.Negotiate(r.Header)
|
|
|
|
w.Header().Set("Content-Type", string(contentType))
|
|
|
|
|
|
|
|
enc := expfmt.NewEncoder(w, contentType)
|
|
|
|
for _, mf := range mfs {
|
|
|
|
if err := enc.Encode(mf); err != nil {
|
2022-12-15 11:25:05 -05:00
|
|
|
// client may disconnect for any reasons
|
|
|
|
// we do not have to log this.
|
2022-07-01 16:18:39 -04:00
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if closer, ok := enc.(expfmt.Closer); ok {
|
|
|
|
closer.Close()
|
|
|
|
}
|
|
|
|
})
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func metricsNodeHandler() http.Handler {
|
|
|
|
registry := prometheus.NewRegistry()
|
|
|
|
|
2022-07-01 16:18:39 -04:00
|
|
|
logger.CriticalIf(GlobalContext, registry.Register(nodeCollector))
|
|
|
|
if err := registry.Register(prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{
|
2021-01-22 21:30:16 -05:00
|
|
|
Namespace: minioNamespace,
|
|
|
|
ReportErrors: true,
|
2022-07-01 16:18:39 -04:00
|
|
|
})); err != nil {
|
2021-01-22 21:30:16 -05:00
|
|
|
logger.CriticalIf(GlobalContext, err)
|
|
|
|
}
|
2022-07-01 16:18:39 -04:00
|
|
|
if err := registry.Register(prometheus.NewGoCollector()); err != nil {
|
2021-01-22 21:30:16 -05:00
|
|
|
logger.CriticalIf(GlobalContext, err)
|
|
|
|
}
|
2021-01-18 23:35:38 -05:00
|
|
|
gatherers := prometheus.Gatherers{
|
|
|
|
registry,
|
|
|
|
}
|
2022-07-01 16:18:39 -04:00
|
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
2022-12-06 12:27:26 -05:00
|
|
|
tc, ok := r.Context().Value(mcontext.ContextTraceKey).(*mcontext.TraceCtxt)
|
2022-07-01 16:18:39 -04:00
|
|
|
if ok {
|
2022-12-06 12:27:26 -05:00
|
|
|
tc.FuncName = "handler.MetricsNode"
|
|
|
|
tc.ResponseRecorder.LogErrBody = true
|
2022-07-01 16:18:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
mfs, err := gatherers.Gather()
|
|
|
|
if err != nil {
|
|
|
|
if len(mfs) == 0 {
|
|
|
|
writeErrorResponseJSON(r.Context(), w, toAdminAPIErr(r.Context(), err), r.URL)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
contentType := expfmt.Negotiate(r.Header)
|
|
|
|
w.Header().Set("Content-Type", string(contentType))
|
|
|
|
|
|
|
|
enc := expfmt.NewEncoder(w, contentType)
|
|
|
|
for _, mf := range mfs {
|
|
|
|
if err := enc.Encode(mf); err != nil {
|
2024-04-04 08:04:40 -04:00
|
|
|
metricsLogIf(r.Context(), err)
|
2022-07-01 16:18:39 -04:00
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if closer, ok := enc.(expfmt.Closer); ok {
|
|
|
|
closer.Close()
|
|
|
|
}
|
|
|
|
})
|
2021-01-18 23:35:38 -05:00
|
|
|
}
|
2021-10-02 12:31:05 -04:00
|
|
|
|
|
|
|
func toSnake(camel string) (snake string) {
|
|
|
|
var b strings.Builder
|
|
|
|
l := len(camel)
|
|
|
|
for i, v := range camel {
|
|
|
|
// A is 65, a is 97
|
|
|
|
if v >= 'a' {
|
|
|
|
b.WriteRune(v)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
// v is capital letter here
|
|
|
|
// disregard first letter
|
|
|
|
// add underscore if last letter is capital letter
|
|
|
|
// add underscore when previous letter is lowercase
|
|
|
|
// add underscore when next letter is lowercase
|
|
|
|
if (i != 0 || i == l-1) && ((i > 0 && rune(camel[i-1]) >= 'a') ||
|
|
|
|
(i < l-1 && rune(camel[i+1]) >= 'a')) {
|
|
|
|
b.WriteRune('_')
|
|
|
|
}
|
|
|
|
b.WriteRune(v + 'a' - 'A')
|
|
|
|
}
|
|
|
|
return b.String()
|
|
|
|
}
|