mirror of
https://github.com/google/nomulus.git
synced 2025-05-16 01:17:14 +02:00
Add method to create and register EventMetrics
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=132346375
This commit is contained in:
parent
2ba9b01a13
commit
0538c1e210
3 changed files with 65 additions and 0 deletions
|
@ -138,6 +138,29 @@ public class MetricRegistryImplTest {
|
|||
ImmutableSet.of(label)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNewEventMetric_createsEventMetric() {
|
||||
DistributionFitter fitter = CustomFitter.create(ImmutableSet.of(0.0));
|
||||
EventMetric testMetric =
|
||||
MetricRegistryImpl.getDefault()
|
||||
.newEventMetric(
|
||||
"/test_metric",
|
||||
"test_description",
|
||||
"test_valuedisplayname",
|
||||
ImmutableSet.of(label),
|
||||
fitter);
|
||||
|
||||
assertThat(testMetric.getValueClass()).isSameAs(Distribution.class);
|
||||
assertThat(testMetric.getMetricSchema())
|
||||
.isEqualTo(
|
||||
MetricSchema.create(
|
||||
"/test_metric",
|
||||
"test_description",
|
||||
"test_valuedisplayname",
|
||||
Kind.CUMULATIVE,
|
||||
ImmutableSet.of(label)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegister_duplicateMetric_throwsException() {
|
||||
SettableMetric<Boolean> testMetric =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue