Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
remove analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
ggordonhall authored and anastasiya1155 committed Apr 23, 2024
1 parent a01df24 commit 40602c0
Show file tree
Hide file tree
Showing 22 changed files with 20 additions and 834 deletions.
102 changes: 2 additions & 100 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 3 additions & 25 deletions apps/desktop/src-tauri/src/backend.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use bleep::{analytics, Application, Configuration, Environment};
use bleep::{Application, Configuration, Environment};
use tracing::error;

use super::{config::get_device_id, Manager, Payload, Runtime};
use super::{Manager, Payload, Runtime};
use std::thread;
use std::time::Duration;

Expand Down Expand Up @@ -93,19 +93,7 @@ async fn start_backend<R: Runtime>(configuration: Configuration, app: tauri::App

app.manage(configuration.clone());

let initialized = Application::initialize(
Environment::insecure_local(),
configuration,
get_device_id(),
analytics::HubOptions {
package_metadata: Some(analytics::PackageMetadata {
name: env!("CARGO_CRATE_NAME"),
version: env!("CARGO_PKG_VERSION"),
git_rev: git_version::git_version!(fallback = "unknown"),
}),
},
)
.await;
let initialized = Application::initialize(Environment::insecure_local(), configuration).await;

match initialized {
Ok(backend) => {
Expand All @@ -114,16 +102,6 @@ async fn start_backend<R: Runtime>(configuration: Configuration, app: tauri::App
scope.add_event_processor(move |mut event| {
event.user = Some(crate::config::sentry_user()).map(|mut user| {
let username = backend.username();

user.id = Some(
if let (Some(analytics), Some(username)) =
(&backend.analytics, &username)
{
analytics.tracking_id(Some(username))
} else {
get_device_id()
},
);
user.username = username;
user
});
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion server/bleep/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ quick-xml = { version = "0.29.0", features = ["serialize"] }
# telemetry
sentry = { version = "0.31.7", default-features = false, features = ["tracing", "contexts", "debug-images", "panic", "rustls", "reqwest"] }
sentry-tracing = "0.31.7"
rudderanalytics = { version = "1.1.2", default-features = false, features = ["rustls-tls"] }

# auth
jsonwebtoken = { version = "8.3.0", features = ["use_pem"] }
Expand Down
32 changes: 0 additions & 32 deletions server/bleep/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use tracing::{debug, error, info, instrument};

use crate::{
agent::exchange::RepoPath,
analytics::{EventData, QueryEvent},
indexes::reader::{ContentDocument, FileDocument},
llm_gateway::{self, api::FunctionCall},
query::{parser, stopwords::remove_stopwords},
Expand Down Expand Up @@ -91,18 +90,8 @@ impl Drop for Agent {
ExchangeState::Failed => {}
ExchangeState::Pending => {
if std::thread::panicking() {
self.track_query(
EventData::output_stage("cancelled")
.with_payload("message", "request panicked"),
);
} else {
self.last_exchange_mut().apply_update(Update::SetTimestamp);

self.track_query(
EventData::output_stage("cancelled")
.with_payload("message", "request was cancelled"),
);

tokio::spawn(self.store());
}
}
Expand Down Expand Up @@ -139,15 +128,6 @@ impl Agent {
.map_err(|_| anyhow!("exchange_tx was closed"))
}

pub fn track_query(&self, data: EventData) {
let event = QueryEvent {
query_id: self.query_id,
thread_id: self.conversation.thread_id,
data,
};
self.app.track_query(&self.user, &event);
}

fn last_exchange(&self) -> &Exchange {
self.conversation
.exchanges
Expand Down Expand Up @@ -201,8 +181,6 @@ impl Agent {

match &action {
Action::Query(s) => {
self.track_query(EventData::input_stage("query").with_payload("q", s));

// Always make a code search for the user query on the first exchange
if self.conversation.exchanges.len() == 1 {
let keywords = {
Expand Down Expand Up @@ -270,16 +248,6 @@ impl Agent {
.await
.context("failed to fold LLM function call output")?;

self.track_query(
EventData::output_stage("llm_reply")
.with_payload("full_history", &history)
.with_payload("trimmed_history", &trimmed_history)
.with_payload("last_message", history.last())
.with_payload("functions", &functions)
.with_payload("raw_response", &raw_response)
.with_payload("model", &self.llm_gateway.model),
);

let action =
Action::deserialize_gpt(&raw_response).context("failed to deserialize LLM output")?;

Expand Down
10 changes: 0 additions & 10 deletions server/bleep/src/agent/tools/answer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use crate::{
exchange::{CodeChunk, FocusedChunk, Update},
model, transcoder, Agent,
},
analytics::EventData,
llm_gateway,
};

Expand Down Expand Up @@ -86,15 +85,6 @@ impl Agent {

self.update(Update::SetTimestamp).await?;

self.track_query(
EventData::output_stage("answer_article")
.with_payload("query", self.last_exchange().query())
.with_payload("query_history", &history)
.with_payload("response", &response)
.with_payload("raw_prompt", &system_prompt)
.with_payload("model", self.answer_model.model_name),
);

Ok(())
}

Expand Down
16 changes: 2 additions & 14 deletions server/bleep/src/agent/tools/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::{
exchange::{CodeChunk, RepoPath, SearchStep, Update},
prompts, Agent, AgentSemanticSearchParams,
},
analytics::EventData,
llm_gateway,
query::parser::Literal,
semantic::SemanticSearchParams,
Expand Down Expand Up @@ -41,7 +40,7 @@ impl Agent {

debug!("returned {} results", results.len());

let hyde_docs = if results.len() < MINIMUM_RESULTS {
if results.len() < MINIMUM_RESULTS {
info!("too few results returned, running HyDE");

let hyde_docs = self.hyde(query).await?;
Expand All @@ -64,10 +63,7 @@ impl Agent {
debug!("returned {} HyDE results", results.len());
results.extend(hyde_results);
}
hyde_docs
} else {
vec![]
};
}

let mut chunks = results
.into_iter()
Expand Down Expand Up @@ -127,14 +123,6 @@ impl Agent {
}))
.await?;

self.track_query(
EventData::input_stage("semantic code search")
.with_payload("query", query)
.with_payload("hyde_queries", &hyde_docs)
.with_payload("chunks", &chunks)
.with_payload("raw_prompt", &response),
);

Ok(response)
}

Expand Down
Loading

0 comments on commit 40602c0

Please sign in to comment.