Skip to content

Add additional helper methods to TagList#1240

Merged
brharrington merged 2 commits into
Netflix:mainfrom
kilink:tag-list-helpers
Jun 1, 2026
Merged

Add additional helper methods to TagList#1240
brharrington merged 2 commits into
Netflix:mainfrom
kilink:tag-list-helpers

Conversation

@kilink

@kilink kilink commented Jun 1, 2026

Copy link
Copy Markdown
Member

Add a TagList.create method that accepts an Iterable of tags, a method for getting the static empty TagList singleton, and a collector for creating a TagList from a Stream of Tags.

For cases where some global tags are computed and re-used, using these methods can be beneficial since it will do the conversion to an ArrayTagSet once.

Add a TagList.create method that accepts an Iterable of tags, a method for getting
the static empty TagList singleton, and a collector for creating a TagList from a
Stream of Tags.

For cases where some global tags are computed and re-used, using these methods can
be beneficial since it will do the conversion to an ArrayTagSet once.
@kilink kilink requested a review from brharrington June 1, 2026 19:40
@brharrington brharrington added this to the 1.9.8 milestone Jun 1, 2026
Comment thread spectator-api/src/test/java/com/netflix/spectator/api/TagListTest.java Outdated
* limitations under the License.
*/
public class TagListTest {
@Test

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we use 2-space indent to be consistent with the rest of the repo?

- Use 2-space indentation and move the license header to the top of the
  file to match repo conventions.
- Fix CustomTag.equals to compare against the Tag interface instead of
  casting to CustomTag, which would throw ClassCastException for other
  Tag implementations and violated the symmetry contract.
- Move the mixed Tag-implementation case into the collected stream in
  testCollector so it actually exercises the collector with a
  heterogeneous stream.
- Drop trailing blank javadoc lines on TagList.empty()/toTagList().
@brharrington brharrington merged commit 5394db2 into Netflix:main Jun 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants