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

[x-license] Introduce usage telemetry #13530

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

hasdfa
Copy link
Member

@hasdfa hasdfa commented Jun 18, 2024

Goals

  • More visibility into MUI X feature usage
  • Better prioritization
  • Collecting more feedback from users

Background

MUI X was released almost 4 years ago, and the library has grown considerably in these 4 years, from new features to better defaults for all users. The way that we've been approaching this improvement process has been very much a manual one.

We're at MUI using the advanced components in some of our applications and plan to extend its usage across our codebases to dogfood MUI X internally more and make improvements based on our experiences.

On top of that, we actively engage with the community to gather feedback. For example, which components or features do you use mostly, ways to customise components, and more. This feedback is extremely valuable in steering feature development for MUI X.

However, there is a problem with this approach, which is that we can only collect feedback from a subset of users. This subset may have different needs and use-cases than you.

For this reason, we're currently exploring a more automated approach to collecting these points of feedback so that we can improve MUI X even more in the near future.

Furthermore, this will allow us to verify if improvements made to the components are improving the baseline of all applications.

Proposal

We're planning to add anonymized telemetry to the MUI X during the development process (excluding NODE_ENV=production). We'll provide an optional opt-out through an environment variable or CLI command. For the start, it will be disabled by default for all users with the ability to opt-in so we would be able to test it.

When enabled the CLI will collect telemetry at development and build time, when telemetry is collected we'll show a message explaining that telemetry is being collected with a link to documentation.

When telemetry is collected it'll be possible to add a flag to see the exact values being sent. These values, as said before, will be completely anonymized.

Its focus is on complete anonymity, and allows users to opt-in to send anonymous data (by default, it's disabled now).

Once the initial implementation has landed, we can investigate exposing the results to the community through public dashboards.

Demo preview

There's quite a few open source projects that take a similar approach, most notably:

@hasdfa hasdfa added new feature New feature or request package: x-license Specific to @mui/x-license. MUI X labels Jun 18, 2024
@hasdfa hasdfa self-assigned this Jun 18, 2024
@mui-bot
Copy link

mui-bot commented Jun 18, 2024

Deploy preview: https://deploy-preview-13530--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against c167280

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jun 18, 2024
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

…emetry

# Conflicts:
#	packages/x-license/package.json
#	pnpm-lock.yaml
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jun 20, 2024
Copy link
Member

@cherniavskii cherniavskii left a comment

Choose a reason for hiding this comment

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

Thank you for working on this! 🎉

Comment on lines 15 to 19
import { ponyfillGlobal } from "@mui/utils";

ponyfillGlobal.__MUI_X_TELEMETRY_ENABLED__ = true;
// or
ponyfillGlobal.__MUI_X_TELEMETRY_DISABLED__ = true;
Copy link
Member

Choose a reason for hiding this comment

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

Instead of exposing ponyfillGlobal, I would prefer exporting a function from @mui/x-telemetry:

import { setTelemetryStatus } from "@mui/x-telemetry";

setTelemetryStatus(true);
// or
setTelemetryStatus(false);

WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, we would have this ability, which I've also documented in the readme file.

import { muiXTelemetrySettings } from '@mui/x-telemetry';

muiXTelemetrySettings.enableTelemetry();
// or
muiXTelemetrySettings.disableTelemetry();

The main problem why I've added the option with setting on the global object, is that in some cases when you would install only @mui/x-data-grid-pro, some package managers (as pnpm) would not allow you to access @mui/x-telemetry package without adding it to your package.json:

Copy link
Member

Choose a reason for hiding this comment

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

In the next major version, people using a commercial package will have to set their license using @mui/x-license, they won't be able to do it through the commercial package.
And as you said they will have to install @mui/x-license explicitly when using pnpm.

So if you need to expose something, you can always re-export it from @mui/x-license 👍
As long as the name is explicit enough outside of the telemetry package.

Copy link
Member

Choose a reason for hiding this comment

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

@flaviendelangle Yeah, this makes sense 👍🏻
However, this would only work for commercial users, while the telemetry should also cover non-commercial users, right?

Copy link
Member

Choose a reason for hiding this comment

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

@mui/x-telemetry being a dep of @mui/x-license in this package and not a dep of the other packages, I took for granted that it was only targeting commercial users.
But if this is not the case then you are entirely right.

Copy link
Member

Choose a reason for hiding this comment

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

@mui/x-telemetry being a dep of @mui/x-license in this package and not a dep of the other packages, I took for granted that it was only targeting commercial users.

I didn't notice this and assumed that we were targeting all users 😅
Anyway, it's good that this question came up!
@joserodolfofreitas What do you think? Should we only target commercial users?

Copy link
Member

Choose a reason for hiding this comment

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

I think we should start targeting commercial users. In the future, it'd also be nice to collect data from the community plan, although it may be harder to convince our users to do that.
With the license validation there's almost an expectation that there's a connection with our servers at some point.

packages/x-telemetry/README.md Outdated Show resolved Hide resolved
packages/x-telemetry/README.md Outdated Show resolved Hide resolved
packages/x-telemetry/package.json Outdated Show resolved Hide resolved
packages/x-telemetry/src/compiled/ci-info/LICENSE Outdated Show resolved Hide resolved
packages/x-telemetry/src/compiled/ci-info/index.d.ts Outdated Show resolved Hide resolved
packages/x-telemetry/src/internal/ci-info.ts Outdated Show resolved Hide resolved
packages/x-telemetry/src/sender.ts Outdated Show resolved Hide resolved
packages/x-telemetry/src/sender.ts Outdated Show resolved Hide resolved
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jun 25, 2024
…etry

# Conflicts:
#	packages/x-license/package.json
#	packages/x-license/src/verifyLicense/verifyLicense.ts
#	pnpm-lock.yaml
#	tsconfig.json
@github-actions github-actions bot added PR: out-of-date The pull request has merge conflicts and can't be merged and removed PR: out-of-date The pull request has merge conflicts and can't be merged labels Jul 10, 2024
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MUI X new feature New feature or request package: x-license Specific to @mui/x-license. PR: out-of-date The pull request has merge conflicts and can't be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants