-
Notifications
You must be signed in to change notification settings - Fork 406
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
feat: add org shape and dev hub id to telemetry #5939
Conversation
const authInfo = await AuthInfo.create({ username }); | ||
|
||
const authInfoFields = authInfo.getFields(); | ||
return authInfoFields.instanceUrl?.includes('sandbox') || false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the best way I found to identify a sandbox. I have tried other solutions such as AuthInfo.isSandBox and Org.isSandbox() but they did not work as expected. I found the sandbox instanceUrl always works for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mingxuanzhangsfdx what do you mean by did not work as expected? Searching URLs for sandbox is not guaranteed over time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the isSandbox returns false when I literally use a sandbox org.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sandbox property is a bit complicated. These CLI commands
org create sandbox │ Create a sandbox org.
org delete sandbox │ Delete a sandbox.
org refresh sandbox │ Refresh a sandbox org using the sandbox name.
org resume sandbox
and when managing sandboxes the property is only set when these commands are used.
Another option that might be used in combination with isSandbox is to query the Organization in the org in question.
It has a field called isSandbox, which is set during sandbox creation.
packages/salesforcedx-utils-vscode/src/telemetry/reporters/appInsights.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mingxuanzhangsfdx this file should be in utils-vscode.
Also consider using a union type instead of enum.
I know it is here due to proximity to workspace utils, so maybe move the type to utils-vscode and retain logic here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I was able to verify new data in appinsights ✅
const authInfo = await AuthInfo.create({ username }); | ||
|
||
const authInfoFields = authInfo.getFields(); | ||
return authInfoFields.instanceUrl?.includes('sandbox') || false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sandbox property is a bit complicated. These CLI commands
org create sandbox │ Create a sandbox org.
org delete sandbox │ Delete a sandbox.
org refresh sandbox │ Refresh a sandbox org using the sandbox name.
org resume sandbox
and when managing sandboxes the property is only set when these commands are used.
Another option that might be used in combination with isSandbox is to query the Organization in the org in question.
It has a field called isSandbox, which is set during sandbox creation.
|
||
export const getOrgShape = async (username: string): Promise<OrgShape> => { | ||
if (workspaceUtils.hasRootWorkspace()) { | ||
if (await OrgAuthInfo.isAScratchOrg(username)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if it is a scratch org first since the implementation of isASandboxOrg return true when it is a scratch org.
What does this PR do?
This PR adds the org shape and dev hub id field to the telemetry including customEvents and exceptions.
What issues does this PR fix or reference?
@W-17148345@
Functionality Before
No fields of org shape and dev hub id.
Functionality After
fields of org shape will show up if the project is connected to an org, and dev hub id will show up if the org is scratch.