Skip to content

Commit 80e2400

Browse files
authored
Replace Meter.Id.getTags() with cheaper alternatives (#6147)
Signed-off-by: Johnny Lim <[email protected]>
1 parent 5ecf892 commit 80e2400

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

implementations/micrometer-registry-dynatrace/src/main/java/io/micrometer/dynatrace/v2/DynatraceExporterV2.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ private Stream<String> toMeterLine(Meter meter, BiFunction<Meter, Measurement, S
403403
private MetricLineBuilder.TypeStep createTypeStep(Meter meter) throws MetricException {
404404
MetricLineBuilder.TypeStep typeStep = MetricLineBuilder.create(preConfiguration)
405405
.metricKey(meter.getId().getName());
406-
for (Tag tag : meter.getId().getTags()) {
406+
for (Tag tag : meter.getId().getTagsAsIterable()) {
407407
typeStep.dimension(tag.getKey(), tag.getValue());
408408
}
409409

micrometer-core/src/main/java/io/micrometer/core/instrument/Meter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public Id withTag(Tag tag) {
239239
* @since 1.1.0
240240
*/
241241
public Id withTags(Iterable<Tag> tags) {
242-
return new Id(name, Tags.concat(getTags(), tags), baseUnit, description, type);
242+
return new Id(name, Tags.concat(this.tags, tags), baseUnit, description, type);
243243
}
244244

245245
/**

micrometer-core/src/main/java/io/micrometer/core/instrument/search/Search.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ private boolean isTagsMatched(Meter.Id id) {
241241
private boolean isRequiredTagKeysPresent(Meter.Id id) {
242242
if (!requiredTagKeys.isEmpty()) {
243243
final Set<String> tagKeys = new HashSet<>();
244-
id.getTags().forEach(t -> tagKeys.add(t.getKey()));
244+
id.getTagsAsIterable().forEach(t -> tagKeys.add(t.getKey()));
245245
return tagKeys.containsAll(requiredTagKeys);
246246
}
247247
return true;
@@ -250,7 +250,7 @@ private boolean isRequiredTagKeysPresent(Meter.Id id) {
250250
private boolean isTagPredicatesMatched(Meter.Id id) {
251251
if (!tagMatches.isEmpty()) {
252252
final Set<String> matchingTagKeys = new HashSet<>();
253-
id.getTags().forEach(t -> {
253+
id.getTagsAsIterable().forEach(t -> {
254254
Collection<Predicate<String>> tagValueMatchers = tagMatches.get(t.getKey());
255255
if (tagValueMatchers != null) {
256256
if (tagValueMatchers.stream().allMatch(matcher -> matcher.test(t.getValue()))) {

0 commit comments

Comments
 (0)