pub struct HttpEnricher { /* private fields */ }Expand description
One HTTP enricher instance.
Constructed by the daemon config loader. The Arc<reqwest::Client>
is shared across all HTTP enrichers in the same daemon process so
connection pooling works at the process level rather than per-config-block.
Implementations§
Source§impl HttpEnricher
impl HttpEnricher
Sourcepub fn new(
id: String,
kind: EnricherKind,
inject_field: String,
method: String,
url: String,
headers: Vec<(String, String)>,
body: Option<String>,
timeout: Duration,
on_error: OnError,
scope: Scope,
extract: Option<ExtractExpr>,
client: HttpEnricherClient,
cache: HttpResponseCache,
) -> Self
pub fn new( id: String, kind: EnricherKind, inject_field: String, method: String, url: String, headers: Vec<(String, String)>, body: Option<String>, timeout: Duration, on_error: OnError, scope: Scope, extract: Option<ExtractExpr>, client: HttpEnricherClient, cache: HttpResponseCache, ) -> Self
Build a new enricher.
client is shared at the process level. cache may be a
disabled cache (HttpResponseCache::new(Duration::from_secs(0)))
when cache_ttl is unset; the lookup path treats that as “always
miss”.
Sourcepub fn with_max_response_bytes(self, max_bytes: usize) -> Self
pub fn with_max_response_bytes(self, max_bytes: usize) -> Self
Override the maximum response-body size this enricher will read.
The default is DEFAULT_ENRICHER_MAX_RESPONSE_BYTES. Setting a
smaller value can help when consuming many small enrichment
payloads concurrently and tightening the per-call memory bound is
worth the rejection risk on the occasional larger response.
Sourcepub fn with_metrics(self, metrics: Arc<dyn MetricsHook>) -> Self
pub fn with_metrics(self, metrics: Arc<dyn MetricsHook>) -> Self
Replace the metrics hook this enricher reports cache events into.
Pre-registers the three HTTP-cache counter label sets for this
enricher’s id so rsigma_enrichment_http_cache_{hits,misses, expirations}_total{...} are emitted on /metrics from the
first scrape, even before the enricher has run.
Sourcepub fn cache(&self) -> &HttpResponseCache
pub fn cache(&self) -> &HttpResponseCache
Read-only view of the response cache. Used by the metrics layer to expose cache hit/miss/expiration counters.
Trait Implementations§
Source§impl Enricher for HttpEnricher
impl Enricher for HttpEnricher
Source§fn kind(&self) -> EnricherKind
fn kind(&self) -> EnricherKind
Source§fn id(&self) -> &str
fn id(&self) -> &str
asset_lookup_det or enrich_hash_virustotal.Source§fn inject_field(&self) -> &str
fn inject_field(&self) -> &str
RuleHeader::enrichments
that this enricher writes to.Source§fn timeout(&self) -> Duration
fn timeout(&self) -> Duration
enrich() call in
tokio::time::timeout using this value. Defaults to 5 seconds.Source§fn scope(&self) -> &Scope
fn scope(&self) -> &Scope
enrich() runs. Default is Scope::default (always fires).Source§fn on_error(&self) -> OnError
fn on_error(&self) -> OnError
OnError::Skip.Auto Trait Implementations§
impl !RefUnwindSafe for HttpEnricher
impl !UnwindSafe for HttpEnricher
impl Freeze for HttpEnricher
impl Send for HttpEnricher
impl Sync for HttpEnricher
impl Unpin for HttpEnricher
impl UnsafeUnpin for HttpEnricher
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointerSource§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, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more