Skip to content

Commit

Permalink
Change endpoint to /logger/webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
anjalshireesh committed May 7, 2024
1 parent 3268d66 commit 7f4bc60
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 25 deletions.
2 changes: 2 additions & 0 deletions cmd/metrics-v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ const (
kmsRequestsError = "request_error"
kmsRequestsFail = "request_failure"
kmsUptime = "uptime"

webhookOnline = "online"
)

const (
Expand Down
15 changes: 3 additions & 12 deletions cmd/metrics-v3-cluster-webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
)

const (
webhookOnline = "online"
webhookQueueLength = "queue_length"
webhookTotalMessages = "total_messages"
webhookFailedMessages = "failed_messages"
Expand All @@ -33,10 +32,7 @@ const (
)

var (
allWebhookLabels = []string{nameL, endpointL}
webhookOnlineMD = NewGaugeMD(webhookOnline,
"Is the webhook online?",
allWebhookLabels...)
allWebhookLabels = []string{nameL, endpointL}
webhookFailedMessagesMD = NewCounterMD(webhookFailedMessages,
"Number of messages that failed to send",
allWebhookLabels...)
Expand All @@ -48,17 +44,12 @@ var (
allWebhookLabels...)
)

// loadClusterWebhookMetrics - `MetricsLoaderFn` for cluster webhook
// loadLoggerWebhookMetrics - `MetricsLoaderFn` for logger webhook
// such as failed messages and total messages.
func loadClusterWebhookMetrics(ctx context.Context, m MetricValues, c *metricsCache) error {
func loadLoggerWebhookMetrics(ctx context.Context, m MetricValues, c *metricsCache) error {
tgts := append(logger.SystemTargets(), logger.AuditTargets()...)
for _, t := range tgts {
isOnline := 0
if t.IsOnline(ctx) {
isOnline = 1
}
labels := []string{nameL, t.String(), endpointL, t.Endpoint()}
m.Set(webhookOnline, float64(isOnline), labels...)
m.Set(webhookFailedMessages, float64(t.Stats().FailedMessages), labels...)
m.Set(webhookQueueLength, float64(t.Stats().QueueLength), labels...)
m.Set(webhookTotalMessages, float64(t.Stats().TotalMessages), labels...)
Expand Down
8 changes: 4 additions & 4 deletions cmd/metrics-v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ const (
clusterAuditCollectorPath collectorPath = "/cluster/audit"
clusterNotificationCollectorPath collectorPath = "/cluster/notification"
clusterIAMCollectorPath collectorPath = "/cluster/iam"
clusterWebhookCollectorPath collectorPath = "/cluster/webhook"

loggerWebhookCollectorPath collectorPath = "/logger/webhook"
)

const (
Expand Down Expand Up @@ -300,14 +301,13 @@ func newMetricGroups(r *prometheus.Registry) *metricsV3Collection {
loadClusterIAMMetrics,
)

clusterWebhookMG := NewMetricsGroup(clusterWebhookCollectorPath,
clusterWebhookMG := NewMetricsGroup(loggerWebhookCollectorPath,
[]MetricDescriptor{
webhookFailedMessagesMD,
webhookOnlineMD,
webhookQueueLengthMD,
webhookTotalMessagesMD,
},
loadClusterWebhookMetrics,
loadLoggerWebhookMetrics,
)

allMetricGroups := []*MetricsGroup{
Expand Down
17 changes: 8 additions & 9 deletions docs/metrics/v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,6 @@ The standard metrics group for GoCollector is not shown below.
| `minio_cluster_audit_target_queue_length` | `gauge` | Number of unsent messages in queue for target | `target_id` |
| `minio_cluster_audit_total_messages` | `counter` | Total number of messages sent since start | `target_id` |

### `/cluster/webhook`

| Name | Type | Help | Labels |
|-----------------------------------------|-----------|----------------------------------------------|-----------------|
| `minio_cluster_webhook_failed_messages` | `counter` | Number of messages that failed to send | `name,endpoint` |
| `minio_cluster_webhook_online` | `gauge` | Is the webhook online? | `name,endpoint` |
| `minio_cluster_webhook_queue_length` | `gauge` | Webhook queue length | `name,endpoint` |
| `minio_cluster_webhook_total_message` | `counter` | Total number of messages sent to this target | `name,endpoint` |

### `/cluster/usage/objects`

| Name | Type | Help | Labels |
Expand Down Expand Up @@ -277,3 +268,11 @@ The standard metrics group for GoCollector is not shown below.
| `minio_cluster_iam_since_last_sync_millis` | `counter` | Time (in milliseconds) since last successful IAM data sync | |
| `minio_cluster_iam_sync_failures` | `counter` | Number of failed IAM data syncs since server start | |
| `minio_cluster_iam_sync_successes` | `counter` | Number of successful IAM data syncs since server start | |

### `/logger/webhook`

| Name | Type | Help | Labels |
|-----------------------------------------|-----------|----------------------------------------------|------------------------|
| `minio_logger_webhook_failed_messages` | `counter` | Number of messages that failed to send | `server,name,endpoint` |
| `minio_logger_webhook_queue_length` | `gauge` | Webhook queue length | `server,name,endpoint` |
| `minio_logger_webhook_total_message` | `counter` | Total number of messages sent to this target | `server,name,endpoint` |

0 comments on commit 7f4bc60

Please sign in to comment.