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

telemetry: Improve config info object format #8600

Merged
merged 1 commit into from
Sep 20, 2023
Merged

Conversation

FredKSchott
Copy link
Member

Changes

  • Removes outdated/unused/broken data from the ASTRO_CLI_SESSION_STARTED telemetry event
  • Adds a new, more generic config info base object using "is set" boolean checks
  • Adds more protection with measureX helper functions that prevent raw user input collective with input checking, type errors, and centralized sanitization logic.

Testing

  • Tests updated.

Docs

@FredKSchott FredKSchott requested a review from a team as a code owner September 19, 2023 18:20
@changeset-bot
Copy link

changeset-bot bot commented Sep 19, 2023

🦋 Changeset detected

Latest commit: 057f40f

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Sep 19, 2023
Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

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

Changes look good! I appreciate the typesafety updates.

packages/astro/src/core/config/schema.ts Show resolved Hide resolved
Comment on lines +95 to +97
const inlineConfig = flagsToAstroInlineConfig(flags);
const { userConfig } = await resolveConfig(inlineConfig, 'add');
telemetry.record(eventCliSession('add', userConfig));
Copy link
Member

Choose a reason for hiding this comment

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

Is the current config actually important to record here?

Copy link
Member

Choose a reason for hiding this comment

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

I don't have a problem if this info is statistically useful, but it seems like we'll get final data when users run dev or the build so would err on the side of not recording this.

Copy link
Member Author

Choose a reason for hiding this comment

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

This was the one command that wasn't reading config, which meant the entire eventCliSession command had to handle a potentially undefined config object.

This is still useful data to better understand how astro add is used, similar to any other command.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can pass an empty user config object instead so we don't have to load the entire thing? e.g. telemetry.record(eventCliSession('add', {}))

Copy link
Member Author

Choose a reason for hiding this comment

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

Is the reason that we don't track it here because it's slow?

I see approvals so I'll merge but happy to revisit this post-PR if there's still interest in removing!

packages/astro/src/core/config/schema.ts Show resolved Hide resolved
packages/astro/src/core/config/schema.ts Show resolved Hide resolved
Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

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

Questions withdrawn because I know how to Google.

Nothing blocking, the one comment I left is up to your discretion.

packages/astro/src/core/config/schema.ts Show resolved Hide resolved
Comment on lines +95 to +97
const inlineConfig = flagsToAstroInlineConfig(flags);
const { userConfig } = await resolveConfig(inlineConfig, 'add');
telemetry.record(eventCliSession('add', userConfig));
Copy link
Member

Choose a reason for hiding this comment

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

I don't have a problem if this info is statistically useful, but it seems like we'll get final data when users run dev or the build so would err on the side of not recording this.

@FredKSchott FredKSchott merged commit ed54d46 into main Sep 20, 2023
@FredKSchott FredKSchott deleted the telemetry-audit-3 branch September 20, 2023 16:50
@astrobot-houston astrobot-houston mentioned this pull request Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants