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