-
Notifications
You must be signed in to change notification settings - Fork 129
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
more precise telemetry types #1765
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reminded me why I annotated these as
test: true
: in case these events ran in CI and made it into our production events, I wanted an easy way to filter them out. Unsure if that's a good enough reason to keep it this way or not or simply try to firewall off any chance of them showing up in our actual data.I did just double check and we have no recorded events with
test: true
in them.