Skip to content

Commit

Permalink
[docs] init telemetry doc
Browse files Browse the repository at this point in the history
  • Loading branch information
rustielin authored and aptos-bot committed Apr 6, 2022
1 parent 0988f6c commit 112ba66
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 7 deletions.
14 changes: 7 additions & 7 deletions crates/aptos-telemetry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use uuid::Uuid;

pub const GA_MEASUREMENT_ID: &str = "GA_MEASUREMENT_ID";
pub const GA_API_SECRET: &str = "GA_API_SECRET";
pub const APTOS_TELEMETRY_OPTOUT: &str = "APTOS_TELEMETRY_OPTOUT";
pub const APTOS_TELEMETRY_DISABLE: &str = "APTOS_TELEMETRY_DISABLE";

#[derive(Debug, Serialize, Deserialize)]
struct MetricsDump {
Expand All @@ -39,8 +39,8 @@ struct Ip {
origin: String,
}

pub fn is_optout() -> bool {
env::var(APTOS_TELEMETRY_OPTOUT).is_ok()
pub fn is_disable() -> bool {
env::var(APTOS_TELEMETRY_DISABLE).is_ok()
}

async fn get_ip_origin() -> String {
Expand All @@ -55,15 +55,15 @@ async fn get_ip_origin() -> String {
}

pub async fn send_data(event_name: String, user_id: String, event_params: HashMap<String, String>) {
if is_optout() {
debug!("Error sending data: optout of Aptos telemetry");
if is_disable() {
debug!("Error sending data: disabled Aptos telemetry");
return;
}

// parse environment variables
let api_secret = env::var(GA_API_SECRET).unwrap_or(constants::APTOS_GA_API_SECRET.to_string());
let api_secret = env::var(GA_API_SECRET).unwrap_or_else(|_| constants::APTOS_GA_API_SECRET.to_string());
let measurement_id =
env::var(GA_MEASUREMENT_ID).unwrap_or(constants::APTOS_GA_MEASUREMENT_ID.to_string());
env::var(GA_MEASUREMENT_ID).unwrap_or_else(|_| constants::APTOS_GA_MEASUREMENT_ID.to_string());

// dump event params in a new hashmap with some default params to include
let mut new_event_params: HashMap<String, String> = event_params.clone();
Expand Down
34 changes: 34 additions & 0 deletions developer-docs-site/docs/reference/telemetry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: "Telemetry"
slug: "telemetry"
---

At Aptos Labs, we develop software and services for the greater Aptos community and ecosystem. On top of community feedback, we use telemetry to help improve the decentralization of the network by understanding how our software is being deployed and run.

The Aptos node binary collects telemetry such as software version, operating system information, and IP address. See [Types of information collected](#types-of-information-collected).

The Aptos node binary does **not** collect personal information such as usernames or email addresses.

Users can disable telemetry at any point. If telemetry remains enabled, Aptos node binary will send telemetry data in the background.

# Disabling telemetry

On macOs and Linux, you can disable telemetry by setting the `APTOS_TELEMETRY_DISABLE` environment variable to any value.

```
export APTOS_TELEMETRY_DISABLE=true
```

The above example only disables telemetry for a single session or terminal. To disable it everywhere, you must do so at shell startup.

```
echo "export APTOS_TELEMETRY_DISABLE=true" >> ~/.profile
source ~/.profile
```

# Types of information collected

* **Usage information** - Commands and subcommands that are run
* **System information** - Operating system (Windows, Linux, macOS) and kernel information, CPU and memory utilization
* **Software information** - Version of the Aptos node binary
* **Node information** - Public IP address, number of inbound and outbound Aptos node connections
1 change: 1 addition & 0 deletions documentation/telemetry.md

0 comments on commit 112ba66

Please sign in to comment.