-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat : alerts module #95
Merged
Merged
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
e337059
feat : alerts module init
ocdbytes b944033
feat : added alerts in jobs/mod.rs
ocdbytes 645a6ea
feat : updated messages
ocdbytes da66c86
Merge branch 'main' of https://github.com/karnotxyz/madara-orchestrat…
ocdbytes af9b7b6
feat : updated tests with alerts module mock
ocdbytes 8fff056
changelog : update
ocdbytes ef86e9f
Merge branch 'main' into feat/alerts-module
ocdbytes 01c5530
feat : added additional alerts
ocdbytes f965c09
feat : added test for alerts and added logs at queue level
ocdbytes 6030c3e
refactor : removed redundant alerts
ocdbytes 2a613fa
Merge branch 'main' into feat/alerts-module
ocdbytes 55ed0f2
feat : updated workflow
ocdbytes 9a893ee
feat : resolved comments
ocdbytes 40765f8
Merge branch 'main' into feat/alerts-module
ocdbytes 948a423
feat : added all alerts for queues
ocdbytes feb746b
feat : updated code
ocdbytes 3438448
remove queue url const
apoorvsadana 39abe4b
Merge branch 'main' into feat/alerts-module
ocdbytes 096fab1
Merge branch 'main' into feat/alerts-module
apoorvsadana e3f585c
Merge branch 'main' into feat/alerts-module
ocdbytes 8d41f39
feat : tests and lint fixes
ocdbytes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,65 @@ | ||
HOST= | ||
PORT= | ||
DATABASE_URL= | ||
MADARA_RPC_URL= | ||
DA_LAYER= | ||
SETTLEMENT_LAYER= | ||
|
||
# Ethereum | ||
ETHEREUM_PRIVATE_KEY= | ||
ETHEREUM_RPC_URL= | ||
MEMORY_PAGES_CONTRACT_ADDRESS= | ||
STARKNET_SOLIDITY_CORE_CONTRACT_ADDRESS= | ||
|
||
##### ORCHESTRATOR ##### | ||
|
||
# Starknet | ||
STARKNET_PUBLIC_KEY= | ||
STARNET_PRIVATE_KEY= | ||
STARKNET_RPC_URL= | ||
STARKNET_CAIRO_CORE_CONTRACT_ADDRESS= | ||
HOST= | ||
PORT= | ||
|
||
# MongoDB connection string | ||
MONGODB_CONNECTION_STRING= | ||
##### AWS CONFIG ##### | ||
|
||
# AWS | ||
AWS_ACCESS_KEY_ID= | ||
AWS_SECRET_ACCESS_KEY= | ||
AWS_DEFAULT_REGION= | ||
AWS_REGION= | ||
AWS_ENDPOINT_URL= | ||
|
||
##### STORAGE ##### | ||
|
||
# SQS | ||
DATA_STORAGE= | ||
AWS_S3_BUCKET_NAME= | ||
|
||
##### QUEUE ##### | ||
|
||
QUEUE_PROVIDER= | ||
SQS_JOB_PROCESSING_QUEUE_URL= | ||
SQS_JOB_VERIFICATION_QUEUE_URL= | ||
SQS_JOB_HANDLE_FAILURE_QUEUE_URL= | ||
SQS_WORKER_TRIGGER_QUEUE_URL= | ||
|
||
# S3 | ||
AWS_S3_BUCKET_NAME= | ||
AWS_S3_BUCKET_REGION= | ||
##### DATABASE ##### | ||
|
||
DATABASE= | ||
MONGODB_CONNECTION_STRING= | ||
|
||
# Ethereum Settlement | ||
DEFAULT_SETTLEMENT_CLIENT_RPC= | ||
DEFAULT_L1_CORE_CONTRACT_ADDRESS= | ||
##### PROVER ##### | ||
|
||
# Sharp Services | ||
PROVER_SERVICE= | ||
SHARP_CUSTOMER_ID= | ||
SHARP_URL= | ||
# [IMP!!!] These are test certificates (they don't work) | ||
SHARP_USER_CRT= | ||
SHARP_USER_KEY= | ||
SHARP_SERVER_CRT= | ||
SHARP_PROOF_LAYOUT= | ||
|
||
##### ON CHAIN CONFIG ##### | ||
|
||
DA_LAYER= | ||
SETTLEMENT_LAYER= | ||
ETHEREUM_RPC_URL= | ||
MADARA_RPC_URL= | ||
MEMORY_PAGES_CONTRACT_ADDRESS= | ||
PRIVATE_KEY= | ||
ETHEREUM_PRIVATE_KEY= | ||
STARKNET_SOLIDITY_CORE_CONTRACT_ADDRESS= | ||
|
||
##### ALERTS ##### | ||
|
||
AWS_SNS_REGION= | ||
AWS_SNS_ARN= | ||
AWS_SNS_ARN_NAME= | ||
|
||
##### SETTLEMENT CLIENT ##### | ||
|
||
DEFAULT_SETTLEMENT_CLIENT_RPC= | ||
DEFAULT_L1_CORE_CONTRACT_ADDRESS= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use crate::alerts::Alerts; | ||
use async_trait::async_trait; | ||
use aws_sdk_sns::config::Region; | ||
use aws_sdk_sns::Client; | ||
use utils::env_utils::get_env_var_or_panic; | ||
|
||
pub struct AWSSNS { | ||
client: Client, | ||
} | ||
|
||
impl AWSSNS { | ||
/// To create a new SNS client | ||
pub async fn new() -> Self { | ||
let sns_region = get_env_var_or_panic("AWS_SNS_REGION"); | ||
let config = aws_config::from_env().region(Region::new(sns_region)).load().await; | ||
AWSSNS { client: Client::new(&config) } | ||
} | ||
} | ||
|
||
#[async_trait] | ||
impl Alerts for AWSSNS { | ||
async fn send_alert_message(&self, message_body: String) -> color_eyre::Result<()> { | ||
apoorvsadana marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let topic_arn = get_env_var_or_panic("AWS_SNS_ARN"); | ||
self.client.publish().topic_arn(topic_arn).message(message_body).send().await?; | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use async_trait::async_trait; | ||
use mockall::automock; | ||
|
||
pub mod aws_sns; | ||
|
||
#[automock] | ||
#[async_trait] | ||
pub trait Alerts: Send + Sync { | ||
/// To send an alert message to our alert service | ||
async fn send_alert_message(&self, message_body: String) -> color_eyre::Result<()>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was comparing this to the S3 config and I noticed a few things
Client::from_conf
to Client::new inside s3)new
doesn't need to async (and even SNS once can be made non sync after that)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can make a new issue for this idts this is related to this PR and will cause unnecessary confusion amongst the reviewers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved in #98