Skip to content

Commit

Permalink
Enhancement: Re-design alerts
Browse files Browse the repository at this point in the history
Alerts used to be linked to a logstream and were based on an expression based logic
With this PR, alerts will be independent of logstreams and will be based on a SQL query
The given threshold config will get evaluated against the result of the query and
the target config will be used to send out notifications
  • Loading branch information
parmesant committed Dec 22, 2024
1 parent 82a09eb commit c7795f9
Show file tree
Hide file tree
Showing 24 changed files with 1,169 additions and 668 deletions.
281 changes: 0 additions & 281 deletions src/alerts/mod.rs

This file was deleted.

7 changes: 0 additions & 7 deletions src/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ use arrow_array::RecordBatch;
use arrow_schema::{Field, Fields, Schema};
use itertools::Itertools;
use std::sync::Arc;
use tracing::error;

use self::error::EventError;
pub use self::writer::STREAM_WRITERS;
Expand Down Expand Up @@ -90,12 +89,6 @@ impl Event {

crate::livetail::LIVETAIL.process(&self.stream_name, &self.rb);

if let Err(e) = metadata::STREAM_INFO
.check_alerts(&self.stream_name, &self.rb)
.await
{
error!("Error checking for alerts. {:?}", e);
}

Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/airplane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl FlightService for AirServiceImpl {
.ok_or_else(|| Status::aborted("Malformed SQL Provided, Table Name Not Found"))?
.to_owned();

update_schema_when_distributed(streams)
update_schema_when_distributed(&streams)
.await
.map_err(|err| Status::internal(err.to_string()))?;

Expand Down Expand Up @@ -212,7 +212,7 @@ impl FlightService for AirServiceImpl {

let permissions = Users.get_permissions(&key);

authorize_and_set_filter_tags(&mut query, permissions, &stream_name).map_err(|_| {
authorize_and_set_filter_tags(&mut query, permissions, &streams).map_err(|_| {
Status::permission_denied("User Does not have permission to access this")
})?;
let time = Instant::now();
Expand Down
Loading

0 comments on commit c7795f9

Please sign in to comment.