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

Split scheduler metrics by resource #3425

Merged
merged 9 commits into from
Mar 6, 2024
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
4 changes: 4 additions & 0 deletions config/scheduler/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ schedulerMetrics:
- "memory"
- "ephemeral-storage"
- "nvidia.com/gpu"
resourceRenaming:
nvidia.com/gpu: "gpu"
amd.com/gpu: "gpu"
ephemeral-storage: "ephemeralStorage"
matchedRegexIndexByErrorMessageCacheSize: 100
resetInterval: "1h"
pulsar:
Expand Down
6 changes: 6 additions & 0 deletions internal/scheduler/configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ type MetricsConfig struct {
TrackedErrorRegexes []string
// Metrics are exported for these resources.
TrackedResourceNames []v1.ResourceName
// Optionally rename resources in exported metrics.
// E.g., if ResourceRenaming["nvidia.com/gpu"] = "gpu", then metrics for resource "nvidia.com/gpu" use resource name "gpu" instead.
// This can be used to avoid illegal Prometheus metric names (e.g., for "nvidia.com/gpu" as "/" is not allowed).
// Allowed characters in resource names are [a-zA-Z_:][a-zA-Z0-9_:]*
// It can also be used to track multiple resources within the same metric, e.g., "nvidia.com/gpu" and "amd.com/gpu".
ResourceRenaming map[v1.ResourceName]string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're using the validator package for config validation elsewhere. https://pkg.go.dev/github.com/go-playground/validator/v10#section-readme
Could you use this pre-defined regex to validate that these metric names are valid? https://github.com/go-playground/validator/blob/v10.19.0/regexes.go#L7

Copy link
Collaborator Author

@Mo-Fatah Mo-Fatah Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't include underscores or colons. Also, it allows a resource that starts with a digit, which prometheus will reject later in the metric name.

most tracked resources don't include underscores or colons themselves, however this might reject valid resource names or accept invalid ones in the future.

The regex i added acts the same way as prometheus naming check (in the current version we are using ) https://github.com/prometheus/common/blob/49b36038aead362ce78f09337dc5872000bd048a/model/metric.go#L97

Copy link
Collaborator Author

@Mo-Fatah Mo-Fatah Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can use that function IsValidMetricName if you want to delegate the check to prometheus

// Controls the cycle time metrics.
// TODO(albin): Not used yet.
CycleTimeConfig PrometheusSummaryConfig
Expand Down
Loading
Loading