Skip to content

Commit

Permalink
chore(telemetry): add auth_user
Browse files Browse the repository at this point in the history
  • Loading branch information
snakster committed Dec 12, 2024
1 parent 4890f15 commit 5abab13
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/terramate/cli/cloud_credential_google.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/terramate-io/terramate/cmd/terramate/cli/cliconfig"
"github.com/terramate-io/terramate/cmd/terramate/cli/clitest"
"github.com/terramate-io/terramate/cmd/terramate/cli/out"
tel "github.com/terramate-io/terramate/cmd/terramate/cli/telemetry"
"github.com/terramate-io/terramate/errors"
"github.com/terramate-io/terramate/printer"
)
Expand Down Expand Up @@ -632,6 +633,9 @@ func (g *googleCredential) fetchDetails() error {
}
g.orgs = orgs
g.user = user

tel.DefaultRecord.Set(tel.AuthUser(g.user.UUID))

return nil
}

Expand Down
7 changes: 7 additions & 0 deletions cmd/terramate/cli/telemetry/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ func OrgUUID(orgUUID cloud.UUID) MessageOpt {
}
}

// AuthUser sets the auth user.
func AuthUser(authUser cloud.UUID) MessageOpt {
return func(msg *Message) {
msg.AuthUser = string(authUser)
}
}

// DetectFromEnv detects platform, auth type, signature, architecture and OS from the environment.
func DetectFromEnv(credfile, cpsigfile, anasigfile string) MessageOpt {
return func(msg *Message) {
Expand Down
2 changes: 2 additions & 0 deletions cmd/terramate/cli/telemetry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ const (
type Message struct {
Platform PlatformType `json:"platform,omitempty"`
Auth AuthType `json:"auth,omitempty"`
// AuthUser is the TMC user UUID.
AuthUser string `json:"auth_user,omitempty"`

Signature string `json:"signature,omitempty"`
OrgName string `json:"org_name,omitempty"`
Expand Down

0 comments on commit 5abab13

Please sign in to comment.