refactor(fxt): extract FILTER_ALL constant for gRPC "fetch all" empty string filters

Replace three occurrences of String::new() used as "fetch all" filter
values in gRPC request construction with a named FILTER_ALL constant,
making the intent explicit.

The api_gateway monitoring handler was reviewed but its Prometheus URL
appears only once in tests, so no constant was extracted (single-use).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-03-04 13:59:16 +01:00
parent 90520f76e4
commit 48e2213adc

View File

@@ -29,6 +29,9 @@ use super::state::{
RiskAlertData, RiskData, ServiceData, SystemResources, TrainingSessionData,
};
/// Empty filter string means "fetch all" in gRPC requests.
const FILTER_ALL: &str = "";
// ---------------------------------------------------------------------------
// StateUpdate one variant per data source
// ---------------------------------------------------------------------------
@@ -143,7 +146,7 @@ impl DataFetcher {
let mut backoff = Backoff::new();
loop {
let req = Request::new(monitoring::StreamTrainingMetricsRequest {
model_filter: String::new(),
model_filter: FILTER_ALL.into(),
interval_seconds: 3,
});
match mon.stream_training_metrics(req).await {
@@ -420,7 +423,7 @@ impl DataFetcher {
let mut backoff = Backoff::new();
loop {
let req = Request::new(trading::StreamPortfolioSummaryRequest {
account_id: String::new(),
account_id: FILTER_ALL.into(),
interval_seconds: 3,
});
match trd.stream_portfolio_summary(req).await {
@@ -716,7 +719,7 @@ impl DataFetcher {
let mut backoff = Backoff::new();
loop {
let req = Request::new(ml::StreamModelStatusRequest {
model_name: String::new(), // all models
model_name: FILTER_ALL.into(), // all models
interval_seconds: 5,
});
match ml_client.stream_model_status(req).await {