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(events): Add internal event id to event metadata #21074

Merged
merged 16 commits into from
Aug 30, 2024

Conversation

ArunPiduguDD
Copy link
Contributor

Overview

Adds an internal event id to all events that pass through Vector. This internal id will be a UUID generated on event creation, and can be used to uniquely identify an event as it traverses through different components in a pipeline.

Testing

Added unit test

Tested using demo_logs source type

@ArunPiduguDD ArunPiduguDD added the no-changelog Changes in this PR do not need user-facing explanations in the release changelog label Aug 14, 2024
@ArunPiduguDD ArunPiduguDD requested a review from a team as a code owner August 14, 2024 18:11
@github-actions github-actions bot added domain: transforms Anything related to Vector's transform components domain: core Anything related to core crates i.e. vector-core, core-common, etc and removed domain: transforms Anything related to Vector's transform components labels Aug 14, 2024
Copy link
Member

@pront pront left a comment

Choose a reason for hiding this comment

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

Overall this looks good and simple 👍 I would like to get at least one more review/stamp on this before merging.

Another good test to have, is to generate an event at source, pass it through a transform and observe that the generated ID was preserved.

lib/vector-core/proto/event.proto Outdated Show resolved Hide resolved
Copy link
Member

@bruceg bruceg left a comment

Choose a reason for hiding this comment

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

It would be interesting to see examples of how this could be used, and I agree with the recommendation to consider V7 UUIDs, but otherwise this makes sense to me.

lib/vector-core/Cargo.toml Outdated Show resolved Hide resolved
lib/vector-core/proto/event.proto Outdated Show resolved Hide resolved
lib/vector-core/src/event/metadata.rs Outdated Show resolved Hide resolved
@datadog-vectordotdev
Copy link

datadog-vectordotdev bot commented Aug 15, 2024

Datadog Report

Branch report: internal-event-id
Commit report: acfc653
Test service: vector

✅ 0 Failed, 7 Passed, 0 Skipped, 25.56s Total Time

@jorgehermo9
Copy link
Contributor

jorgehermo9 commented Aug 15, 2024

Some test fail due to the fact that EventMetadata::Default() is now not deterministic (as uuid are random). Don't know what to do to fix that without involving much changes 🤔

Maybe a manual impl of PartialEq for that struct, so that the uuid field is ignored in the comparison...

@ArunPiduguDD
Copy link
Contributor Author

ArunPiduguDD commented Aug 19, 2024

Some test fail due to the fact that EventMetadata::Default() is now not deterministic (as uuid are random). Don't know what to do to fix that without involving much changes 🤔

Maybe a manual impl of PartialEq for that struct, so that the uuid field is ignored in the comparison...

@jorgehermo9 ended up using the derivative crate to ignore PartialEq (saw this crate is used in other parts of the vector codebase, but lmk if you think there might be any issues introduced by this)

@jorgehermo9
Copy link
Contributor

yep, thats sounds like what I would do, lgtm

@ArunPiduguDD ArunPiduguDD enabled auto-merge August 19, 2024 18:40
@ArunPiduguDD ArunPiduguDD removed the request for review from jszwedko August 19, 2024 21:41
@ArunPiduguDD ArunPiduguDD requested review from a team as code owners August 19, 2024 22:53
@github-actions github-actions bot added domain: transforms Anything related to Vector's transform components domain: sinks Anything related to the Vector's sinks domain: ci Anything related to Vector's CI environment labels Aug 19, 2024
@github-actions github-actions bot removed the domain: core Anything related to core crates i.e. vector-core, core-common, etc label Aug 27, 2024
@ArunPiduguDD ArunPiduguDD added this pull request to the merge queue Aug 27, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Aug 27, 2024
@jorgehermo9
Copy link
Contributor

jorgehermo9 commented Aug 27, 2024

I see that a lot of files were included in a30e417. Maybe should this PR be reviewed and approved again before including it in the merge queue? @bruceg

@ArunPiduguDD
Copy link
Contributor Author

I see that a lot of files were included in a30e417. Maybe should this PR be reviewed and approved again before including it in the merge queue? @bruceg

Had a discussion with @bruceg and @jszwedko offline about regenerating these test fixtures, can wait for another stamp of approval before merging

@ArunPiduguDD ArunPiduguDD requested a review from bruceg August 27, 2024 21:59
@jszwedko
Copy link
Member

Small nit: we generally like to discourage force-pushes to Vector PRs once reviews have started as it makes the PR history more difficult to understand. Instead of rebasing you can merge in master as needed. The PR is ultimately squashed into a single commit when merging so you don't have to worry about maintaining a clean history in the PR itself.

I'm realizing this isn't mentioned in https://github.com/vectordotdev/vector/blob/master/CONTRIBUTING.md. I'll add a note there.

Copy link
Member

@bruceg bruceg left a comment

Choose a reason for hiding this comment

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

The existing code LGTM. This will need to have the new pre-v41 added to the test suite in lib/codecs/tests/native.rs however.

lib/vector-core/src/event/proto.rs Outdated Show resolved Hide resolved
lib/vector-core/src/event/metadata.rs Outdated Show resolved Hide resolved
@ArunPiduguDD ArunPiduguDD requested a review from bruceg August 28, 2024 17:01
Comment on lines 25 to 28
#[test]
fn pre_v41_fixtures_match() {
fixtures_match("pre-v41");
}
Copy link
Member

Choose a reason for hiding this comment

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

I think we also need tests of roundtrip_fixtures and decoding_matches.

Copy link
Contributor Author

@ArunPiduguDD ArunPiduguDD Aug 28, 2024

Choose a reason for hiding this comment

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

It looks like the decoding_matches tests are broken due to #18570. Will add the ignore flag for the pre-v41 test as well unless there is an existing fix

@ArunPiduguDD ArunPiduguDD requested a review from bruceg August 28, 2024 17:36
@ArunPiduguDD ArunPiduguDD added this pull request to the merge queue Aug 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 29, 2024
Copy link
Contributor Author

@ArunPiduguDD ArunPiduguDD left a comment

Choose a reason for hiding this comment

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

/ci-run-regression

Copy link
Contributor Author

@ArunPiduguDD ArunPiduguDD left a comment

Choose a reason for hiding this comment

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

/ci-run-regression

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.

/ci-run-regression

@ArunPiduguDD ArunPiduguDD added this pull request to the merge queue Aug 29, 2024
Merged via the queue into master with commit 06ad674 Aug 30, 2024
50 checks passed
@ArunPiduguDD ArunPiduguDD deleted the internal-event-id branch August 30, 2024 00:06
AndrooTheChen pushed a commit to discord/vector that referenced this pull request Sep 23, 2024
…1074)

* add internal event id to event metadata

* fix formatting

* formatting

* rename source_event_id + use uuid v7 + add uuid as workspace dependency

* cargo fmt

* use derivative crate to ignore source_event_id field for PartialEq

* rebase + merge

* fix Cargo.toml file

* add protobuf parsing for event id field

* generate new test fixtures

* Update Cargo.lock

* add pre-v41 to native.rs test-suit + fix import re-ordering

* add pre-v41 tests for roundtrip_fixtures & decoding_matches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Changes in this PR do not need user-facing explanations in the release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants