Skip to content

Conversation

@bruceg
Copy link
Member

@bruceg bruceg commented Dec 2, 2025

Summary

The existing code would create an EventMetadata::default() and then fill in the fields coming from the protobuf metadata. Unfortunately, this default creates several non-empty values, notably the source_event_id, which makes that construct take extra time, particularly since the incoming data will (almost?) always already have a source_event_id if the origin is another Vector instance.

While refactoring, I also changed the method to use destructuring to access the fields inside the source value to force the compiler to error if any fields are added later.

Vector configuration

How did you test this PR?

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

Notes

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • Some CI checks run only after we manually approve them.
    • We recommend adding a pre-push hook, please see this template.
    • Alternatively, we recommend running the following locally before pushing to the remote branch:
      • make fmt
      • make check-clippy (if there are failures it's possible some of them can be fixed with make clippy-fix)
      • make test
  • After a review is requested, please avoid force pushes to help us review incrementally.
    • Feel free to push as many commits as you want. They will be squashed into one before merging.
    • For example, you can run git merge origin master and git push.
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run make build-licenses to regenerate the license inventory and commit the changes (if any). More details here.

…tobuf

The existing code would create an `EventMetadata::default()` and then fill in
the fields coming from the protobuf metadata. Unfortunately, this default
creates several non-empty values, notably the `source_event_id`, which makes
that construct take extra time, particularly since the incoming data will
(almost?) always already have a `source_event_id` if the origin is another
Vector instance.

While refactoring, I also changed the method to use destructuring to access the
fields inside the source value to force the compiler to error if any fields are
added later.
@bruceg bruceg requested a review from a team as a code owner December 2, 2025 18:57
@bruceg bruceg added type: tech debt A code change that does not add user value. domain: performance Anything related to Vector's performance no-changelog Changes in this PR do not need user-facing explanations in the release changelog labels Dec 2, 2025
@github-actions github-actions bot added the domain: core Anything related to core crates i.e. vector-core, core-common, etc label Dec 2, 2025
Copy link
Contributor

@thomasqueirozb thomasqueirozb left a comment

Choose a reason for hiding this comment

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

Nice!

@bruceg bruceg enabled auto-merge December 9, 2025 18:13
@bruceg bruceg added this pull request to the merge queue Dec 9, 2025
Merged via the queue into master with commit cf6e329 Dec 9, 2025
99 checks passed
@bruceg bruceg deleted the refactor-proto-event-metadata branch December 9, 2025 18:51
@github-actions github-actions bot locked and limited conversation to collaborators Dec 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

domain: core Anything related to core crates i.e. vector-core, core-common, etc domain: performance Anything related to Vector's performance no-changelog Changes in this PR do not need user-facing explanations in the release changelog type: tech debt A code change that does not add user value.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants