Skip to content

Commit

Permalink
Improve MemberToMetricMappings a bit, add javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartisk committed Aug 11, 2021
1 parent 3067fc0 commit 59cf49b
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@

import io.smallrye.metrics.elementdesc.MemberInfo;

/**
* This class represents mappings between Java methods and the set of metric IDs
* associated with them. This is computed once at boot/build time to avoid having to
* do runtime reflection on every invocation of the relevant methods.
*
* This class does NOT use thread-safe map implementations, so populating the mappings
* must only be performed by one thread. Querying the mappings later at runtime can be done
* concurrently.
*/
public class MemberToMetricMappings {

MemberToMetricMappings() {
Expand All @@ -37,11 +46,11 @@ public class MemberToMetricMappings {
simpleTimers = new HashMap<>();
}

private Map<MemberInfo, Set<MetricID>> counters;
private Map<MemberInfo, Set<MetricID>> concurrentGauges;
private Map<MemberInfo, Set<MetricID>> meters;
private Map<MemberInfo, Set<MetricID>> timers;
private Map<MemberInfo, Set<MetricID>> simpleTimers;
private final Map<MemberInfo, Set<MetricID>> counters;
private final Map<MemberInfo, Set<MetricID>> concurrentGauges;
private final Map<MemberInfo, Set<MetricID>> meters;
private final Map<MemberInfo, Set<MetricID>> timers;
private final Map<MemberInfo, Set<MetricID>> simpleTimers;

public Set<MetricID> getCounters(MemberInfo member) {
return counters.get(member);
Expand Down

0 comments on commit 59cf49b

Please sign in to comment.