Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve MemberToMetricMappings a bit, add javadoc #446

Merged
merged 1 commit into from
Aug 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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