--- title: "Telemetry and diagnostics in Slate" description: "Control Slate's diagnostics sharing in your application: the defaults, the off switches, first contact with a new model, and runBenchmark." url: https://darkgrade.com/docs/slate/guides/telemetry last_updated: 2026-12-04 docs_index: https://darkgrade.com/docs/llms.txt --- # Telemetry and diagnostics in Slate > Control Slate's diagnostics sharing in your application: the defaults, the off switches, first contact with a new model, and runBenchmark. > ## Documentation Index > Fetch the complete documentation index at: https://darkgrade.com/docs/llms.txt > Use this file to discover all available pages before exploring further. Darkgrade Slate records diagnostics about the camera exchanges it makes, and on Node.js it shares them with Darkgrade unless you turn that off. This page shows how to control that from an application you ship: the switches, what Slate does on its own, and the benchmark you can run yourself. This page covers behaviour and controls only. What is collected and why is in the [privacy policy](https://darkgrade.com/privacy). The same defaults apply to any product built on Slate, so read it before you ship. ## Turn sharing off Sharing is on by default. Any one of these turns it off: | How | Lasts | | - | - | | Set `DARKGRADE_CONTRIBUTIONS=0` or `DO_NOT_TRACK=1` in the environment | While the variable is set | | Run [`darkgrade telemetry opt-out`](https://darkgrade.com/docs/cli/telemetry.md#turn-sharing-off-or-on) | Saved for this computer's user, across Studio, the CLI and Slate | | Call `setConsent(false)` in your code | Saved the same way | ```typescript import { nodeDiagnostics } from '@darkgrade/slate/telemetry/settings' const diagnostics = await nodeDiagnostics() await diagnostics.setConsent(false) console.log(diagnostics.status()) // { enabled: false, sharingEnabled: false, // installationId: …, queuedEntries: 0, … } ``` `setConsent(false)` stops uploads and clears what was waiting to be sent. `setConsent(true)` turns sharing back on. `withdraw()` turns it off and also asks the collector to delete what this installation shared; [`darkgrade telemetry delete`](https://darkgrade.com/docs/cli/telemetry.md#delete-what-was-shared) does the same. Slate never shares under a test runner: with `NODE_ENV=test`, the automatic client is disabled. ## What Slate does on its own - **Nothing at import.** Installing or importing Slate opens no camera, writes no settings and contacts no server. - **One queue per process.** When a `Camera` connects over USB or PTP/IP on Node.js, Slate attaches its diagnostics to that connection. It opens no second session. - **Real cameras only.** A custom or simulated transport is not observed, unless you [configure a client yourself](#use-your-own-store-or-collector). - **Batched uploads.** Entries are sent every 30 seconds from a bounded queue, off the camera's path: an upload never delays or fails a camera operation. When the queue is full, new entries are dropped and counted. - **One entry per call.** Each public `Camera` call is recorded as a `call` entry with a `callId`, its outcome (`ok`, `unsupported`, `refused`, `outcome-unknown`, `invalid-input` or `error`) and the surface that made it. The protocol commands sent during the call carry the same `callId`. - **Settings on disk.** The sharing preference and a random installation id are kept in `~/.darkgrade/settings.json`, which Studio and the CLI share. - **A log on disk.** Diagnostics are also written to `~/.darkgrade/diagnostics/.jsonl`, for debugging. Each file rotates at 2 MiB and keeps one previous file. This continues when sharing is off. - **Three more files.** In `~/.darkgrade` Slate also keeps `reported-facts.json` (hashes of what it already shared, so each connection doesn't upload the same inventory again), `known-cameras.json` (the make and model each USB device last reported) and `profiles/` (saved camera profiles). ### Environment variables | Variable | Effect | | - | - | | `DARKGRADE_CONTRIBUTIONS=0` | Turns sharing off. | | `DO_NOT_TRACK=1` | Turns sharing off. | | `DARKGRADE_LOCAL_DIAGNOSTICS=0` | Stops the log on disk. | | `DARKGRADE_HOME` | The folder to use in place of `~/.darkgrade`. | | `DARKGRADE_TELEMETRY_URL` | An HTTPS origin to send to, in place of Darkgrade's collector. | ## First contact The first time Slate connects to a model that is not one of its [tested models](https://darkgrade.com/docs/slate/guides/preflight.md#tested-models), it reads that camera's inventory once: its identity, the descriptors of the properties it advertises, and its storage ids. - It only reads. It takes no photo, starts no live view and changes no setting. - It runs once per model and firmware version on each installation, inside `connect()`, and is limited to 30 seconds and 512 properties. - It saves the profile to `~/.darkgrade/profiles/` and shares the inventory like any other diagnostics. - It does not run when sharing is off, under `NODE_ENV=test`, outside Node.js, or on a simulated transport. - It never throws: a failed inventory does not fail `connect()`. Turn it off for one camera with the constructor option: ```typescript import { Camera } from '@darkgrade/slate' const camera = new Camera({ firstContact: false }) ``` ## Benchmark a camera `runBenchmark` is the same inventory on demand, with two optional transfers: it reads the camera's identity, the operations and events it advertises, its property descriptors and its storage ids, and times each check. Use it to see what a camera you haven't worked with supports. The CLI runs it as [`darkgrade telemetry benchmark`](https://darkgrade.com/docs/cli/telemetry.md#benchmark-your-camera). ```typescript import { Camera, runBenchmark } from '@darkgrade/slate' const camera = new Camera() await camera.connect() try { const { passed, checks, profile } = await runBenchmark(camera, { photo: true, liveView: true, onProgress: ({ name, passed }) => console.log(name, passed), }) console.log(passed, checks.length, profile.status) console.log(profile.identity?.model) } finally { await camera.disconnect() } ``` The camera must be connected, idle and yours for the duration: don't run other operations on it meanwhile. On a Sony, the storage check switches the camera to its file-transfer mode and back. | Option | Description | | - | - | | `photo` | Take one photo, without autofocus, and transfer it. It is saved to the card too. Default `false`. | | `liveView` | Transfer one live-view frame. Default `false`. | | `timeoutMilliseconds` | The whole benchmark's deadline. Default 180000, at most 300000. A check that would start after it is recorded as `'deadline'`. | | `maximumProperties` | How many property descriptors to read. Default 128, at most 512. | | `signal` | An `AbortSignal`. Cancellation takes effect between checks. | | `onProgress` | Called with each [`BenchmarkCheck`](https://darkgrade.com/docs/slate/reference/types-workflow.md#benchmarkcheck) as it finishes. | | `flushEvidence` | Called between phases, for hosts that manage their own upload queue. | | `purpose` | `'first-contact'` runs the read-only inventory above: no photo, no live view. Default `'benchmark'`. | The result: | Field | Meaning | | - | - | | `checks` | One [`BenchmarkCheck`](https://darkgrade.com/docs/slate/reference/types-workflow.md#benchmarkcheck) per step: `name`, `passed`, `durationMilliseconds`, and `error` (`'operation-failed'`, `'deadline'` or `'cancelled'`) when it did not pass. | | `passed` | Every check passed, nothing was cut short. | | `profile` | A `darkgrade.camera-profile/v1` document: the camera's `identity`, `vendorId`, `transport`, `status` (`'complete'`, `'partial'` or `'cancelled'`), and the datasets that were read. | | `mediaDecoded` | Always `false`: a returned photo proves the transfer, not that the image decodes. | > [!NOTE] > > A passing benchmark shows what this camera answered today. `profile.hardwarePass` is always `false`: an inventory is not proof that each advertised feature works. For that, see [Checks before a shoot](https://darkgrade.com/docs/slate/guides/preflight.md). ## Use your own store or collector `nodeDiagnostics()` is the client Slate uses on Node.js. In a browser, or when you want the preference kept somewhere other than `~/.darkgrade`, create a client yourself and hand it to Slate: ```typescript import { configureSlateTelemetry } from '@darkgrade/slate' import { createApplicationDiagnostics, type InstallationState, type InstallationStore, } from '@darkgrade/slate/telemetry' let saved: InstallationState | null = null const store: InstallationStore = { read: async () => saved, write: async state => { saved = state // keep it somewhere durable; it holds a credential }, } const diagnostics = await createApplicationDiagnostics({ endpoint: 'https://collector.example.com', store, }) configureSlateTelemetry(diagnostics) ``` `endpoint` and `store` are required. | Option | Description | | - | - | | `endpoint` | The collector's HTTPS origin: no path, query or credentials. | | `store` | Reads and writes the `InstallationState`: the preference and this installation's credential. | | `disabled` | A function; return `true` to pause sharing, for example behind your own setting. | | `presentNotice` | Called once per notice version with `{ text, version }`. Return `false` to start with sharing off. | | `localRecord` | Receives every entry, for your own log. | | `flushIntervalMilliseconds` | Default 30000. From 1000 to 3600000. | | `requestTimeoutMilliseconds` | Default 10000. At most 60000. | | `fetch` | A `fetch` to use for requests. | The client has `status()`, `setConsent(value)`, `withdraw()`, `flush()` and `close()`. Create it once per process and reuse it for every camera. `configureSlateTelemetry(undefined)` puts back Slate's default. Everything else the two entries export is listed under [`@darkgrade/slate/telemetry`](https://darkgrade.com/docs/slate/reference/entry-points.md#darkgradeslatetelemetry) and [`@darkgrade/slate/telemetry/settings`](https://darkgrade.com/docs/slate/reference/entry-points.md#darkgradeslatetelemetrysettings). > [card] [Privacy policy](https://darkgrade.com/privacy) > > What Darkgrade collects and the choices people have. > [card] [Telemetry commands](https://darkgrade.com/docs/cli/telemetry.md) > > Benchmark, status, opt-out and delete from the command line.