pub struct BetterStackSubscriber { /* private fields */ }Expand description
Subscriber that forwards error events to BetterStack Logs.
Only acts on events that represent failures:
Event::StepFailedEvent::RunStatusChangedwhentoisFailed
All other events are silently ignored (filtering by event type should already be done at subscription time, but this subscriber adds an extra safety check).
Retries failed deliveries with exponential backoff (up to 3 attempts, 5 s timeout per attempt).
§Examples
use ironflow_engine::notify::{BetterStackSubscriber, Event, EventPublisher};
let mut publisher = EventPublisher::new();
publisher.subscribe(
BetterStackSubscriber::new("my-source-token"),
&[Event::STEP_FAILED, Event::RUN_STATUS_CHANGED],
);Implementations§
Source§impl BetterStackSubscriber
impl BetterStackSubscriber
Sourcepub fn new(source_token: &str) -> Self
pub fn new(source_token: &str) -> Self
Create a new subscriber with the given BetterStack source token.
Uses the default ingestion endpoint (https://in.logs.betterstack.com).
§Panics
Panics if the HTTP client cannot be built (TLS backend unavailable).
§Examples
use ironflow_engine::notify::BetterStackSubscriber;
let subscriber = BetterStackSubscriber::new("my-source-token");
assert_eq!(subscriber.source_token(), "my-source-token");Sourcepub fn with_url(source_token: &str, ingest_url: &str) -> Self
pub fn with_url(source_token: &str, ingest_url: &str) -> Self
Create a subscriber with a custom ingestion URL.
Useful for testing or self-hosted BetterStack instances.
§Panics
Panics if the HTTP client cannot be built (TLS backend unavailable).
§Examples
use ironflow_engine::notify::BetterStackSubscriber;
let subscriber = BetterStackSubscriber::with_url(
"my-source-token",
"https://custom.logs.example.com",
);
assert_eq!(subscriber.ingest_url(), "https://custom.logs.example.com");Sourcepub fn source_token(&self) -> &str
pub fn source_token(&self) -> &str
Returns the source token.
Sourcepub fn ingest_url(&self) -> &str
pub fn ingest_url(&self) -> &str
Returns the ingestion URL.