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(loki sinks): Fix loki event timestamp out of range panic #20780

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

suikammd
Copy link
Contributor

@suikammd suikammd commented Jul 3, 2024

Fix #20763

@suikammd suikammd requested a review from a team as a code owner July 3, 2024 03:27
@github-actions github-actions bot added the domain: sinks Anything related to the Vector's sinks label Jul 3, 2024
let mut sink = LokiSink::new(config, client).unwrap();

let mut e1 = LogEvent::from("hello world");
use vector_lib::config::log_schema;

Choose a reason for hiding this comment

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

should we move this use statement to the beginning of this tests module?

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.

Thanks @suikammd ! I left a question below about the behavior.


impl InternalEvent for LokiEventTimestampOutOfRangeError {
fn emit(self) {
error!(
Copy link
Member

Choose a reason for hiding this comment

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

Should we make this a warn! since it doesn't actually inhibit processing? Also, what happens when we send an event to Loki without a timestamp? Does it just use the current timestamp?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to Loki api, timestamp is must.


#[tokio::test]
async fn timestamp_out_of_range() {
use vector_lib::config::log_schema;

Choose a reason for hiding this comment

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

I meant the beggining of this module, about line 10. It is more idiomatic to have all the use statements at the begginning of the module, so we don't have to dive into each scope and find those statements.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Get it, check the new commit.

Choose a reason for hiding this comment

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

yes, thats it! Thanks :)

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vector panics when Loki timestamp nanoseconds are unparseable
3 participants