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

Fix some gauge types #4962

Merged
merged 1 commit into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
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 @@ -28,8 +28,7 @@ public static void registerObservers() {
OSProcess processInfo = osInfo.getProcess(osInfo.getProcessId());

meter
.gaugeBuilder("runtime.java.memory")
.ofLongs()
.upDownCounterBuilder("runtime.java.memory")
.setDescription("Runtime Java memory")
.setUnit("bytes")
.buildWithCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ public static void registerObservers() {
HardwareAbstractionLayer hal = systemInfo.getHardware();

meter
.gaugeBuilder("system.memory.usage")
.ofLongs()
.upDownCounterBuilder("system.memory.usage")
.setDescription("System memory usage")
.setUnit("By")
.buildWithCallback(
Expand All @@ -61,8 +60,7 @@ public static void registerObservers() {
});

meter
.gaugeBuilder("system.network.io")
.ofLongs()
.counterBuilder("system.network.io")
.setDescription("System network IO")
.setUnit("By")
.buildWithCallback(
Expand All @@ -78,8 +76,7 @@ public static void registerObservers() {
});

meter
.gaugeBuilder("system.network.packets")
.ofLongs()
.counterBuilder("system.network.packets")
.setDescription("System network packets")
.setUnit("packets")
.buildWithCallback(
Expand All @@ -95,8 +92,7 @@ public static void registerObservers() {
});

meter
.gaugeBuilder("system.network.errors")
.ofLongs()
.counterBuilder("system.network.errors")
.setDescription("System network errors")
.setUnit("errors")
.buildWithCallback(
Expand All @@ -112,8 +108,7 @@ public static void registerObservers() {
});

meter
.gaugeBuilder("system.disk.io")
.ofLongs()
.counterBuilder("system.disk.io")
.setDescription("System disk IO")
.setUnit("By")
.buildWithCallback(
Expand All @@ -128,8 +123,7 @@ public static void registerObservers() {
});

meter
.gaugeBuilder("system.disk.operations")
.ofLongs()
.counterBuilder("system.disk.operations")
.setDescription("System disk operations")
.setUnit("operations")
.buildWithCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void test() {
metric
.hasName("runtime.java.memory")
.hasUnit("bytes")
.hasLongGauge()
.hasLongSum()
.points()
.anySatisfy(point -> assertThat(point.getValue()).isPositive()),
metric ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void test() {
metric
.hasName("system.memory.usage")
.hasUnit("By")
.hasLongGauge()
.hasLongSum()
.points()
.anySatisfy(point -> assertThat(point.getValue()).isPositive()),
metric ->
Expand All @@ -30,9 +30,9 @@ public void test() {
.hasDoubleGauge()
.points()
.anySatisfy(point -> assertThat(point.getValue()).isPositive()),
metric -> metric.hasName("system.network.io").hasUnit("By").hasLongGauge(),
metric -> metric.hasName("system.network.packets").hasUnit("packets").hasLongGauge(),
metric -> metric.hasName("system.network.errors").hasUnit("errors").hasLongGauge(),
metric -> metric.hasName("system.disk.operations").hasUnit("operations").hasLongGauge());
metric -> metric.hasName("system.network.io").hasUnit("By").hasLongSum(),
metric -> metric.hasName("system.network.packets").hasUnit("packets").hasLongSum(),
metric -> metric.hasName("system.network.errors").hasUnit("errors").hasLongSum(),
metric -> metric.hasName("system.disk.operations").hasUnit("operations").hasLongSum());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ public static void registerMemoryAreaObservers() {
MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
Meter meter = GlobalOpenTelemetry.get().getMeterProvider().get(MemoryPools.class.getName());
meter
.gaugeBuilder("runtime.jvm.memory.area")
.ofLongs()
.upDownCounterBuilder("runtime.jvm.memory.area")
.setDescription("Bytes of a given JVM memory area.")
.setUnit("By")
.buildWithCallback(
Expand All @@ -88,8 +87,7 @@ public static void registerMemoryPoolObservers() {
maxLabelSets.add(Attributes.of(TYPE_KEY, MAX, POOL_KEY, pool.getName()));
}
meter
.gaugeBuilder("runtime.jvm.memory.pool")
.ofLongs()
.upDownCounterBuilder("runtime.jvm.memory.pool")
.setDescription("Bytes of a given JVM memory pool.")
.setUnit("By")
.buildWithCallback(
Expand Down