You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.2 KiB

11 months ago
  1. const { getGitVersion } = require("../../endpoints/utils");
  2. const { Telemetry } = require("../../models/telemetry");
  3. // Telemetry is anonymized and your data is never read. This can be disabled by setting
  4. // DISABLE_TELEMETRY=true in the `.env` of however you setup. Telemetry helps us determine use
  5. // of how AnythingLLM is used and how to improve this product!
  6. // You can see all Telemetry events by ctrl+f `Telemetry.sendEvent` calls to verify this claim.
  7. async function setupTelemetry() {
  8. if (process.env.DISABLE_TELEMETRY === "true") {
  9. console.log(
  10. `\x1b[31m[TELEMETRY DISABLED]\x1b[0m Telemetry is marked as disabled - no events will send. Telemetry helps Mintplex Labs Inc improve AnythingLLM.`
  11. );
  12. return true;
  13. }
  14. if (Telemetry.isDev()) {
  15. console.log(
  16. `\x1b[33m[TELEMETRY STUBBED]\x1b[0m Anonymous Telemetry stubbed in development.`
  17. );
  18. return;
  19. }
  20. console.log(
  21. `\x1b[32m[TELEMETRY ENABLED]\x1b[0m Anonymous Telemetry enabled. Telemetry helps Mintplex Labs Inc improve AnythingLLM.`
  22. );
  23. await Telemetry.findOrCreateId();
  24. await Telemetry.sendTelemetry("server_boot", {
  25. commit: getGitVersion(),
  26. });
  27. return;
  28. }
  29. module.exports = setupTelemetry;