Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
jefchien committed Aug 13, 2024
1 parent d0dbd8a commit 588e497
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,13 @@ void doubleValueCallbackMBeans() throws Exception {
String description = "multiple double gauge description";

updateWithHelper(
mBeanHelper, instrumentMethod, instrumentName, description, "Double", new HashMap<>());
mBeanHelper,
instrumentMethod,
instrumentName,
description,
"Double",
new HashMap<>(),
/* aggregateAcrossMBeans= */ true);

assertThat(metricReader.collectAllMetrics())
.satisfiesExactly(
Expand Down Expand Up @@ -713,7 +719,13 @@ void updateWithHelper(
labelFuncs.put(
"labelTwo", (Closure<?>) Eval.me("{ mbean -> mbean.name().getKeyProperty('thing') }"));
updateWithHelper(
mBeanHelper, instrumentMethod, instrumentName, description, attribute, labelFuncs);
mBeanHelper,
instrumentMethod,
instrumentName,
description,
attribute,
labelFuncs,
/* aggregateAcrossMBeans= */ false);
}

void updateWithHelper(
Expand All @@ -722,7 +734,8 @@ void updateWithHelper(
String instrumentName,
String description,
String attribute,
Map<String, Closure<?>> labelFuncs) {
Map<String, Closure<?>> labelFuncs,
boolean aggregateAcrossMBeans) {
Closure<?> instrument = (Closure<?>) Eval.me("otel", otel, "otel.&" + instrumentMethod);
InstrumentHelper instrumentHelper =
new InstrumentHelper(
Expand All @@ -734,7 +747,7 @@ void updateWithHelper(
Collections.singletonMap(attribute, null),
instrument,
metricEnvironment,
false);
aggregateAcrossMBeans);
instrumentHelper.update();
}

Expand Down

0 comments on commit 588e497

Please sign in to comment.