-
Couldn't load subscription status.
- Fork 1.9k
feat(new source):Initial addition of GCS support #23916
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
Draft
deangalvin-cb
wants to merge
2
commits into
vectordotdev:master
Choose a base branch
from
deangalvin-cb:feat/add-gcs-source-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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,197 @@ | ||
| use metrics::counter; | ||
| use vector_lib::internal_event::InternalEvent; | ||
| use vector_lib::internal_event::{error_stage, error_type}; | ||
|
|
||
| #[derive(Debug)] | ||
| pub struct GcsObjectDownloadSucceeded<'a> { | ||
| pub bucket: &'a str, | ||
| pub object: &'a str, | ||
| pub byte_size: usize, | ||
| } | ||
|
|
||
| impl<'a> InternalEvent for GcsObjectDownloadSucceeded<'a> { | ||
| fn emit(self) { | ||
| debug!( | ||
| message = "Successfully downloaded GCS object.", | ||
| bucket = %self.bucket, | ||
| object = %self.object, | ||
| byte_size = %self.byte_size, | ||
| ); | ||
| counter!("component_received_bytes_total") | ||
| .increment(self.byte_size as u64); | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug)] | ||
| pub struct GcsObjectDownloadError<'a> { | ||
| pub bucket: &'a str, | ||
| pub object: &'a str, | ||
| pub error: &'a dyn std::error::Error, | ||
| } | ||
|
|
||
| impl<'a> InternalEvent for GcsObjectDownloadError<'a> { | ||
| fn emit(self) { | ||
| error!( | ||
| message = "Failed to download GCS object.", | ||
| bucket = %self.bucket, | ||
| object = %self.object, | ||
| error = %self.error, | ||
| error_type = error_type::REQUEST_FAILED, | ||
| stage = error_stage::RECEIVING, | ||
| ); | ||
| counter!( | ||
| "component_errors_total", | ||
| "error_type" => error_type::REQUEST_FAILED, | ||
| "stage" => error_stage::RECEIVING, | ||
| ) | ||
| .increment(1); | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug)] | ||
| pub struct GcsObjectProcessingSucceeded<'a> { | ||
| pub bucket: &'a str, | ||
| pub object: &'a str, | ||
| pub events_count: usize, | ||
| } | ||
|
|
||
| impl<'a> InternalEvent for GcsObjectProcessingSucceeded<'a> { | ||
| fn emit(self) { | ||
| debug!( | ||
| message = "Successfully processed GCS object.", | ||
| bucket = %self.bucket, | ||
| object = %self.object, | ||
| events_count = %self.events_count, | ||
| ); | ||
| counter!("component_received_events_total") | ||
| .increment(self.events_count as u64); | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug)] | ||
| pub struct GcsObjectProcessingError<'a> { | ||
| pub bucket: &'a str, | ||
| pub object: &'a str, | ||
| pub error: &'a dyn std::error::Error, | ||
| } | ||
|
|
||
| impl<'a> InternalEvent for GcsObjectProcessingError<'a> { | ||
| fn emit(self) { | ||
| error!( | ||
| message = "Failed to process GCS object.", | ||
| bucket = %self.bucket, | ||
| object = %self.object, | ||
| error = %self.error, | ||
| error_type = error_type::PARSER_FAILED, | ||
| stage = error_stage::PROCESSING, | ||
| ); | ||
| counter!( | ||
| "component_errors_total", | ||
| "error_type" => error_type::PARSER_FAILED, | ||
| "stage" => error_stage::PROCESSING, | ||
| ) | ||
| .increment(1); | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug)] | ||
| pub struct GcsPubsubMessageReceived<'a> { | ||
| pub subscription: &'a str, | ||
| pub message_count: usize, | ||
| } | ||
|
|
||
| impl<'a> InternalEvent for GcsPubsubMessageReceived<'a> { | ||
| fn emit(self) { | ||
| debug!( | ||
| message = "Received messages from GCS Pub/Sub subscription.", | ||
| subscription = %self.subscription, | ||
| message_count = %self.message_count, | ||
| ); | ||
| counter!("component_received_messages_total") | ||
| .increment(self.message_count as u64); | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug)] | ||
| pub struct GcsPubsubMessageError<'a> { | ||
| pub subscription: &'a str, | ||
| pub error: &'a dyn std::error::Error, | ||
| } | ||
|
|
||
| impl<'a> InternalEvent for GcsPubsubMessageError<'a> { | ||
| fn emit(self) { | ||
| error!( | ||
| message = "Error receiving messages from GCS Pub/Sub subscription.", | ||
| subscription = %self.subscription, | ||
| error = %self.error, | ||
| error_type = error_type::REQUEST_FAILED, | ||
| stage = error_stage::RECEIVING, | ||
| ); | ||
| counter!( | ||
| "component_errors_total", | ||
| "error_type" => error_type::REQUEST_FAILED, | ||
| "stage" => error_stage::RECEIVING, | ||
| ) | ||
| .increment(1); | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug)] | ||
| pub struct GcsNotificationReceived<'a> { | ||
| pub bucket: &'a str, | ||
| pub object: &'a str, | ||
| pub event_type: &'a str, | ||
| } | ||
|
|
||
| impl<'a> InternalEvent for GcsNotificationReceived<'a> { | ||
| fn emit(self) { | ||
| debug!( | ||
| message = "Received GCS bucket notification.", | ||
| bucket = %self.bucket, | ||
| object = %self.object, | ||
| event_type = %self.event_type, | ||
| ); | ||
| counter!("gcp_cloud_storage_notifications_received_total") | ||
| .increment(1); | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug)] | ||
| pub struct GcsNotificationInvalidEventIgnored<'a> { | ||
| pub bucket: &'a str, | ||
| pub object: &'a str, | ||
| pub event_type: &'a str, | ||
| } | ||
|
|
||
| impl<'a> InternalEvent for GcsNotificationInvalidEventIgnored<'a> { | ||
| fn emit(self) { | ||
| debug!( | ||
| message = "Ignored GCS notification for unsupported event type.", | ||
| bucket = %self.bucket, | ||
| object = %self.object, | ||
| event_type = %self.event_type, | ||
| ); | ||
| counter!("gcp_cloud_storage_notifications_ignored_total") | ||
| .increment(1); | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug)] | ||
| pub struct GcsObjectFilteredByBucket<'a> { | ||
| pub bucket: &'a str, | ||
| pub object: &'a str, | ||
| pub configured_bucket: &'a str, | ||
| } | ||
|
|
||
| impl<'a> InternalEvent for GcsObjectFilteredByBucket<'a> { | ||
| fn emit(self) { | ||
| debug!( | ||
| message = "Filtered out GCS object due to bucket mismatch.", | ||
| bucket = %self.bucket, | ||
| object = %self.object, | ||
| configured_bucket = %self.configured_bucket, | ||
| ); | ||
| counter!("gcp_cloud_storage_objects_filtered_total") | ||
| .increment(1); | ||
| } | ||
| } | ||
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -55,6 +55,8 @@ mod file_descriptor; | |||||
| mod filter; | ||||||
| #[cfg(feature = "sources-fluent")] | ||||||
| mod fluent; | ||||||
| #[cfg(feature = "sources-gcp_cloud_storage")] | ||||||
| mod gcp_cloud_storage; | ||||||
| #[cfg(feature = "sources-gcp_pubsub")] | ||||||
| mod gcp_pubsub; | ||||||
| #[cfg(any(feature = "sources-vector", feature = "sources-opentelemetry"))] | ||||||
|
|
@@ -197,6 +199,8 @@ pub(crate) use self::file_descriptor::*; | |||||
| pub(crate) use self::filter::*; | ||||||
| #[cfg(feature = "sources-fluent")] | ||||||
| pub(crate) use self::fluent::*; | ||||||
| // #[cfg(feature = "sources-gcp_cloud_storage")] | ||||||
| // pub(crate) use self::gcp_cloud_storage::*; | ||||||
|
Comment on lines
+202
to
+203
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| #[cfg(feature = "sources-gcp_pubsub")] | ||||||
| pub(crate) use self::gcp_pubsub::*; | ||||||
| #[cfg(any(feature = "sources-vector", feature = "sources-opentelemetry"))] | ||||||
|
|
||||||
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.
Nit: add newline