-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
more precise telemetry types (#1765)
- Loading branch information
Showing
5 changed files
with
87 additions
and
106 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import {readFile} from "node:fs/promises"; | ||
|
||
process.stdout.write(`# Telemetry | ||
Observable Framework collects anonymous usage data to help us improve the product. This data is sent to Observable and is not shared with third parties. Telemetry data is covered by [Observable’s privacy policy](https://observablehq.com/privacy-policy). | ||
You can [opt-out of telemetry](#disabling-telemetry) by setting the \`OBSERVABLE_TELEMETRY_DISABLE\` environment variable to \`true\`. | ||
## What is collected? | ||
The following data is collected: | ||
~~~ts run=false | ||
${(await readFile("./src/telemetryData.d.ts", "utf-8")).trim()} | ||
~~~ | ||
To inspect telemetry data, set the \`OBSERVABLE_TELEMETRY_DEBUG\` environment variable to \`true\`. This will print the telemetry data to stderr instead of sending it to Observable. See [\`telemetry.ts\`](https://github.com/observablehq/framework/blob/main/src/telemetry.ts) for source code. | ||
## What is not collected? | ||
We never collect identifying or sensitive information, such as environment variables, file names or paths, or file contents. | ||
## Disabling telemetry | ||
Setting the \`OBSERVABLE_TELEMETRY_DISABLE\` environment variable to \`true\` disables telemetry collection entirely. For example: | ||
~~~sh | ||
OBSERVABLE_TELEMETRY_DISABLE=true npm run build | ||
~~~ | ||
Setting the \`OBSERVABLE_TELEMETRY_DEBUG\` environment variable to \`true\` also disables telemetry collection, instead printing telemetry data to stderr. Use this to inspect what telemetry data would be collected. | ||
`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import type {UUID} from "node:crypto"; | ||
|
||
export type TelemetryIds = { | ||
session: UUID | null; // random, held in memory for the duration of the process | ||
device: UUID | null; // persists to ~/.observablehq | ||
project: string | null; // one-way hash of private salt + repository URL or cwd | ||
}; | ||
|
||
export type TelemetryEnvironment = { | ||
version: string; // version from package.json | ||
userAgent: string; // npm_config_user_agent | ||
node: string; // node.js version | ||
systemPlatform: string; // linux, darwin, win32, ... | ||
systemRelease: string; // 20.04, 11.2.3, ... | ||
systemArchitecture: string; // x64, arm64, ... | ||
cpuCount: number; // number of cpu cores | ||
cpuModel: string | null; // cpu model name | ||
cpuSpeed: number | null; // cpu speed in MHz | ||
memoryInMb: number; // truncated to mb | ||
isCI: string | boolean; // inside CI heuristic, name or false | ||
isDocker: boolean; // inside Docker heuristic | ||
isWSL: boolean; // inside WSL heuristic | ||
}; | ||
|
||
export type TelemetryTime = { | ||
now: number; // performance.now | ||
timeOrigin: number; // performance.timeOrigin | ||
timeZoneOffset: number; // minutes from UTC | ||
}; | ||
|
||
export type TelemetryData = | ||
| {event: "build"; step: "start"} | ||
| {event: "build"; step: "finish"; pageCount: number} | ||
| {event: "deploy"; step: "start"; force: boolean | null | "build" | "deploy"} | ||
| {event: "deploy"; step: "finish"} | ||
| {event: "deploy"; step: "error"} | ||
| {event: "deploy"; buildManifest: "found" | "missing" | "error"} | ||
| {event: "preview"; step: "start"} | ||
| {event: "preview"; step: "finish"} | ||
| {event: "preview"; step: "error"} | ||
| {event: "signal"; signal: NodeJS.Signals} | ||
| {event: "login"; step: "start"} | ||
| {event: "login"; step: "finish"} | ||
| {event: "login"; step: "error"; code: "expired" | "consumed" | "no-key" | `unknown-${string}`}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters