Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(metrics): forbid installation_id as a metric label (MUL-5894) (#6597)
Xichang(Seacen) Zhaob32cd8c8ac38
diff --git a/server/internal/metrics/labels.go b/server/internal/metrics/labels.goindex fd9cc23a8b..b6fcf9ae9d 100644--- a/server/internal/metrics/labels.go+++ b/server/internal/metrics/labels.go@@ -90,13 +90,19 @@ var businessMetricLabels = map[string][]string{var forbiddenMetricLabels = map[string]struct{}{"workspace_id": {},- "user_id": {},- "agent_id": {},- "task_id": {},- "issue_id": {},- "runtime_id": {},- "session_id": {},- "ip": {},+ // installation_id is the same class as the rest: one series per channel+ // installation, growing with tenants rather than with the deployment. It+ // is also the natural thing to reach for in any channel metric — every+ // adapter call site already carries one — which is what makes leaving it+ // off this list a matter of time rather than of luck.+ "installation_id": {},+ "user_id": {},+ "agent_id": {},+ "task_id": {},+ "issue_id": {},+ "runtime_id": {},+ "session_id": {},+ "ip": {},}var (diff --git a/server/internal/metrics/labels_test.go b/server/internal/metrics/labels_test.goindex d4b6a917cc..2d5985d0fe 100644--- a/server/internal/metrics/labels_test.go+++ b/server/internal/metrics/labels_test.go@@ -41,3 +41,16 @@ func TestNormalizeLabelsCollapseUnknownValues(t *testing.T) {t.Fatalf("NormalizeTaskSource unknown = %q, want other", got)}}++// TestForbiddenLabelsCoverChannelIdentifiers: the channel adapters (slack,+// lark, dingtalk, wecom) all carry an installation id at every metric call+// site, so it is the natural label to reach for. One series per installation+// grows with tenants, not with the deployment — the same reason workspace_id+// and session_id are on this list.+func TestForbiddenLabelsCoverChannelIdentifiers(t *testing.T) {+ for _, label := range []string{"installation_id", "workspace_id", "session_id"} {+ if _, forbidden := forbiddenMetricLabels[label]; !forbidden {+ t.Errorf("%s is not forbidden — a per-tenant identifier will eventually be used as a metric label and multiply the series count by the tenant count", label)+ }+ }+}