pub struct Config {
pub thresholds: ThresholdsConfig,
pub detection: DetectionConfig,
pub green: GreenConfig,
pub daemon: DaemonConfig,
pub reporting: ReportingConfig,
}Expand description
Top-level configuration for perf-sentinel.
Mirrors the four .perf-sentinel.toml sections ([thresholds],
[detection], [green], [daemon]) into typed sub-structs so a
consumer that touches only thresholds does not pull a daemon-shaped
import surface. The 0.5.x flat layout was unfolded in 0.6.0; see
docs/CONFIGURATION.md for the rename matrix.
Fields§
§thresholds: ThresholdsConfigQuality-gate thresholds enforced by analyze --ci.
detection: DetectionConfigPer-detector knobs that drive detect::detect.
green: GreenConfigGreenOps / SCI-v1.0 scoring config.
daemon: DaemonConfigDaemon (perf-sentinel watch) runtime config: listeners, ack
store, TLS, CORS, cross-trace correlation.
reporting: ReportingConfigPeriodic disclosure report config (intent, org-config path, output
destination). Drives daemon startup validation when
intent = "official" and is consumed by perf-sentinel disclose.
Implementations§
Source§impl Config
impl Config
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Validate that config values are within acceptable bounds.
§Errors
Returns a String description of the first invalid value found.
The caller (load_from_str) wraps this in ConfigError::Validation.
Sourcepub fn warn_listen_addr_if_non_loopback(&self)
pub fn warn_listen_addr_if_non_loopback(&self)
Emit the non-loopback security advisory if applicable.
The default is 127.0.0.1 (loopback). Advanced users may override
to 0.0.0.0 for container deployments behind a reverse proxy. We
warn loudly rather than rejecting, because the user’s intent is
explicit (they changed the config) and a hard reject would force
workarounds (e.g., iptables) that are harder to audit.
Kept separate from validate() because it is the only check
that depends on CLI overrides (--listen-address), so the daemon
entrypoint calls it a second time after applying the overrides.
The other advisory warnings inside validate() are config-only
and must be emitted exactly once, at load time, to avoid making
an operator believe the daemon validates the same config twice.
Source§impl Config
impl Config
Sourcepub const fn confidence(&self) -> Confidence
pub const fn confidence(&self) -> Confidence
Map the daemon environment to a Confidence value.
Used by daemon::run to stamp findings after detection. analyze
batch mode does not call this; it picks CiBatch or LocalBatch
from the host CI environment in pipeline::analyze_with_traces
instead (see pipeline::ci_environment_detected).
Sourcepub fn carbon_context(&self) -> CarbonContext
pub fn carbon_context(&self) -> CarbonContext
Build a [CarbonContext] from the green config fields.
Returns a context with energy_snapshot: None. The daemon clones
this and patches in the measured energy snapshot per tick; the
batch pipeline uses it as-is (no scrapers in batch mode).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request