Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan202 committed Oct 4, 2024
1 parent a9062ba commit da9c82b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,17 @@
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@State(Scope.Benchmark)
public class MicrometerMeterListenerConfigurationResolveTagsBenchmark {
@Param({"1", "2", "5", "10"})
private int distinctTagCount;

@Param({"1", "2", "5", "10"})
private int totalTagCount;
@Param({"1|1", "1|2", "1|5", "1|10", "2|2", "2|5", "2|10", "5|5", "5|10", "10|10"})
private String testCase;

private Publisher<Void> publisher;

@Setup(Level.Iteration)
public void setup() {
String[] arguments = testCase.split("\\|", -1);
int distinctTagCount = Integer.parseInt(arguments[0]);
int totalTagCount = Integer.parseInt(arguments[1]);

publisher = addTags(Mono.empty(), distinctTagCount, totalTagCount);
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Baselines, should be updated on every release
baseline-core-api = "3.6.10"
baselinePerfCore = "3.6.10"
baselinePerfCoreMicrometer = "1.1.9"
baselinePerfCoreMicrometer = "1.1.10"
baselinePerfExtra = "3.5.2"

# Other shared versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ static Tags resolveTags(Publisher<?> source, Tags tags) {
Scannable scannable = Scannable.from(source);

if (scannable.isScanAvailable()) {
// `Tags#and` deduplicates tags by key, retaining the last value as required.
List<Tag> discoveredTags = scannable.tags()
.map(t -> Tag.of(t.getT1(), t.getT2()))
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ static KeyValues resolveKeyValues(Publisher<?> source, KeyValues tags) {
Scannable scannable = Scannable.from(source);

if (scannable.isScanAvailable()) {
// `KeyValues#and` deduplicates tags by key, retaining the last value as required.
List<KeyValue> discoveredTags = scannable.tags()
.map(e -> KeyValue.of(e.getT1(), e.getT2()))
.collect(Collectors.toList());
Expand Down
4 changes: 3 additions & 1 deletion reactor-core/src/main/java/reactor/core/Scannable.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2023 VMware Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2017-2024 VMware Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -627,7 +627,9 @@ default Stream<Tuple2<String, String>> tags() {
*
* @return a {@link Map} of deduplicated tags from this {@link Scannable} and its reachable parents
* @see #tags()
* @deprecated Micrometer APIs generally deduplicate tags and key-value pairs by default, so for related use cases prefer {@link #tags()}.
*/
@Deprecated
default Map<String, String> tagsDeduplicated() {
return tags().collect(Collectors.toMap(Tuple2::getT1, Tuple2::getT2,
(s1, s2) -> s2, LinkedHashMap::new));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ static Tags resolveTags(Publisher<?> source, Tags tags) {
Scannable scannable = Scannable.from(source);

if (scannable.isScanAvailable()) {
// `Tags#and` deduplicates tags by key, retaining the last value as required.
List<Tag> discoveredTags = scannable.tags()
.map(t -> Tag.of(t.getT1(), t.getT2()))
.collect(Collectors.toList());
Expand Down

0 comments on commit da9c82b

Please sign in to comment.