Skip to content

Add cluster attribute to nais_api_watcher_resources metric #411

Description

@Starefossen

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions