Repository navigation
refactor(bvar): Introduce FixedVector as a clearer name - #3777
Open
darion-yaphet wants to merge 2 commits into
Open
darion-yaphet wants to merge 2 commits into
darion-yaphet wants to merge 2 commits into
Conversation
Use FixedVector for the fixed-size co-plotting metric type to avoid confusion with std::vector. Keep Vector and is_vector as aliases. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep Vector as the class template and expose FixedVector as an alias to preserve forward declarations, derived constructors, explicit instantiations, and symbol identity. Preserve legacy is_vector specializations and default series labels. Add regression coverage for both names and existing client usage. Co-authored-by: darion-yaphet <darion-yaphet@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported, and the change includes compatibility-preserving updates with regression coverage for the new alias, traits, behavior, and labels.
No open issues 🎉
What changed in this PR
This pull request introduces bvar::FixedVector as a clearer alias for the existing fixed-size bvar::Vector type while preserving source, binary, trait, and graph-label compatibility.
Changes:
- Adds the
FixedVectoralias andis_fixed_vectortrait while retaining legacy names and traits. - Updates bvar series, latency recorder, and server metrics to use
FixedVectorinternally. - Adds regression tests covering compatibility, type behavior, arithmetic, streaming, and graph labels.
| File | Description |
|---|---|
| test/bvar_vector_unittest.cpp | Adds regression coverage for both vector names, compatibility traits, behavior, and series labels. |
| src/bvar/vector.h | Defines the FixedVector alias and compatibility trait while preserving the original Vector type. |
| src/bvar/variable.cpp | Updates the vector-related flag description. |
| src/bvar/passive_status.h | Uses the fixed-vector trait when determining additive metric values. |
| src/bvar/latency_recorder.h | Uses FixedVector for latency percentile APIs and storage. |
| src/bvar/latency_recorder.cpp | Updates latency percentile computation and return types to use FixedVector. |
| src/bvar/detail/series.h | Updates vector-specific series and aggregation specializations to use FixedVector. |
| src/brpc/server.cpp | Uses FixedVector for session-local metric values. |
Review effort: Lite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FixedVectoras an alias for bvar's fixed-sizeVectortype and use the clearer name internally.is_vectorspecializations, and default graph labels for compatibility.Risk and Rollback
Vectorremains the underlying class template to preserve existing source and binary compatibility. Revert the branch commits to roll back the naming change.