-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(new sink): add AWS Simple Notification Service aws_sns sink
#18141
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
da4652f
ci: speed up tests by only running sqs tests
wochinge cd20a13
chore: prepare split in sqs and sns
wochinge 2b7ef02
chore: wrap up split for foundation
wochinge 6941cd0
refactor: separate config
wochinge 0ac39cb
refactor: implement separate publisher
wochinge f9e7148
refactor: drop no longer needed message builder
wochinge 891e119
refactor: extract error type
wochinge 8311045
style: name variable correctly
wochinge 8c4addd
feat: add sns 🎉
wochinge 5b42a29
refactor: abstract retry logic
wochinge b8bdc9c
chore: remove sqs from shared modules
wochinge 829db54
chore: cleanup
wochinge 36b0a59
chore: drop temporary changes
wochinge e76af5f
chore: update mod to include sns module
wochinge 6be88d4
refactor: move healthcheck out of config into separate function
wochinge 07e1938
refactor: simplify request builder setup
wochinge 14c2b67
refactor: message id
ArzelaAscoIi 0ed0b62
nit: make functions just visibile in sub module
ArzelaAscoIi 33c7c6f
fix: add pub(super)
ArzelaAscoIi d3b5a6a
fix: sub methods attributes pub(super)
ArzelaAscoIi 89c00c3
Update Cargo.toml
ArzelaAscoIi 4a641a3
Update src/sinks/aws_s_s/mod.rs
ArzelaAscoIi 129313c
Update src/sinks/aws_s_s/retry.rs
ArzelaAscoIi efdf844
Update src/sinks/mod.rs
ArzelaAscoIi e7fe94c
Update src/sinks/aws_s_s/sns/config.rs
ArzelaAscoIi a7c7cf7
chore: first bunch of comments
ArzelaAscoIi 8f3be55
Merge branch 'feat/sns' of github.com:wochinge/vector into feat/sns
ArzelaAscoIi 69890db
chore: second bunch of comments
ArzelaAscoIi 6a51b9e
chore: enable all integration tests
ArzelaAscoIi 345d147
fix: move test
ArzelaAscoIi 5308c0e
fix: dead_code warning
ArzelaAscoIi 4df0786
fix: dead code warning
ArzelaAscoIi a2223eb
docs: autogenerated aws_sns docs
ArzelaAscoIi 8dbb7be
fix: move region serde to downstream impl
ArzelaAscoIi 185fe20
update licenses
neuronull 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 hidden or 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 hidden or 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 super::{request_builder::SendMessageEntry, service::SendMessageResponse}; | ||
| use aws_sdk_sqs::{error::SendMessageError, types::SdkError}; | ||
|
|
||
| #[async_trait::async_trait] | ||
| pub trait Client { | ||
| async fn send_message( | ||
| &self, | ||
| entry: SendMessageEntry, | ||
| byte_size: usize, | ||
| ) -> Result<SendMessageResponse, SdkError<SendMessageError>>; | ||
| } |
This file contains hidden or 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 hidden or 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,12 @@ | ||
| pub mod config; | ||
|
neuronull marked this conversation as resolved.
Outdated
|
||
| mod request_builder; | ||
| mod retry; | ||
| mod service; | ||
| mod sink; | ||
|
|
||
| pub use self::config::BaseSSSinkConfig; | ||
|
|
||
| #[cfg(feature = "sinks-aws_sqs")] | ||
| pub mod sqs; | ||
|
|
||
| mod client; | ||
|
neuronull marked this conversation as resolved.
Outdated
|
||
This file contains hidden or 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
File renamed without changes.
This file contains hidden or 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,67 @@ | ||
| use std::task::{Context, Poll}; | ||
|
|
||
| use aws_sdk_sqs::{error::SendMessageError, types::SdkError}; | ||
| use futures::future::BoxFuture; | ||
| use tower::Service; | ||
| use vector_common::request_metadata::GroupedCountByteSize; | ||
| use vector_core::{event::EventStatus, stream::DriverResponse, ByteSizeOf}; | ||
|
|
||
| use super::{client::Client, request_builder::SendMessageEntry}; | ||
|
|
||
| #[derive(Clone)] | ||
| pub(crate) struct SqsService<C> | ||
|
wochinge marked this conversation as resolved.
Outdated
|
||
| where | ||
| C: Client + Clone + Send + Sync + 'static, | ||
| { | ||
| client: C, | ||
| } | ||
|
|
||
| impl<C> SqsService<C> | ||
| where | ||
| C: Client + Clone + Send + Sync + 'static, | ||
| { | ||
| pub const fn new(client: C) -> Self { | ||
| Self { client } | ||
| } | ||
| } | ||
|
|
||
| impl<C> Service<SendMessageEntry> for SqsService<C> | ||
| where | ||
| C: Client + Clone + Send + Sync + 'static, | ||
| { | ||
| type Response = SendMessageResponse; | ||
| type Error = SdkError<SendMessageError>; | ||
| type Future = BoxFuture<'static, Result<Self::Response, Self::Error>>; | ||
|
|
||
| // Emission of an internal event in case of errors is handled upstream by the caller. | ||
| fn poll_ready(&mut self, _cx: &mut Context) -> Poll<Result<(), Self::Error>> { | ||
| Poll::Ready(Ok(())) | ||
| } | ||
|
|
||
| // Emission of internal events for errors and dropped events is handled upstream by the caller. | ||
| fn call(&mut self, entry: SendMessageEntry) -> Self::Future { | ||
| let byte_size = entry.size_of(); | ||
| let client = self.client.clone(); | ||
|
|
||
| Box::pin(async move { client.send_message(entry, byte_size).await }) | ||
| } | ||
| } | ||
|
|
||
| pub struct SendMessageResponse { | ||
| pub(crate) byte_size: usize, | ||
| pub(crate) json_byte_size: GroupedCountByteSize, | ||
| } | ||
|
|
||
| impl DriverResponse for SendMessageResponse { | ||
| fn event_status(&self) -> EventStatus { | ||
| EventStatus::Delivered | ||
| } | ||
|
|
||
| fn events_sent(&self) -> &GroupedCountByteSize { | ||
| &self.json_byte_size | ||
| } | ||
|
|
||
| fn bytes_sent(&self) -> Option<usize> { | ||
| Some(self.byte_size) | ||
| } | ||
| } | ||
This file contains hidden or 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.
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'll revert these later - this is just to speed up testing