Skip to content
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: Built-in Pulsar source #2237

Merged
merged 21 commits into from
Dec 3, 2024
Merged

feat: Built-in Pulsar source #2237

merged 21 commits into from
Dec 3, 2024

Conversation

BulkBeing
Copy link
Contributor

@BulkBeing BulkBeing commented Nov 22, 2024

Status: Tested by running a Pipeline and a Monovertex with Pulsar as built-in source

vigith and others added 2 commits November 21, 2024 20:25
Copy link

codecov bot commented Nov 22, 2024

Codecov Report

Attention: Patch coverage is 73.85621% with 120 lines in your changes missing coverage. Please review.

Project coverage is 63.95%. Comparing base (c5afc90) to head (8d4d4e1).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
rust/numaflow-extns/pulsar/src/source.rs 76.53% 42 Missing ⚠️
rust/numaflow-core/src/monovertex.rs 37.50% 15 Missing ⚠️
rust/numaflow-core/src/source/pulsar.rs 86.60% 15 Missing ⚠️
rust/numaflow-core/src/config/components.rs 76.66% 14 Missing ⚠️
rust/numaflow-core/src/source.rs 0.00% 12 Missing ⚠️
rust/numaflow-core/src/pipeline.rs 0.00% 8 Missing ⚠️
rust/numaflow-core/src/shared/utils.rs 0.00% 6 Missing ⚠️
rust/numaflow-extns/pulsar/src/lib.rs 0.00% 6 Missing ⚠️
rust/numaflow-core/src/message.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2237      +/-   ##
==========================================
+ Coverage   63.91%   63.95%   +0.03%     
==========================================
  Files         338      342       +4     
  Lines       41085    41203     +118     
==========================================
+ Hits        26259    26350      +91     
- Misses      13756    13780      +24     
- Partials     1070     1073       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 123 to 143
impl TryFrom<PulsarMessage> for Message {
type Error = Error;

fn try_from(message: PulsarMessage) -> Result<Self> {
let offset = Offset::Int(IntOffset::new(message.offset, 1)); // FIXME: partition id

Ok(Message {
keys: vec![message.key],
value: message.payload,
offset: Some(offset.clone()),
event_time: message.event_time,
id: MessageID {
vertex_name: get_vertex_name().to_string(),
offset: offset.to_string(),
index: 0,
},
headers: message.headers,
})
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this to source/pulsar.rs

Comment on lines 19 to 25
type PulsarSource struct {
ServerAddr string `json:"serverAddr" protobuf:"bytes,1,name=server_addr"`
Topic string `json:"topic" protobuf:"bytes,2,name=topic"`
ConsumerName string `json:"consumerName" protobuf:"bytes,3,name=consumerName"`
SubscriptionName string `json:"subscriptionName" protobuf:"bytes,4,name=subscriptionName"`
MaxUnack uint32 `json:"maxUnack,omitempty" protobuf:"bytes,5,opt,name=maxUnack"`
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add TLS and Auth too, if you prefer you can do that in a follow up PR.

Comment on lines +104 to +106
if source.udsource.is_some() {
return Ok(SourceType::UserDefined(UserDefinedConfig::default()));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if source.udsource.is_some() {
return Ok(SourceType::UserDefined(UserDefinedConfig::default()));
}
if source.udsource.is_some().take() {
return Ok(SourceType::UserDefined(UserDefinedConfig::default()));
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Option.take() returns the inner value as an option. We can't use it in if statement.

Comment on lines 60 to 74
impl From<numaflow_pulsar::Error> for Error {
fn from(value: numaflow_pulsar::Error) -> Self {
match value {
numaflow_pulsar::Error::Pulsar(e) => Error::Source(e.to_string()),
numaflow_pulsar::Error::UnknownOffset(_) => Error::Source(value.to_string()),
numaflow_pulsar::Error::AckPendingExceeded(pending) => {
Error::AckPendingExceeded(pending)
}
numaflow_pulsar::Error::ActorTaskTerminated(_) => {
Error::ActorPatternRecv(value.to_string())
}
numaflow_pulsar::Error::Other(e) => Error::Source(e),
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this to `source/pulsar.rs?

Comment on lines 125 to 126
pub offset: u64,
pub partition_idx: u16,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub offset: u64,
pub partition_idx: u16,
pub(crate) offset: u64,
pub(crate) partition_idx: u16,

@@ -207,6 +207,41 @@ pub(crate) async fn create_sink_handle(
}
}

/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this?

@@ -14,6 +14,7 @@ pub(crate) mod user_defined;
///
/// [Generator]: https://numaflow.numaproj.io/user-guide/sources/generator/
pub(crate) mod generator;
pub(crate) mod pulsar;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add doc?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any value in committing this file? /cc @whynowy

@BulkBeing BulkBeing marked this pull request as ready for review December 2, 2024 06:30
@BulkBeing BulkBeing requested a review from whynowy as a code owner December 2, 2024 06:30
Copy link
Member

@vigith vigith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add metrics in a follow up PR

Signed-off-by: Vigith Maurice <[email protected]>
@yhl25 yhl25 merged commit b31380b into main Dec 3, 2024
28 checks passed
@yhl25 yhl25 deleted the pulsar branch December 3, 2024 03:38
SaniyaKalamkar pushed a commit to SaniyaKalamkar/numaflow that referenced this pull request Jan 19, 2025
Signed-off-by: Vigith Maurice <[email protected]>
Signed-off-by: Sreekanth <[email protected]>
Co-authored-by: Vigith Maurice <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants