Skip to main content

Configuration

Struct Configuration 

Source
pub struct Configuration {
Show 21 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 capture_sql_objects: bool, pub capture_sql_statement: 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: bool

Whether 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: bool

Whether 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.

§capture_sql_objects: bool

When an error is reported with the SQL behind a failed database call (see capture_error_with_sql), send the names of the stored procedure, table and view that SQL touched, so an issue says where to start looking. Names are identifiers, never values, which is why this defaults on. capture_sql_statement is the separate, opt-in step of also sending the statement itself, with every string and number replaced by ?; off by default because even a masked statement describes your schema, and ForgeOps’ own per-project setting is what durably governs whether the server stores it.

§capture_sql_statement: bool§track_breadcrumbs: bool

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.

§max_breadcrumbs: usize

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: bool

Whether 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: Duration

How 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: bool

Whether 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: Duration

How 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: Duration

The same for capture_infrastructure_metric.

§trace_capture_threshold: Duration

A trace is only sent when its root span took at least this long.

Implementations§

Source§

impl Configuration

Source

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.

Source

pub fn api_key(&self) -> Option<String>

The DSN’s userinfo component, percent-decoded: None if the DSN is unset or malformed.

Source

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.

Source

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.

Source

pub fn custom_metrics_uri(&self) -> Option<String>

Same derivation again, swapping the trailing “/events” for “/custom_metrics”.

Source

pub fn infrastructure_metrics_uri(&self) -> Option<String>

Same derivation again, swapping the trailing “/events” for “/infrastructure_metrics”.

Source

pub fn spans_uri(&self) -> Option<String>

Same derivation again, swapping the trailing “/events” for “/spans”.

Source

pub fn is_enabled(&self) -> bool

Trait Implementations§

Source§

impl Default for Configuration

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.