allow activity metrics to be named directly

This commit is contained in:
Jonathan Shook 2021-12-21 13:08:22 -06:00
parent 038ba7e363
commit 5209f6e7bc

View File

@ -125,6 +125,17 @@ public class ActivityMetrics {
return registeredTimer; return registeredTimer;
} }
public static Timer timer(String fullMetricName) {
NicerTimer timer = get().register(fullMetricName, new NicerTimer(
fullMetricName,
new DeltaHdrHistogramReservoir(
fullMetricName,
_HDRDIGITS
))
);
return timer;
}
/** /**
* <p>Create an HDR histogram associated with an activity.</p> * <p>Create an HDR histogram associated with an activity.</p>
* *
@ -151,6 +162,17 @@ public class ActivityMetrics {
)); ));
} }
public static Histogram histogram(String fullname) {
NicerHistogram histogram = get().register(fullname, new NicerHistogram(
fullname,
new DeltaHdrHistogramReservoir(
fullname,
_HDRDIGITS
)
));
return histogram;
}
/** /**
* <p>Create a counter associated with an activity.</p> * <p>Create a counter associated with an activity.</p>
* <p>This method ensures that if multiple threads attempt to create the same-named metric on a given activity, * <p>This method ensures that if multiple threads attempt to create the same-named metric on a given activity,