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

fix(kafka sink): remove restriction on data type #18266

Closed
wants to merge 1 commit into from

Conversation

hvtuananh
Copy link

closes #18252

@hvtuananh hvtuananh requested a review from dsmith3197 as a code owner August 16, 2023 04:23
@hvtuananh hvtuananh requested a review from a team August 16, 2023 04:23
@netlify
Copy link

netlify bot commented Aug 16, 2023

Deploy Preview for vrl-playground ready!

Name Link
🔨 Latest commit 837ebc6
🔍 Latest deploy log https://app.netlify.com/sites/vrl-playground/deploys/64dc5016128e890008b654c6
😎 Deploy Preview https://deploy-preview-18266--vrl-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added the domain: sinks Anything related to the Vector's sinks label Aug 16, 2023
@netlify
Copy link

netlify bot commented Aug 16, 2023

Deploy Preview for vector-project canceled.

Name Link
🔨 Latest commit 837ebc6
🔍 Latest deploy log https://app.netlify.com/sites/vector-project/deploys/64dc50169222920008604abc

@hvtuananh hvtuananh changed the title fix(kafka source): remove restriction on data type fix(kafka sink): remove restriction on data type Aug 16, 2023
Copy link
Member

@jszwedko jszwedko left a comment

Choose a reason for hiding this comment

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

Hi @hvtuananh ,

Thanks for this!

I think it'd be good to add a test. I'm already seeing a few other places that need to be updated:

fn get_key(event: &Event, key_field: &Option<String>) -> Option<Bytes> {
key_field.as_ref().and_then(|key_field| match event {
Event::Log(log) => log
.get(key_field.as_str())
.map(|value| value.coerce_to_bytes()),
Event::Metric(metric) => metric
.tags()
.and_then(|tags| tags.get(key_field))
.map(|value| value.to_owned().into()),
_ => None,
})
}
fn get_timestamp_millis(event: &Event) -> Option<i64> {
match &event {
Event::Log(log) => log.get_timestamp().and_then(|v| v.as_timestamp()).copied(),
Event::Metric(metric) => metric.timestamp(),
_ => None,
}
.map(|ts| ts.timestamp_millis())
}

And, potentially, here:

fn get_headers(event: &Event, headers_key: &Option<String>) -> Option<OwnedHeaders> {
headers_key.as_ref().and_then(|headers_key| {
if let Event::Log(log) = event {
if let Some(headers) = log.get(headers_key.as_str()) {
match headers {
Value::Object(headers_map) => {
let mut owned_headers = OwnedHeaders::new_with_capacity(headers_map.len());
for (key, value) in headers_map {
if let Value::Bytes(value_bytes) = value {
owned_headers = owned_headers.insert(Header {
key,
value: Some(value_bytes.as_ref()),
});
} else {
emit!(KafkaHeaderExtractionError {
header_field: headers_key
});
}
}
return Some(owned_headers);
}
_ => {
emit!(KafkaHeaderExtractionError {
header_field: headers_key
});
}
}
}
}
None
})
}

As those places have different logic depending on the incoming data type and need to be updated to handle traces.

@jszwedko
Copy link
Member

@pront pront added the sink: kafka Anything `kafka` sink related label Aug 16, 2023
@dsmith3197 dsmith3197 added the meta: awaiting author Pull requests that are awaiting their author. label Aug 17, 2023
@Sparkymann
Copy link

Hello folks. Any updates on this one ? ;)

@jszwedko jszwedko requested a review from a team as a code owner October 3, 2024 18:54
@pront
Copy link
Member

pront commented Jan 27, 2025

Thank you for your contribution to Vector! To keep the repository tidy and focused, we are closing this PR due to inactivity. We greatly appreciate the time and effort you've put into this PR.If you'd like to continue working on it, we encourage you to re-open the PR and we would be delighted to review it again. Before re-opening, please use git merge origin master to resolve any conflicts with origin/master.

@pront pront closed this Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: sinks Anything related to the Vector's sinks meta: awaiting author Pull requests that are awaiting their author. sink: kafka Anything `kafka` sink related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kafka sink should support Trace output
5 participants