Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for interface conversion at metrics helper #546

Merged
merged 1 commit into from
Oct 17, 2023

Conversation

shaheerkootteeri
Copy link
Contributor

@shaheerkootteeri shaheerkootteeri commented Oct 17, 2023

What this PR does / why we need it

PR fixes a interface conversion issue that was causing the plugin commands to fail with error interface conversion: interface {} is nil, not string when the user has just orgID as the active context.
Tanzu CLI version : 1.1.0-alpha.0

Which issue(s) this PR fixes

Fixes #

Describe testing done for PR

make test was successful. Also validated the changes in local with just OrgId as active context.
image

Release note


Additional information

Special notes for your reviewer

Upon running plugin commands core CLI was throwing error below

panic: interface conversion: interface {} is nil, not string

goroutine 1 [running]:
github.com/vmware-tanzu/tanzu-cli/pkg/telemetry.computeEndpointSHAForTAEContext(0x1400010d980)
	/go/src/cayman_tanzu-cli/tanzu-cli/src/pkg/telemetry/metrics_helper.go:64 +0x1f8
github.com/vmware-tanzu/tanzu-cli/pkg/telemetry.computeEndpointSHAForContext(0x14001607ae0?, {0x14001308816?, 0x14001607b28?})
	/go/src/cayman_tanzu-cli/tanzu-cli/src/pkg/telemetry/metrics_helper.go:41 +0xa0
github.com/vmware-tanzu/tanzu-cli/pkg/telemetry.getEndpointSHA(0x14000d84ab0)
	/go/src/cayman_tanzu-cli/tanzu-cli/src/pkg/telemetry/metrics_helper.go:27 +0x54
github.com/vmware-tanzu/tanzu-cli/pkg/telemetry.(*telemetryClient).updateMetricsForPlugin(0x1400068e9c0, 0x14000d86600, {0x14000d834d0, 0x1, 0x1}, {0x140005ce450?, 0x10602349b?})
	/go/src/cayman_tanzu-cli/tanzu-cli/src/pkg/telemetry/client.go:221 +0x268
github.com/vmware-tanzu/tanzu-cli/pkg/telemetry.(*telemetryClient).UpdateCmdPreRunMetrics(0x14001607c98?, 0x14000d86600, {0x14000d834d0, 0x1, 0x1})
	/go/src/cayman_tanzu-cli/tanzu-cli/src/pkg/telemetry/client.go:116 +0x258
github.com/vmware-tanzu/tanzu-cli/pkg/command.newRootCmd.func1(0x14001607d68?, {0x14000d834d0, 0x1, 0x1})
	/go/src/cayman_tanzu-cli/tanzu-cli/src/pkg/command/root.go:145 +0x60
github.com/spf13/cobra.(*Command).execute(0x14000d86600, {0x14000d834d0, 0x1, 0x1})
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:915 +0x4fc
github.com/spf13/cobra.(*Command).ExecuteC(0x1400062cc00)
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x35c
github.com/spf13/cobra.(*Command).Execute(...)
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:992
github.com/vmware-tanzu/tanzu-cli/pkg/command.Execute()
	/go/src/cayman_tanzu-cli/tanzu-cli/src/pkg/command/root.go:369 +0x28
main.main()
	/go/src/cayman_tanzu-cli/tanzu-cli/src/cmd/tanzu/main.go:15 +0x1c

Copy link
Contributor

@marckhouzam marckhouzam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @shaheerkootteeri !
Sorry we missed this.
LGTM

Copy link
Contributor

@prkalle prkalle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks

@anujc25 anujc25 merged commit 9926648 into vmware-tanzu:main Oct 17, 2023
vuil pushed a commit to vuil/tanzu-cli that referenced this pull request Oct 17, 2023
@marckhouzam marckhouzam added this to the 1.1.0 milestone Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants