Skip to content

Commit e44977d

Browse files
authored
Fix deadlock in SysdigStatsdLineBuilder (#2327)
See gh-2325
1 parent 008d479 commit e44977d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

implementations/micrometer-registry-statsd/src/main/java/io/micrometer/statsd/internal/SysdigStatsdLineBuilder.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,15 @@ private static String sanitize(String name) {
7272
}
7373

7474
private String tagsByStatistic(@Nullable Statistic stat) {
75-
return stat == null ? tagsNoStat : tags.computeIfAbsent(stat, this::sysdigTag);
76-
}
77-
78-
private String sysdigTag(@Nullable Statistic stat) {
75+
if (stat == null) {
76+
return tagsNoStat;
77+
}
78+
String tags = this.tags.get(stat);
79+
if (tags != null) {
80+
return tags;
81+
}
7982
synchronized (conventionTagsLock) {
80-
return tags(stat, conventionTags, "=", "#");
83+
return this.tags.computeIfAbsent(stat, (key) -> tags(stat, conventionTags, "=", "#"));
8184
}
8285
}
8386
}

0 commit comments

Comments
 (0)