Skip to content
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
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/health/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ nv-redfish = { workspace = true, features = [
"chassis",
"computer-systems",
"event-service",
"http-extras",
"log-services",
"managers",
"memory",
Expand Down
3 changes: 2 additions & 1 deletion crates/health/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ For a faster fault-injection loop, copy
run hardware health with the copied file:

```toml
bmc_request_concurrency = 4

[collectors.sensors]
sensor_fetch_interval = "5s"
sensor_fetch_concurrency = 4
include_sensor_thresholds = true
```

Expand Down
9 changes: 4 additions & 5 deletions crates/health/example/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ shard = 0
shards_count = 1

cache_size = 100
# Maximum concurrent Redfish operations per BMC, including collector fan-out.
# Must be greater than zero. Default: 4.
# Changes take effect after restarting carbide-health.
bmc_request_concurrency = 4
bmc_proxy_url = "http://proxy.example.com:8080"

endpoint_discovery_interval = "5m"
Expand Down Expand Up @@ -213,12 +217,10 @@ log_mode = "unreachable"

[collectors.sensors]
sensor_fetch_interval = "1m"
sensor_fetch_concurrency = 10
include_sensor_thresholds = true

[collectors.metrics]
fetch_interval = "2m"
fetch_concurrency = 4

# Redfish telemetry service: pre-aggregated metric reports, one GET per report
# instead of one per resource. Published under the `hw_telemetry` series name so
Expand Down Expand Up @@ -278,9 +280,6 @@ exclude_services = ["Journal"]
[collectors.logs.sse]
initial_backoff = "1s"
max_backoff = "30s"
# Maximum number of concurrent Redfish GET requests used to fetch EventRecord
# resources referenced by @odata.id in SSE notifications.
event_record_fetch_concurrency = 4

# required when
# mode = "periodic"; must not be set when mode = "sse"
Expand Down
23 changes: 23 additions & 0 deletions crates/health/src/api_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use std::collections::{HashMap, HashSet};
use std::convert::TryFrom;
use std::net::IpAddr;
use std::num::NonZeroUsize;
use std::str::FromStr;
use std::sync::{Arc, Mutex};

Expand Down Expand Up @@ -295,6 +296,7 @@ pub struct ApiEndpointSource {
reqwest: ReqwestClient,
proxy_url: Option<Url>,
cache_size: usize,
bmc_request_concurrency: NonZeroUsize,
bmc_latency_metrics: Option<Arc<BmcLatencyMetrics>>,
bmc_client_cache: Mutex<HashMap<MacAddress, CachedBmcClient>>,
}
Expand All @@ -313,12 +315,31 @@ impl ApiEndpointSource {
proxy_url: Option<Url>,
cache_size: usize,
bmc_latency_metrics: Option<Arc<BmcLatencyMetrics>>,
) -> Self {
Self::new_with_request_concurrency(
api,
reqwest,
proxy_url,
cache_size,
NonZeroUsize::MIN,
bmc_latency_metrics,
)
}

pub(crate) fn new_with_request_concurrency(
api: Arc<ApiClientWrapper>,
reqwest: ReqwestClient,
proxy_url: Option<Url>,
cache_size: usize,
bmc_request_concurrency: NonZeroUsize,
bmc_latency_metrics: Option<Arc<BmcLatencyMetrics>>,
) -> Self {
Self {
api,
reqwest,
proxy_url,
cache_size,
bmc_request_concurrency,
bmc_latency_metrics,
bmc_client_cache: Mutex::new(HashMap::new()),
}
Expand Down Expand Up @@ -621,6 +642,7 @@ impl ApiEndpointSource {
provider,
self.proxy_url.clone(),
self.cache_size,
self.bmc_request_concurrency,
bmc_latency_instrumentation,
)?))
})?
Expand Down Expand Up @@ -812,6 +834,7 @@ mod tests {
provider,
None,
10,
NonZeroUsize::MIN,
None,
)?))
}
Expand Down
Loading
Loading