ibm-telemetry / telemetry-js

JavaScript telemetry tooling for open/inner source projects
Apache License 2.0
8 stars 0 forks source link

feat: add command line telemetry disclosure #242

Closed francinelucca closed 6 months ago

francinelucca commented 6 months ago

Closes #233

Changelog

New

Testing / reviewing

mattrosno commented 6 months ago

A few questions:

  1. If 10 different instrumented packages get installed, will there be 10 different log entries?
  2. If it's not a CI environment (e.g. localhost), will the logs still appear?
  3. If the data is discarded due to the 24hr repo/branch rate limit, will the logs still appear?

I'm asking because if we console log more than when we're actually collecting, that could be very noisy in the logs and mis-represent the frequency that we're actually collecting?

francinelucca commented 6 months ago

Here's what we did before.

Let's mention how this data is anonymous, why it's collected, how to opt out, and one link to learn more. What about:

NOTICE: A package you installed is using IBM Telemetry to collect anonymous usage data. This information is used to influence the project's roadmap and prioritize bug fixes.

You can opt-out of this process by setting IBM_TELEMETRY_DISABLED='true' in your environment.

To learn more, please visit: https://github.com/ibm-telemetry/telemetry-js.

Done!

image
francinelucca commented 6 months ago

A few questions:

  1. If 10 different instrumented packages get installed, will there be 10 different log entries?
  2. If it's not a CI environment (e.g. localhost), will the logs still appear?
  3. If the data is discarded due to the 24hr repo/branch rate limit, will the logs still appear?

1 - This is a postinstall that runs after @ibm/telemetry-js is installed. I believe if 10 instrumented packages are installed on a given repo, @ibm/telemetry-js is still only installed once, except for varying versions. So we would expect the notice to show up once. Correct me if I'm wrong here @jdharvey-ibm ? 2 - Yes, we could change that if we wanted to, not sure we do? 3 - Yes, this is independent of telemetry runs. It will show up every time @ibm/telemetry-js is installed

mattrosno commented 6 months ago

@francinelucca since our rate limit is done server-side, I understand that the emitter doesn't know about that. But, looking at the example, it doesn't log if not a CI environment. Maybe we should do the same so people don't see logs in localhost?

jharvey10 commented 6 months ago

I'm wondering if we want to run this as part of the mainline telemetry emitter code (postinstall of the instrumented package) as opposed to the postinstall for the emitter itself. That way, theoretically you would see the name of the package for which it applies right in the console along with the message. We'd need to verify that though. Thoughts? This would bump up the number of times it's seen from 1 to n, but it does feel more transparent and accountable this way.

We could avoid this slightly by only displaying the message from the conductor and as packages add work to the train, we could output their names as part of the singular postinstall script that runs telemetry collection.

mattrosno commented 6 months ago

@jdharvey-ibm in spirit of transparency, showing the package names seems like the right thing to do, if that's not too much work to implement.

francinelucca commented 6 months ago

TODO: remove chalk, log from src/main/collect.ts (no need to reference actual pkg name, will come from the top in the logs)

sonarcloud[bot] commented 6 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud