Skip to content

Commit

Permalink
replace "1" with the appropriate units (#8668)
Browse files Browse the repository at this point in the history
Co-authored-by: Mateusz Rzeszutek <[email protected]>
Co-authored-by: Trask Stalnaker <[email protected]>
  • Loading branch information
3 people authored Jun 14, 2023
1 parent 4f12fba commit 8433735
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static String description(Meter.Id id) {

static String baseUnit(Meter.Id id) {
String baseUnit = id.getBaseUnit();
return baseUnit == null ? "1" : baseUnit;
return baseUnit == null ? "" : baseUnit;
}

static String statisticInstrumentName(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ final class OpenTelemetryFunctionTimer<T> extends AbstractMeter
otelMeter
.counterBuilder(name + ".count")
.setDescription(Bridging.description(id))
.setUnit("1")
.setUnit("{invocation}")
.buildWithCallback(new LongMeasurementRecorder<>(obj, countFunction, attributes));

this.observableTotalTime =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void testFunctionTimerWithBaseUnitMilliseconds() {
metric ->
assertThat(metric)
.hasDescription("This is a test function timer")
.hasUnit("1")
.hasUnit("{invocation}")
.hasLongSumSatisfying(
sum ->
sum.isMonotonic()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void testFunctionTimer() {
metric ->
assertThat(metric)
.hasDescription("This is a test function timer")
.hasUnit("1")
.hasUnit("{invocation}")
.hasLongSumSatisfying(
sum ->
sum.isMonotonic()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void testFunctionTimer() {
metric ->
assertThat(metric)
.hasDescription("This is a test function timer")
.hasUnit("1")
.hasUnit("{invocation}")
.hasLongSumSatisfying(
sum ->
sum.isMonotonic()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ List<AutoCloseable> registerObservers(OpenTelemetry openTelemetry, ClassLoadingM
meter
.counterBuilder("process.runtime.jvm.classes.loaded")
.setDescription("Number of classes loaded since JVM start")
.setUnit("1")
.setUnit("{class}")
.buildWithCallback(
observableMeasurement ->
observableMeasurement.record(classBean.getTotalLoadedClassCount())));
Expand All @@ -57,15 +57,15 @@ List<AutoCloseable> registerObservers(OpenTelemetry openTelemetry, ClassLoadingM
meter
.counterBuilder("process.runtime.jvm.classes.unloaded")
.setDescription("Number of classes unloaded since JVM start")
.setUnit("1")
.setUnit("{class}")
.buildWithCallback(
observableMeasurement ->
observableMeasurement.record(classBean.getUnloadedClassCount())));
observables.add(
meter
.upDownCounterBuilder("process.runtime.jvm.classes.current_loaded")
.setDescription("Number of classes currently loaded")
.setUnit("1")
.setUnit("{class}")
.buildWithCallback(
observableMeasurement ->
observableMeasurement.record(classBean.getLoadedClassCount())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ List<AutoCloseable> registerObservers(OpenTelemetry openTelemetry, ThreadMXBean
meter
.upDownCounterBuilder("process.runtime.jvm.threads.count")
.setDescription("Number of executing threads")
.setUnit("1")
.setUnit("{thread}")
.buildWithCallback(
observableMeasurement -> {
observableMeasurement.record(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void registerObservers() {
assertThat(metricData)
.hasInstrumentationScope(EXPECTED_SCOPE)
.hasDescription("Number of classes loaded since JVM start")
.hasUnit("1")
.hasUnit("{class}")
.hasLongSumSatisfying(
sum ->
sum.isMonotonic()
Expand All @@ -60,7 +60,7 @@ void registerObservers() {
assertThat(metricData)
.hasInstrumentationScope(EXPECTED_SCOPE)
.hasDescription("Number of classes unloaded since JVM start")
.hasUnit("1")
.hasUnit("{class}")
.hasLongSumSatisfying(
sum ->
sum.isMonotonic()
Expand All @@ -76,7 +76,7 @@ void registerObservers() {
assertThat(metricData)
.hasInstrumentationScope(EXPECTED_SCOPE)
.hasDescription("Number of classes currently loaded")
.hasUnit("1")
.hasUnit("{class}")
.hasLongSumSatisfying(
sum ->
sum.isNotMonotonic()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void registerObservers() {
assertThat(metricData)
.hasInstrumentationScope(EXPECTED_SCOPE)
.hasDescription("Number of executing threads")
.hasUnit("1")
.hasUnit("{thread}")
.hasLongSumSatisfying(
sum ->
sum.isNotMonotonic()
Expand Down

0 comments on commit 8433735

Please sign in to comment.