#[non_exhaustive]pub struct ObservabilityConfig {
pub log_level: String,
pub log_format: String,
pub audit_log_path: Option<PathBuf>,
pub log_request_headers: bool,
pub metrics_enabled: bool,
pub metrics_bind: String,
pub log_plaintext_oauth_tokens: bool,
pub log_oauth_claim_values: bool,
pub log_tool_call_arguments: bool,
pub log_upstream_error_bodies: bool,
}Expand description
Observability settings (reusable across MCP projects).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.log_level: Stringtracing log level / env filter string (e.g. info,rmcp_server_kit=debug).
log_format: StringLog output format: json, pretty, or text (default: pretty).
audit_log_path: Option<PathBuf>Optional path to an append-only audit log file.
log_request_headers: boolEmit inbound HTTP request headers at DEBUG level in transport logs. Sensitive headers remain redacted when enabled.
metrics_enabled: boolEnable the Prometheus metrics endpoint.
metrics_bind: StringBind address for the Prometheus metrics listener.
log_plaintext_oauth_tokens: boolLog OAuth access tokens in plaintext. Defaults to redacted; enabling writes secrets to logs and is for local debugging only. Process-wide, not per-server.
log_oauth_claim_values: boolLog OAuth claim values in plaintext. Defaults to redacted; enabling writes secrets to logs and is for local debugging only. Process-wide, not per-server.
log_tool_call_arguments: boolLog tool-call arguments and identity fields in plaintext. Defaults to redacted; enabling writes secrets to logs and is for local debugging only. Process-wide, not per-server.
log_upstream_error_bodies: boolLog the error_description an authorization server returns on a failed
RFC 8693 token exchange. Defaults to redacted; the value is free-form
upstream text that may reflect request parameters back. Process-wide,
not per-server.
Implementations§
Source§impl ObservabilityConfig
impl ObservabilityConfig
Sourcepub fn apply_env_overrides(
&mut self,
) -> Result<Vec<EnvOverride>, RmcpServerKitError>
pub fn apply_env_overrides( &mut self, ) -> Result<Vec<EnvOverride>, RmcpServerKitError>
Applies RMCP_SERVER_KIT__OBSERVABILITY__* environment overrides.
This method is opt-in and only mutates this struct; it does not update tracing subscribers or server metrics configuration by itself.
§Errors
Returns RmcpServerKitError::Config when a boolean override cannot be parsed.
§Examples
The full config-file pipeline lives in
examples/config_file_server.rs.
use rmcp_server_kit::config::ObservabilityConfig;
let mut observability = ObservabilityConfig::default();
// Do not set process env in doctests: rustdoc examples share a process.
let report = observability.apply_env_overrides()?;
let _report_shape: Vec<(&str, &str, Option<&str>)> = report
.iter()
.map(|entry| {
(
entry.env_var.as_str(),
entry.target_field.as_str(),
entry.value.as_deref(),
)
})
.collect();Trait Implementations§
Source§impl Debug for ObservabilityConfig
Hand-written so audit_log_path never reaches a log.
impl Debug for ObservabilityConfig
Hand-written so audit_log_path never reaches a log.
SECURITY: the audit log’s location is operational metadata an attacker can
use to find or tamper with the audit trail. Presence is still reported;
only the path is withheld. observability_config_debug_lists_every_field
fails if a field is added without being rendered here.