Skip to content

Expose metric for hard-limited presets #17988

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

Closed
evgeniy-scherbina opened this issue May 22, 2025 · 0 comments · Fixed by #18008
Closed

Expose metric for hard-limited presets #17988

evgeniy-scherbina opened this issue May 22, 2025 · 0 comments · Fixed by #18008
Assignees

Comments

@evgeniy-scherbina
Copy link
Contributor

evgeniy-scherbina commented May 22, 2025

Define a metric to track the number of presets that have reached the hard failure limit

Relates to #17432

@evgeniy-scherbina evgeniy-scherbina self-assigned this May 22, 2025
@evgeniy-scherbina evgeniy-scherbina changed the title Define a metric to track the number of presets that have reached the hard failure limit. Define a metric to track the number of presets that have reached the hard failure limit May 22, 2025
@evgeniy-scherbina evgeniy-scherbina changed the title Define a metric to track the number of presets that have reached the hard failure limit Expose metric for hard-limited presets May 22, 2025
evgeniy-scherbina added a commit that referenced this issue May 26, 2025
Closes #17988

Define `preset_hard_limited` metric which for every preset indicates
whether a given preset has reached the hard failure limit (1 for
hard-limited, 0 otherwise).

CLI example:
```
curl -X GET localhost:2118/metrics | grep preset_hard_limited
# HELP coderd_prebuilt_workspaces_preset_hard_limited Indicates whether a given preset has reached the hard failure limit (1 for hard-limited, 0 otherwise).
# TYPE coderd_prebuilt_workspaces_preset_hard_limited gauge
coderd_prebuilt_workspaces_preset_hard_limited{organization_name="coder",preset_name="GoLand: Large",template_name="Test7"} 1
coderd_prebuilt_workspaces_preset_hard_limited{organization_name="coder",preset_name="GoLand: Large",template_name="ValidTemplate"} 0
coderd_prebuilt_workspaces_preset_hard_limited{organization_name="coder",preset_name="IU: Medium",template_name="Test7"} 1
coderd_prebuilt_workspaces_preset_hard_limited{organization_name="coder",preset_name="IU: Medium",template_name="ValidTemplate"} 0
coderd_prebuilt_workspaces_preset_hard_limited{organization_name="coder",preset_name="WS: Small",template_name="Test7"} 1
```

NOTE:
```go
if !ps.Preset.Deleted && ps.Preset.UsingActiveVersion {
	c.metrics.trackHardLimitedStatus(ps.Preset.OrganizationName, ps.Preset.TemplateName, ps.Preset.Name, ps.IsHardLimited)
}
```

Only active template version is tracked. If admin creates new template
version - old value of metric (for previous template version) will be
overwritten with new value of metric (for active template version).
Because `template_version` is not part of metric:
```go
labels = []string{"template_name", "preset_name", "organization_name"}
```

Implementation is similar to implementation of
`MetricResourceReplacementsCount` metric

---------

Co-authored-by: Susana Ferreira <ssncferreira@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant