From 7d95eac22c817ebcf8fab0529986a15307c90a32 Mon Sep 17 00:00:00 2001 From: ramya18101 Date: Mon, 31 Aug 2026 08:40:22 +0530 Subject: [PATCH] feat: add tenant domain to Heap command tracking properties --- internal/cli/root.go | 1 + internal/cli/root_test.go | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/internal/cli/root.go b/internal/cli/root.go index 0d818c088..3a67a895e 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -379,6 +379,7 @@ func commandTrackingProperties(cli *cli) map[string]string { "forced": boolString(cli.force), "agent_client": cli.agentClientName(), "is_api": boolString(isAPICommand(cli.executedCommandPath)), + "tenant": cli.tenant, } } diff --git a/internal/cli/root_test.go b/internal/cli/root_test.go index e23b2a460..21c045007 100644 --- a/internal/cli/root_test.go +++ b/internal/cli/root_test.go @@ -179,6 +179,20 @@ func TestIsAPICommand(t *testing.T) { } } +func TestCommandTrackingProperties(t *testing.T) { + t.Run("includes tenant domain when authenticated", func(t *testing.T) { + c := &cli{tenant: "example.us.auth0.com", renderer: &display.Renderer{}} + props := commandTrackingProperties(c) + assert.Equal(t, "example.us.auth0.com", props["tenant"]) + }) + + t.Run("includes empty tenant when unauthenticated", func(t *testing.T) { + c := &cli{tenant: "", renderer: &display.Renderer{}} + props := commandTrackingProperties(c) + assert.Equal(t, "", props["tenant"]) + }) +} + func TestMergeProperties(t *testing.T) { base := map[string]string{"interactive": "true", "success": "true"} override := map[string]string{"success": "false", "error_class": "auth"}