pub struct Configuration {Show 19 fields
pub dsn: Option<String>,
pub environment: String,
pub release: Option<String>,
pub server_name: Option<String>,
pub app_root: Option<String>,
pub enabled_environments: HashSet<String>,
pub queue_size: usize,
pub timeout: Duration,
pub scrub_pii: bool,
pub install_panic_hook: bool,
pub capture_source_context: bool,
pub track_breadcrumbs: bool,
pub max_breadcrumbs: usize,
pub track_performance: bool,
pub performance_flush_interval: Duration,
pub track_tracing: bool,
pub metric_flush_interval: Duration,
pub infrastructure_metric_flush_interval: Duration,
pub trace_capture_threshold: Duration,
}Expand description
Holds a single ForgeOps DSN plus everything else the client needs to build and deliver events. Mirrors gems/forge_ops_tracker’s Configuration: a single DSN string carries both the ingestion URL and the project’s API key: “https://<api_key>@host/api/v1/events”.
Fields§
§dsn: Option<String>§environment: String§release: Option<String>§server_name: Option<String>§app_root: Option<String>Decides whether a backtrace frame is “in_app”: a frame’s file path is compared against this root, the same file-path matching the Ruby gem does against Rails.root and the Python client does against os.getcwd(). A Rust binary built with debug info embeds real build-time source paths, so the same approach works here too. Defaults to the current working directory; set it explicitly if that doesn’t match your app’s actual layout.
enabled_environments: HashSet<String>§queue_size: usize§timeout: Duration§scrub_pii: bool§install_panic_hook: boolWhether init() installs the global panic hook (see lib.rs’s install_panic_hook) that
reports anything that panics on any thread, with zero further wiring: the same
“unhandled needs no wiring” case Rails.error/ASP.NET Core’s middleware and Python’s
excepthook wrapper cover automatically for their own languages. Doesn’t change panic
behavior (the previously-installed hook still runs afterward), so on by default is safe;
set false to opt out.
capture_source_context: boolWhether EventBuilder reads a few lines of source off disk around each in-app frame’s
culprit line (see event_builder.rs’s attach_source_context). Defaults to true so a
snippet shows up with zero extra setup, but this field isn’t the durable protection
against literal source code leaving a deployment it shouldn’t: ForgeOps’ own per-project
setting is, since it applies server-side regardless of what any given app happens to have
this field set to locally. Set false here if this app should never even attempt the disk
read in the first place.
Whether add_breadcrumb actually records anything, and whether a report reads the current
thread’s trail back at all: add_breadcrumb itself never panics or errors when this is
false, it just becomes a no-op, the same “the call site never has to check first” posture
every other independent tracking mechanism in this crate already has. On by default.
The most recent entries a single thread’s trail keeps; the oldest is dropped once full. Matches gems/forge_ops_tracker’s own default exactly.
track_performance: boolWhether record_performance/time_transaction time anything at all. On by default, the
same “on unless you turn it off” posture error reporting itself already has. This crate has
no web framework integration, so nothing is timed automatically: this only gates the manual
API below.
performance_flush_interval: DurationHow often the in-process tallies are flushed as one small aggregate report, rather than one network call per timed call. Matches gems/forge_ops_tracker’s own default (60s).
track_tracing: boolWhether trace starts a trace and reports it (when slow) to /spans. span and
record_span only record inside a trace, so this gates the whole feature. This crate has no
web framework integration, so nothing starts a trace automatically.
metric_flush_interval: DurationHow often the buffered capture_metric entries are flushed as one batch. There is no
track_metrics flag the way track_performance has one: these are explicit calls the host
app’s own code makes, not automatic instrumentation, so there is nothing to turn off that
simply not calling them doesn’t already do.
infrastructure_metric_flush_interval: DurationThe same for capture_infrastructure_metric.
trace_capture_threshold: DurationA trace is only sent when its root span took at least this long.
Implementations§
Source§impl Configuration
impl Configuration
Sourcepub fn new() -> Self
pub fn new() -> Self
Seeds a Configuration from FORGE_OPS_DSN/FORGE_OPS_ENVIRONMENT/FORGE_OPS_RELEASE and sensible defaults for everything else: the same env vars and defaults every other client in this repo reads.
Sourcepub fn api_key(&self) -> Option<String>
pub fn api_key(&self) -> Option<String>
The DSN’s userinfo component, percent-decoded: None if the DSN is unset or malformed.
Sourcepub fn ingestion_uri(&self) -> Option<String>
pub fn ingestion_uri(&self) -> Option<String>
The ingestion URL with credentials stripped out: they travel as the Authorization header instead, never embedded in the request URI.
Sourcepub fn performance_samples_uri(&self) -> Option<String>
pub fn performance_samples_uri(&self) -> Option<String>
Same derivation as ingestion_uri, with the trailing “/events” swapped for
“/performance_samples”: one DSN, two endpoints, matching the Ruby gem’s own
Configuration#performance_samples_uri.
Sourcepub fn custom_metrics_uri(&self) -> Option<String>
pub fn custom_metrics_uri(&self) -> Option<String>
Same derivation again, swapping the trailing “/events” for “/custom_metrics”.
Sourcepub fn infrastructure_metrics_uri(&self) -> Option<String>
pub fn infrastructure_metrics_uri(&self) -> Option<String>
Same derivation again, swapping the trailing “/events” for “/infrastructure_metrics”.
Sourcepub fn spans_uri(&self) -> Option<String>
pub fn spans_uri(&self) -> Option<String>
Same derivation again, swapping the trailing “/events” for “/spans”.