fix: add GetEpochHistory to api_gateway proxy + clippy fixes
- Implement GetEpochHistory forwarding in MonitoringServiceProxy - Fix clippy integer suffix style (0usize → 0_usize) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -103,9 +103,9 @@ pub(crate) fn compute_epoch_financials(
|
||||
// Exposure 0,1 = reduce/close (SELL-like), 2 = hold, 3,4 = add/aggressive (BUY-like)
|
||||
let total_actions: usize = action_counts.iter().sum();
|
||||
let (buy_pct, sell_pct, hold_pct) = if total_actions > 0 {
|
||||
let mut buy = 0usize;
|
||||
let mut sell = 0usize;
|
||||
let mut hold = 0usize;
|
||||
let mut buy = 0_usize;
|
||||
let mut sell = 0_usize;
|
||||
let mut hold = 0_usize;
|
||||
for (i, &count) in action_counts.iter().enumerate() {
|
||||
let exposure = i / 9; // 0-4
|
||||
match exposure {
|
||||
|
||||
@@ -11,7 +11,8 @@ use tracing::{error, info, instrument};
|
||||
use crate::monitoring::monitoring_service_client::MonitoringServiceClient;
|
||||
use crate::monitoring::monitoring_service_server::{MonitoringService, MonitoringServiceServer};
|
||||
use crate::monitoring::{
|
||||
GetLiveTrainingMetricsRequest, GetLiveTrainingMetricsResponse, StreamTrainingMetricsRequest,
|
||||
GetEpochHistoryRequest, GetEpochHistoryResponse, GetLiveTrainingMetricsRequest,
|
||||
GetLiveTrainingMetricsResponse, StreamTrainingMetricsRequest,
|
||||
};
|
||||
|
||||
/// Monitoring Service Proxy
|
||||
@@ -79,6 +80,23 @@ impl MonitoringService for MonitoringServiceProxy {
|
||||
info!("StreamTrainingMetrics forwarded successfully");
|
||||
Ok(Response::new(boxed_stream))
|
||||
}
|
||||
|
||||
#[instrument(skip(self, request), fields(request_id = %uuid::Uuid::new_v4()), err)]
|
||||
async fn get_epoch_history(
|
||||
&self,
|
||||
request: Request<GetEpochHistoryRequest>,
|
||||
) -> Result<Response<GetEpochHistoryResponse>, Status> {
|
||||
info!("Proxying GetEpochHistory request");
|
||||
|
||||
let mut client = self.client.clone();
|
||||
let response = client.get_epoch_history(request).await.map_err(|e| {
|
||||
error!("Backend GetEpochHistory failed: {}", e);
|
||||
e
|
||||
})?;
|
||||
|
||||
info!("GetEpochHistory forwarded successfully");
|
||||
Ok(response)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user