Skip to content

enhancement(metrics): Add rename tag name function for metrics#25357

Closed
ArunPiduguDD wants to merge 1 commit intomasterfrom
add-rename-tag-function
Closed

enhancement(metrics): Add rename tag name function for metrics#25357
ArunPiduguDD wants to merge 1 commit intomasterfrom
add-rename-tag-function

Conversation

@ArunPiduguDD
Copy link
Copy Markdown
Contributor

@ArunPiduguDD ArunPiduguDD commented May 4, 2026

Summary

Add a helper function to rename existing tags in a metric with replacement (will be used in follow-up PRs)

How did you test this PR?

Added unit tests

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • 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 on the dd-rust-license-tool.

@ArunPiduguDD ArunPiduguDD added the no-changelog Changes in this PR do not need user-facing explanations in the release changelog label May 4, 2026
@github-actions github-actions Bot added the domain: core Anything related to core crates i.e. vector-core, core-common, etc label May 4, 2026
@ArunPiduguDD ArunPiduguDD changed the title Add rename tag name function for metrics chore(metrics): Add rename tag name function for metrics May 4, 2026
@ArunPiduguDD ArunPiduguDD changed the title chore(metrics): Add rename tag name function for metrics enhancement(metrics): Add rename tag name function for metrics May 4, 2026
@ArunPiduguDD ArunPiduguDD marked this pull request as ready for review May 4, 2026 17:40
@ArunPiduguDD ArunPiduguDD requested a review from a team as a code owner May 4, 2026 17:40
@ArunPiduguDD ArunPiduguDD requested a review from pront May 4, 2026 17:42

/// Rename a tag from `old_name` to `new_name`, overwriting `new_name` if it already exists.
/// Returns `true` if the rename was performed.
pub fn rename_with_replacement(&mut self, old_name: &str, new_name: String) -> bool {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could this be accomplished better by adding another remove function that doesn't call TagValueSet::into_single and then calling set_multi_value in the code that needs this method?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah that's a good suggestion. Will go with that instead

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will close this PR to have an accurate branch name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@github-actions github-actions Bot locked and limited conversation to collaborators May 4, 2026
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 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.

2 participants