File tree 1 file changed +9
-4
lines changed
micrometer-core/src/main/java/io/micrometer/core/instrument
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -244,8 +244,7 @@ public Id withTags(Iterable<Tag> tags) {
244
244
/**
245
245
* Generate a new id replacing all tags with new ones.
246
246
* @param tags The tags to add.
247
- * @return A new id with the only the provided tags. The source id remains
248
- * unchanged.
247
+ * @return A new id with only the provided tags. The source id remains unchanged.
249
248
* @since 1.1.0
250
249
*/
251
250
public Id replaceTags (Iterable <Tag > tags ) {
@@ -282,8 +281,14 @@ public String getName() {
282
281
* @return A set of dimensions that allows you to break down the name.
283
282
*/
284
283
public List <Tag > getTags () {
285
- List <Tag > tags = new ArrayList <>();
286
- this .tags .forEach (tags ::add );
284
+ if (this .tags == Tags .empty ()) {
285
+ return Collections .emptyList ();
286
+ }
287
+
288
+ List <Tag > tags = new ArrayList <>(32 );
289
+ for (Tag tag : this .tags ) {
290
+ tags .add (tag );
291
+ }
287
292
return Collections .unmodifiableList (tags );
288
293
}
289
294
You can’t perform that action at this time.
0 commit comments