Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodus committed Nov 29, 2023
1 parent cfdc90a commit ece6aa5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion graph-gateway/src/budgets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl Actor {
return;
}
let budget_limit = USD(self.controller.control_variable());
tracing::debug!(?budget_limit);
tracing::debug!(?budget_limit, wat = f64::from(budget_limit.0));
self.budget_limit.write(budget_limit);
}
}
Expand Down Expand Up @@ -116,6 +116,7 @@ impl Controller {
let target = f64::from(self.target_query_fees.0);
let process_variable =
f64::from(self.recent_fees.0) / self.recent_query_count.max(1) as f64;
tracing::debug!(process_variable);
METRICS.avg_query_fees.set(process_variable);

self.recent_fees = USD(UDecimal18::from(0));
Expand All @@ -127,6 +128,7 @@ impl Controller {
let i: f64 = self.error_history.frames().iter().sum();
let k_i = 0.1;
let cv = i * k_i;
tracing::debug!(cv = target + cv);
UDecimal18::try_from(target + cv).unwrap_or(self.target_query_fees.0)
}
}

0 comments on commit ece6aa5

Please sign in to comment.