docs: Update telemetry documentation (#16628)

- Add references to locations in code for Metrics and Panic telemetry
- Remove outdated documentation (ClickhouseEvent,
ClickhouseEventWrapper, ClickhouseEventRequestBody)
- Migrate struct documentation from web docs to inline doc comments on
struct members.
This commit is contained in:
Peter Tripp 2024-08-21 20:24:35 -04:00 committed by GitHub
parent 1f8fa82ac3
commit 136f75ee9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 39 additions and 106 deletions

View file

@ -1,17 +1,24 @@
/// Please see: [Telemetry in Zed](https://zed.dev/docs/telemetry) for additional documentation.
use semantic_version::SemanticVersion;
use serde::{Deserialize, Serialize};
use std::{fmt::Display, sync::Arc, time::Duration};
#[derive(Serialize, Deserialize, Debug)]
pub struct EventRequestBody {
/// Identifier unique to each Zed installation (differs for stable, preview, dev)
pub installation_id: Option<String>,
/// Identifier unique to each logged in Zed user (randomly generated on first sign in)
pub metrics_id: Option<String>,
/// Identifier unique to each Zed session (differs for each time you open Zed)
pub session_id: Option<String>,
/// True for Zed staff, otherwise false
pub is_staff: Option<bool>,
/// Zed version number
pub app_version: String,
pub os_name: String,
pub os_version: Option<String>,
pub architecture: String,
/// Zed release channel (stable, preview, dev)
pub release_channel: Option<String>,
pub events: Vec<EventWrapper>,
}
@ -25,6 +32,7 @@ impl EventRequestBody {
#[derive(Serialize, Deserialize, Debug)]
pub struct EventWrapper {
pub signed_in: bool,
/// Duration between this event's timestamp and the timestamp of the first event in the current batch
pub milliseconds_since_first_event: i64,
#[serde(flatten)]
pub event: Event,
@ -70,13 +78,19 @@ pub enum Event {
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct EditorEvent {
/// The editor operation performed (open, save)
pub operation: String,
/// The extension of the file that was opened or saved
pub file_extension: Option<String>,
/// Whether the user is in vim mode or not
pub vim_mode: bool,
/// Whether the user has copilot enabled or not
pub copilot_enabled: bool,
/// Whether the user has copilot enabled for the language of the file opened or saved
pub copilot_enabled_for_language: bool,
}
/// Deprecated since Zed v0.137.0 (2024-05-29). Replaced by InlineCompletionEvent.
// Needed for clients sending old copilot_event types
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CopilotEvent {
@ -87,6 +101,7 @@ pub struct CopilotEvent {
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct InlineCompletionEvent {
/// Provider of the completion suggestion (e.g. copilot, supermaven)
pub provider: String,
pub suggestion_accepted: bool,
pub file_extension: Option<String>,
@ -94,6 +109,7 @@ pub struct InlineCompletionEvent {
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CallEvent {
/// Operation performed: invite/join call; begin/end screenshare; share/unshare project; etc
pub operation: String,
pub room_id: Option<u64>,
pub channel_id: Option<u64>,
@ -101,8 +117,11 @@ pub struct CallEvent {
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct AssistantEvent {
/// Unique random identifier for each assistant tab (None for inline assist)
pub conversation_id: Option<String>,
/// The kind of assistant (Panel, Inline)
pub kind: AssistantKind,
/// Name of the AI model used (gpt-4o, claude-3-5-sonnet, etc)
pub model: String,
pub response_latency: Option<Duration>,
pub error_message: Option<String>,
@ -171,6 +190,7 @@ pub struct HangReport {
pub os_name: String,
pub os_version: Option<String>,
pub architecture: String,
/// Identifier unique to each Zed installation (differs for stable, preview, dev)
pub installation_id: Option<String>,
}
@ -182,19 +202,27 @@ pub struct LocationData {
#[derive(Serialize, Deserialize)]
pub struct Panic {
/// The name of the thread that panicked
pub thread: String,
/// The panic message
pub payload: String,
/// The location of the panic (file, line number)
#[serde(skip_serializing_if = "Option::is_none")]
pub location_data: Option<LocationData>,
pub backtrace: Vec<String>,
/// Zed version number
pub app_version: String,
/// Zed release channel (stable, preview, dev)
pub release_channel: String,
pub os_name: String,
pub os_version: Option<String>,
pub architecture: String,
/// The time the panic occurred (UNIX millisecond timestamp)
pub panicked_on: i64,
#[serde(skip_serializing_if = "Option::is_none")]
/// Identifier unique to each Zed installation (differs for stable, preview, dev)
pub installation_id: Option<String>,
/// Identifier unique to each Zed session (differs for each time you open Zed)
pub session_id: String,
}