Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for resource metrics #4689

Merged
merged 3 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions cmd/admin-prometheus-generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ import (
)

const (
defaultJobName = "minio-job"
nodeJobName = "minio-job-node"
bucketJobName = "minio-job-bucket"
defaultMetricsPath = "/minio/v2/metrics/cluster"
nodeMetricsPath = "/minio/v2/metrics/node"
bucketMetricsPath = "/minio/v2/metrics/bucket"
defaultJobName = "minio-job"
nodeJobName = "minio-job-node"
bucketJobName = "minio-job-bucket"
defaultMetricsPath = "/minio/v2/metrics/cluster"
nodeMetricsPath = "/minio/v2/metrics/node"
bucketMetricsPath = "/minio/v2/metrics/bucket"
resourceJobName = "minio-job-resource"
resourceMetricsPath = "/minio/v2/metrics/resource"
)

var prometheusFlags = []cli.Flag{
Expand Down Expand Up @@ -75,6 +77,9 @@ EXAMPLES:

3. Generate prometheus config for bucket metrics.
{{.Prompt}} {{.HelpName}} play bucket

4. Generate prometheus config for resource metrics.
{{.Prompt}} {{.HelpName}} play resource
`,
}

Expand Down Expand Up @@ -189,6 +194,20 @@ func generatePrometheusConfig(ctx *cli.Context) error {
},
},
}
case "resource":
config = PrometheusConfig{
ScrapeConfigs: []ScrapeConfig{
{
JobName: resourceJobName,
MetricsPath: resourceMetricsPath,
StaticConfigs: []StatConfig{
{
Targets: []string{""},
},
},
},
},
}
case "", "cluster":
config = PrometheusConfig{
ScrapeConfigs: []ScrapeConfig{
Expand Down
7 changes: 5 additions & 2 deletions cmd/admin-prometheus-metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ USAGE:
{{.HelpName}} TARGET [METRIC-TYPE]

METRIC-TYPE:
valid values are ['cluster', 'node', 'bucket']. Defaults to 'cluster' if not specified.
valid values are ['cluster', 'node', 'bucket', 'resource']. Defaults to 'cluster' if not specified.
anjalshireesh marked this conversation as resolved.
Show resolved Hide resolved

FLAGS:
{{range .VisibleFlags}}{{.}}
Expand All @@ -56,6 +56,9 @@ EXAMPLES:

3. List of metrics reported at bucket level.
{{.Prompt}} {{.HelpName}} play bucket

4. List of resource metrics.
{{.Prompt}} {{.HelpName}} play resource
`,
}

Expand Down Expand Up @@ -91,7 +94,7 @@ func printPrometheusMetrics(ctx *cli.Context) error {
}
metricsSubSystem := args.Get(1)
switch metricsSubSystem {
case "node", "bucket", "cluster":
case "node", "bucket", "cluster", "resource":
case "":
metricsSubSystem = "cluster"
default:
Expand Down
Loading