feat: add Prometheus metrics for license warnings and errors (#21749)

Fixes: coder/internal#767

Adds two new Prometheus metrics for license health monitoring:

- `coderd_license_warnings` - count of active license warnings
- `coderd_license_errors` - count of active license errors

Metrics endpoint after startup of a deployment with license enabled:

```
...
# HELP coderd_license_errors The number of active license errors.
# TYPE coderd_license_errors gauge
coderd_license_errors 0
...
# HELP coderd_license_warnings The number of active license warnings.
# TYPE coderd_license_warnings gauge
coderd_license_warnings 0
...
```
This commit is contained in:
Marcin Tojek
2026-01-29 13:50:15 +01:00
committed by GitHub
parent 06e396188f
commit 04b0253e8a
6 changed files with 164 additions and 10 deletions
+6
View File
@@ -162,6 +162,12 @@ func (l *Set) Errors() []string {
return slices.Clone(l.entitlements.Errors)
}
func (l *Set) Warnings() []string {
l.entitlementsMu.RLock()
defer l.entitlementsMu.RUnlock()
return slices.Clone(l.entitlements.Warnings)
}
func (l *Set) HasLicense() bool {
l.entitlementsMu.RLock()
defer l.entitlementsMu.RUnlock()