Add cluster attribute to nais_api_watcher_resources metric
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 3
- Forks
- 2
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 17
Description
Problem
nais_api_watcher_resources only has type and action attributes. We cannot filter or group resource counts by cluster in dashboards.
Suggestion
The cluster string is already available in add(), remove(), and update() in internal/kubernetes/watcher/watcher.go — just pass it as an attribute:
w.resourceCounter.Add(context.TODO(), 1, metric.WithAttributes(
attribute.String("type", w.watchedType),
attribute.String("action", "add"),
attribute.String("cluster", cluster), // <-- add this
))
Same change in remove() and update().
Why
This enables tenant dashboards to show per-cluster resource adoption (apps, topics, CloudSQL, buckets, valkey, opensearch) without needing a separate query per cluster.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in internal/kubernetes/watcher/watcher.go and inspect add(), remove(), and update(), where the resource counter is recorded. Add the existing cluster value to each metric call, then verify that nais_api_watcher_resources exposes type, action, and cluster for all three operations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 86/100