nais / nais/api

Add cluster attribute to nais_api_watcher_resources metric

Open Beginner friendly
#411 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.