Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove trace from ops #780

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
489 changes: 243 additions & 246 deletions gen/secrets.baseline.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion lib/api-helper/build/src/macro_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ pub async fn __with_ctx<A: auth::ApiAuth + Send>(
ts,
ts,
(),
Vec::new(),
);

// Create auth
Expand Down
4 changes: 4 additions & 0 deletions lib/chirp/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ impl Client {
pub fn ts(&self) -> i64 {
self.ts
}

pub fn trace(&self) -> &[chirp::TraceEntry] {
&self.trace
}
}

impl Drop for Client {
Expand Down
1 change: 0 additions & 1 deletion lib/chirp/worker/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,6 @@ where
ts,
req_ts,
req_body,
trace,
),
dont_log_body,
allow_recursive,
Expand Down
1 change: 0 additions & 1 deletion lib/chirp/worker/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ impl TestCtx {
rivet_util::timestamp::now(),
rivet_util::timestamp::now(),
(),
Vec::new(),
);

Ok(TestCtx {
Expand Down
8 changes: 6 additions & 2 deletions lib/connection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Connection {
&self,
parent_req_id: Uuid,
ray_id: Uuid,
trace: Vec<chirp_client::TraceEntry>,
trace_entry: chirp_client::TraceEntry,
) -> GlobalResult<Connection> {
// Not the same as the operation ctx's ts because this cannot be overridden by debug start ts
let ts = rivet_util::timestamp::now();
Expand All @@ -41,7 +41,11 @@ impl Connection {
parent_req_id,
ray_id,
ts,
trace,
{
let mut x = self.client.trace().to_vec();
x.push(trace_entry);
x
},
chirp_perf::PerfCtxInner::new(redis_cache, ts, parent_req_id, ray_id),
),
self.pools.clone(),
Expand Down
49 changes: 11 additions & 38 deletions lib/operation/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ where
ts: i64,
req_ts: i64,
body: B,
// Trace of all requests not including this request. The client does include
// this request in the trace, though.
trace: Vec<chirp_client::TraceEntry>,
}

impl<B> OperationContext<B>
Expand All @@ -58,7 +55,6 @@ where
ts: i64,
req_ts: i64,
body: B,
trace: Vec<chirp_client::TraceEntry>,
) -> Self {
OperationContext {
name,
Expand All @@ -69,7 +65,6 @@ where
ts,
req_ts,
body,
trace,
}
}

Expand Down Expand Up @@ -136,46 +131,25 @@ where
/// Adds trace and correctly wraps `Connection` (and subsequently `chirp_client::Client`).
fn wrap<O: Operation>(&self, body: O::Request) -> GlobalResult<OperationContext<O::Request>> {
let ray_id = Uuid::new_v4();
// Add self to new operation's trace
let trace = {
let mut x = self.trace.clone();
x.push(chirp_client::TraceEntry {
context_name: self.name.clone(),
req_id: Some(self.req_id.into()),
ts: rivet_util::timestamp::now(),
run_context: match rivet_util::env::run_context() {
rivet_util::env::RunContext::Service => chirp_client::RunContext::Service,
rivet_util::env::RunContext::Test => chirp_client::RunContext::Test,
} as i32,
});
x
let trace_entry = chirp_client::TraceEntry {
context_name: self.name.clone(),
req_id: Some(self.req_id.into()),
ts: rivet_util::timestamp::now(),
run_context: match rivet_util::env::run_context() {
rivet_util::env::RunContext::Service => chirp_client::RunContext::Service,
rivet_util::env::RunContext::Test => chirp_client::RunContext::Test,
} as i32,
};

Ok(OperationContext {
name: O::NAME.to_string(),
timeout: O::TIMEOUT,
conn: self.conn.wrap(self.req_id, ray_id, {
let mut x = trace.clone();

// Add new operation's trace to its connection (and chirp client)
x.push(chirp_client::TraceEntry {
context_name: O::NAME.to_string(),
req_id: Some(self.req_id.into()),
ts: rivet_util::timestamp::now(),
run_context: match rivet_util::env::run_context() {
rivet_util::env::RunContext::Service => chirp_client::RunContext::Service,
rivet_util::env::RunContext::Test => chirp_client::RunContext::Test,
} as i32,
});

x
})?,
conn: self.conn.wrap(self.req_id, ray_id, trace_entry)?,
req_id: self.req_id,
ray_id,
ts: util::timestamp::now(),
req_ts: self.req_ts,
body,
trace,
})
}

Expand All @@ -191,7 +165,6 @@ where
ts: self.ts,
req_ts: self.req_ts,
body: (),
trace: self.trace.clone(),
}
}

Expand Down Expand Up @@ -231,11 +204,11 @@ where
}

pub fn trace(&self) -> &[chirp_client::TraceEntry] {
&self.trace
self.conn.trace()
}

pub fn test(&self) -> bool {
self.trace
self.trace()
.iter()
.any(|x| x.run_context == chirp_client::RunContext::Test as i32)
}
Expand Down
1 change: 0 additions & 1 deletion svc/api/admin/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ impl Ctx {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

Ctx { op_ctx }
Expand Down
1 change: 0 additions & 1 deletion svc/api/auth/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
// util::timestamp::now(),
// util::timestamp::now(),
// (),
// Vec::new(),
// );

// let (user_id, user_token) = Self::issue_user_token(&op_ctx).await;
Expand Down
1 change: 0 additions & 1 deletion svc/api/cf-verification/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
// util::timestamp::now(),
// util::timestamp::now(),
// (),
// Vec::new(),
// );

// let http_client = rivet_cf_verification::Config::builder()
Expand Down
1 change: 0 additions & 1 deletion svc/api/cloud/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
// util::timestamp::now(),
// util::timestamp::now(),
// (),
// Vec::new(),
// );

// // Create temp team
Expand Down
1 change: 0 additions & 1 deletion svc/api/group/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ impl Ctx {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

let (_user_id, user_token) = Self::issue_user_token(&op_ctx).await;
Expand Down
1 change: 0 additions & 1 deletion svc/api/identity/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
// util::timestamp::now(),
// util::timestamp::now(),
// (),
// Vec::new(),
// );

// let (primary_region_id, _) = Self::setup_region(&op_ctx).await;
Expand Down
1 change: 0 additions & 1 deletion svc/api/job/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
// util::timestamp::now(),
// util::timestamp::now(),
// (),
// Vec::new(),
// );

// let nomad_config = nomad_util::config_from_env().unwrap();
Expand Down
1 change: 0 additions & 1 deletion svc/api/kv/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
// util::timestamp::now(),
// util::timestamp::now(),
// (),
// Vec::new(),
// );

// let (primary_region_id, _) = Self::setup_region(&op_ctx).await;
Expand Down
1 change: 0 additions & 1 deletion svc/api/matchmaker/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ impl Ctx {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

let (primary_region_id, primary_region_name_id) = Self::setup_region(&op_ctx).await;
Expand Down
1 change: 0 additions & 1 deletion svc/api/portal/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ impl Ctx {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

let (_user_id, user_token) = Self::issue_user_token(&op_ctx).await;
Expand Down
1 change: 0 additions & 1 deletion svc/api/status/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
// util::timestamp::now(),
// util::timestamp::now(),
// (),
// Vec::new(),
// );

// let http_client = rivet_status::Config::builder()
Expand Down
1 change: 0 additions & 1 deletion svc/api/traefik-provider/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ impl Ctx {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

Ctx { op_ctx }
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/build/standalone/default-create/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ pub async fn run_from_env() -> GlobalResult<()> {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

for build in DEFAULT_BUILDS {
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/cluster/standalone/datacenter-tls-renew/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pub async fn run_from_env(pools: rivet_pools::Pools) -> GlobalResult<()> {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

let updated_datacenter_ids = rivet_pools::utils::crdb::tx(&ctx.crdb().await?, |tx| {
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/cluster/standalone/default-update/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ pub async fn run_from_env(use_autoscaler: bool) -> GlobalResult<()> {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

// Read config from env
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/cluster/standalone/gc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pub async fn run_from_env(ts: i64, pools: rivet_pools::Pools) -> GlobalResult<()
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

let datacenter_ids = rivet_pools::utils::crdb::tx(&ctx.crdb().await?, |tx| {
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/cluster/standalone/metrics-publish/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ pub async fn run_from_env(_ts: i64, pools: rivet_pools::Pools) -> GlobalResult<(
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

let servers = select_servers(&ctx).await?;
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/job/standalone/gc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ pub async fn run_from_env(ts: i64, pools: rivet_pools::Pools) -> GlobalResult<()
ts,
ts,
(),
Vec::new(),
);

// Find jobs to stop.
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/linode/standalone/gc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ pub async fn run_from_env(pools: rivet_pools::Pools) -> GlobalResult<()> {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

let dc_rows = sql_fetch_all!(
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/load-test/standalone/api-cloud/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub async fn run_from_env(_ts: i64) -> GlobalResult<()> {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

// Create temp team
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/load-test/standalone/mm-sustain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ pub async fn run_from_env(_ts: i64) -> GlobalResult<()> {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

// Region
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/load-test/standalone/mm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ pub async fn run_from_env(_ts: i64) -> GlobalResult<()> {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

// Setup
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/load-test/standalone/sqlx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pub async fn run_from_env(_ts: i64) -> GlobalResult<()> {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

let mut interval = tokio::time::interval(std::time::Duration::from_millis(100));
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/load-test/standalone/watch-requests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub async fn run_from_env(_ts: i64) -> GlobalResult<()> {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

// Create temp team
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/mm/standalone/gc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ pub async fn run_from_env(ts: i64, pools: rivet_pools::Pools) -> GlobalResult<()
ts,
ts,
(),
Vec::new(),
);
let redis_mm = ctx.redis_mm().await?;

Expand Down
1 change: 0 additions & 1 deletion svc/pkg/telemetry/standalone/beacon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ pub async fn run_from_env(ts: i64) -> GlobalResult<()> {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

if std::env::var("RIVET_TELEMETRY_DISABLE")
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/upload/standalone/provider-fill/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pub async fn run_from_env() -> GlobalResult<()> {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

let Ok(backfill_provider) = std::env::var("S3_BACKFILL_PROVIDER") else {
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/user/standalone/delete-pending/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub async fn run_from_env(ts: i64) -> GlobalResult<()> {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

let user_ids = sql_fetch_all!(
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/user/standalone/search-user-gc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub async fn run_from_env(ts: i64) -> GlobalResult<()> {
util::timestamp::now(),
util::timestamp::now(),
(),
Vec::new(),
);

let mut total_removed = 0;
Expand Down
Loading
Loading