Skip to content

Commit

Permalink
Merge pull request #23 from katoahq/endigma/remove-telemetry
Browse files Browse the repository at this point in the history
Remove telemetry
  • Loading branch information
endigma authored Oct 1, 2023
2 parents fe6eea2 + dc945e1 commit 89e5f8d
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 303 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ jobs:
command: build
args: -p katoa-cli --release --target ${{ matrix.target }} -F ${{ matrix.features }}
env:
# SENTRY_AUTH_TOKEN: \$\{{ secrets.SENTRY_AUTH_TOKEN }}
# SEGMENT_WRITE_KEY: \$\{{ secrets.SEGMENT_WRITE_KEY }}
CC_aarch64_unknown_linux_musl: clang
AR_aarch64_unknown_linux_musl: llvm-ar
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS: -Clink-self-contained=yes -Clinker=rust-lld
Expand Down
66 changes: 0 additions & 66 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ mod git;
mod job;
mod logging;
mod oci;
#[cfg(feature = "telemetry")]
mod telemetry;
#[cfg(feature = "self-update")]
mod update;
mod util;
Expand All @@ -23,8 +21,6 @@ use std::{
path::{Path, PathBuf},
process::{ExitCode, Stdio},
};
#[cfg(feature = "telemetry")]
use telemetry::{segment::TrackEvent, segment_enabled, sentry::sentry_init};
use tracing::{error, info, info_span, warn, Instrument};
#[cfg(feature = "self-update")]
use update::check_for_update;
Expand Down Expand Up @@ -509,28 +505,6 @@ impl Commands {

info!(trigger = true);

// Only send telemetry when we know we should execute
#[cfg(feature = "telemetry")]
let telem_join = segment_enabled().then(|| {
let pipeline_name = pipeline_name.clone();
let pipeline_length = std::fs::read_to_string(&pipeline_path)
.map(|f| f.lines().count())
.ok();

tokio::spawn(
TrackEvent::PipelineExecuted {
pipeline_name,
pipeline_length,
job_count: pipeline.jobs.len(),
step_count: pipeline
.jobs
.iter()
.fold(0, |acc, job| acc + job.steps.len()),
}
.post(),
)
});

let inspect_output = Command::new(oci_backend.as_str())
.args([
"inspect",
Expand Down Expand Up @@ -772,11 +746,6 @@ impl Commands {
}
}

#[cfg(feature = "telemetry")]
if let Some(join) = telem_join {
join.await.ok();
}

if exit_code != 0 {
std::process::exit(exit_code)
}
Expand Down Expand Up @@ -1009,29 +978,10 @@ impl Commands {
Commands::Debug { .. } => "debug",
}
}

#[cfg(feature = "telemetry")]
fn track(&self) -> bool {
match self {
Commands::Run { .. } => true,
Commands::Step { .. } => false,
Commands::Init { .. } => true,
Commands::New { .. } => true,
Commands::Update => true,
Commands::Completions { .. } => false,
#[cfg(feature = "fig-completions")]
Commands::FigCompletion => false,
Commands::Open { .. } => false,
Commands::Doctor { .. } => true,
Commands::Debug { .. } => false,
}
}
}

#[tokio::main]
async fn main() -> ExitCode {
#[cfg(feature = "telemetry")]
let _sentry_guard = sentry_init();
if let Err(err) = logging_init() {
eprintln!("Failed to init logger: {err:#?}");
return ExitCode::FAILURE;
Expand All @@ -1043,24 +993,8 @@ async fn main() -> ExitCode {

let command = Commands::parse();

#[cfg(feature = "telemetry")]
let telem_join = (command.track() && segment_enabled()).then(|| {
let subcommand = command.subcommand().to_owned();
tokio::spawn(
TrackEvent::SubcommandExecuted {
subcommand_name: subcommand,
}
.post(),
)
});

let res = command.execute().await;

#[cfg(feature = "telemetry")]
if let Some(join) = telem_join {
join.await.ok();
}

match res {
Ok(_) => ExitCode::SUCCESS,
Err(err) => {
Expand Down
35 changes: 0 additions & 35 deletions crates/cli/src/telemetry/mod.rs

This file was deleted.

175 changes: 0 additions & 175 deletions crates/cli/src/telemetry/segment.rs

This file was deleted.

25 changes: 0 additions & 25 deletions crates/cli/src/telemetry/sentry.rs

This file was deleted.

0 comments on commit 89e5f8d

Please sign in to comment.