-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
order and sort
AbstractMethodTagger
before applying Tags (#812)
A use case might be that multiple taggers might use the same tag name, when determining which takes precedence in those situations felt like some sort of order / sorting would be needed
- Loading branch information
Showing
7 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...core/src/test/java/io/micronaut/configuration/metrics/aggregator/OrderedMethodTagger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.micronaut.configuration.metrics.aggregator; | ||
|
||
import io.micrometer.core.instrument.Tag; | ||
import io.micronaut.aop.MethodInvocationContext; | ||
import jakarta.inject.Singleton; | ||
|
||
import java.util.List; | ||
|
||
@Singleton | ||
public class OrderedMethodTagger extends AbstractMethodTagger{ | ||
@Override | ||
public int getOrder() { | ||
return 1; | ||
} | ||
|
||
@Override | ||
public List<Tag> buildTags(MethodInvocationContext<Object, Object> context) { | ||
return List.of(Tag.of("ordered", String.valueOf(getOrder()))); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...ore/src/test/java/io/micronaut/configuration/metrics/aggregator/OrderedMethodTagger2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.micronaut.configuration.metrics.aggregator; | ||
|
||
import io.micrometer.core.instrument.Tag; | ||
import io.micronaut.aop.MethodInvocationContext; | ||
import jakarta.inject.Singleton; | ||
|
||
import java.util.List; | ||
|
||
@Singleton | ||
public class OrderedMethodTagger2 extends AbstractMethodTagger{ | ||
@Override | ||
public int getOrder() { | ||
return 2; | ||
} | ||
|
||
@Override | ||
public List<Tag> buildTags(MethodInvocationContext<Object, Object> context) { | ||
return List.of(Tag.of("ordered", String.valueOf(getOrder()))); | ||
} | ||
} |