Skip to content

Commit 471619f

Browse files
committed
fix(042): show DO_NOT_TRACK and CI override reason in telemetry status
Related #42 Previously `mcpproxy telemetry status` only checked MCPPROXY_TELEMETRY=false for the env override flag. Now it uses the same precedence chain as the service itself (DO_NOT_TRACK > CI > MCPPROXY_TELEMETRY) and reports the specific override reason in both the table and JSON outputs.
1 parent 0042eb8 commit 471619f

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

cmd/mcpproxy/telemetry_cmd.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ import (
1616

1717
// TelemetryStatus holds status data for display.
1818
type TelemetryStatus struct {
19-
Enabled bool `json:"enabled"`
20-
AnonymousID string `json:"anonymous_id,omitempty"`
21-
Endpoint string `json:"endpoint"`
22-
EnvOverride bool `json:"env_override,omitempty"`
19+
Enabled bool `json:"enabled"`
20+
AnonymousID string `json:"anonymous_id,omitempty"`
21+
Endpoint string `json:"endpoint"`
22+
EnvOverride bool `json:"env_override,omitempty"`
23+
EnvOverrideName string `json:"env_override_name,omitempty"`
2324
}
2425

2526
// GetTelemetryCommand returns the telemetry management command.
@@ -118,8 +119,11 @@ func runTelemetryStatus(cmd *cobra.Command, _ []string) error {
118119
status.AnonymousID = id
119120
}
120121

121-
if os.Getenv("MCPPROXY_TELEMETRY") == "false" {
122+
// Spec 042: env vars override config (DO_NOT_TRACK > CI > MCPPROXY_TELEMETRY).
123+
if disabled, reason := telemetry.IsDisabledByEnv(); disabled {
122124
status.EnvOverride = true
125+
status.EnvOverrideName = string(reason)
126+
status.Enabled = false
123127
}
124128

125129
format := clioutput.ResolveFormat(globalOutputFormat, globalJSONOutput)
@@ -148,7 +152,7 @@ func runTelemetryStatus(cmd *cobra.Command, _ []string) error {
148152
}
149153
fmt.Printf(" %-14s %s\n", "Status:", enabledStr)
150154
if status.EnvOverride {
151-
fmt.Printf(" %-14s %s\n", "Override:", "MCPPROXY_TELEMETRY=false")
155+
fmt.Printf(" %-14s %s\n", "Override:", status.EnvOverrideName)
152156
}
153157
if status.AnonymousID != "" {
154158
fmt.Printf(" %-14s %s\n", "Anonymous ID:", status.AnonymousID)

0 commit comments

Comments
 (0)