Skip to content

Commit ca5f4ef

Browse files
Rajneesh Lakkundifacebook-github-bot
Rajneesh Lakkundi
authored andcommitted
Add config to enable health checks
Summary: Add config to enable health checks during rollout. Considering S509329, starting with this being off and enabling it with buckconfig after testing Reviewed By: JakobDegen Differential Revision: D73031751 fbshipit-source-id: d1b98088076d56fcbef55faa4533d2bf3c14da2f
1 parent eea3555 commit ca5f4ef

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

app/buck2_common/src/init.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,40 @@ pub enum LogDownloadMethod {
323323
None,
324324
}
325325

326+
#[derive(
327+
Allocative,
328+
Clone,
329+
Debug,
330+
Default,
331+
Serialize,
332+
Deserialize,
333+
PartialEq,
334+
Eq
335+
)]
336+
pub struct HealthCheckConfig {
337+
pub enable_health_checks: bool,
338+
pub disabled_health_check_names: Option<String>,
339+
}
340+
341+
impl HealthCheckConfig {
342+
pub fn from_config(config: &LegacyBuckConfig) -> buck2_error::Result<Self> {
343+
let enable_health_checks = config.parse(BuckconfigKeyRef {
344+
section: "buck2_health_check",
345+
property: "enable_health_checks",
346+
})?;
347+
let disabled_health_check_names = config.parse(BuckconfigKeyRef {
348+
section: "buck2_health_check",
349+
property: "disabled_health_check_names",
350+
})?;
351+
352+
Ok(Self {
353+
// TODO(rajneeshl): When the rollout is successful, change this to default to true.
354+
enable_health_checks: enable_health_checks.unwrap_or(false),
355+
disabled_health_check_names,
356+
})
357+
}
358+
}
359+
326360
/// Configurations that are used at startup by the daemon. Those are actually read by the client,
327361
/// and passed on to the daemon.
328362
///
@@ -343,6 +377,7 @@ pub struct DaemonStartupConfig {
343377
pub http: HttpConfig,
344378
pub resource_control: ResourceControlConfig,
345379
pub log_download_method: LogDownloadMethod,
380+
pub health_check_config: HealthCheckConfig,
346381
}
347382

348383
impl DaemonStartupConfig {
@@ -411,6 +446,7 @@ impl DaemonStartupConfig {
411446
http: HttpConfig::from_config(config)?,
412447
resource_control: ResourceControlConfig::from_config(config)?,
413448
log_download_method,
449+
health_check_config: HealthCheckConfig::from_config(config)?,
414450
})
415451
}
416452

@@ -436,6 +472,7 @@ impl DaemonStartupConfig {
436472
} else {
437473
LogDownloadMethod::None
438474
},
475+
health_check_config: HealthCheckConfig::default(),
439476
}
440477
}
441478
}

0 commit comments

Comments
 (0)