You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2024/10/08 13:51:28 UTC

(skywalking-banyandb) branch main updated: Fix metrics system typo (#550)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git


The following commit(s) were added to refs/heads/main by this push:
     new bcaf9a8d Fix metrics system typo (#550)
bcaf9a8d is described below

commit bcaf9a8d80780b374c9275d15ad3c45c83a94b09
Author: hui lai <13...@qq.com>
AuthorDate: Tue Oct 8 21:51:23 2024 +0800

    Fix metrics system typo (#550)
---
 CHANGES.md                              |  6 ++++++
 banyand/observability/metrics_system.go | 28 ++++++++++++++--------------
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index d8b75db2..36f4d273 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -2,6 +2,12 @@
 
 Release Notes.
 
+## 0.8.0
+
+### Chores
+
+- Fix metrics system typo.
+
 ## 0.7.0
 
 ### File System Changes
diff --git a/banyand/observability/metrics_system.go b/banyand/observability/metrics_system.go
index 8b1b7ecc..fd6f5ed2 100644
--- a/banyand/observability/metrics_system.go
+++ b/banyand/observability/metrics_system.go
@@ -47,14 +47,14 @@ var (
 	// RootScope is the root scope for all metrics.
 	RootScope = meter.NewHierarchicalScope("banyandb", "_")
 	// SystemScope is the system scope for all metrics.
-	SystemScope     = RootScope.SubScope("system")
-	cpuStateGauge   meter.Gauge
-	cpuNumGauge     meter.Gauge
-	memorySateGauge meter.Gauge
-	netStateGauge   meter.Gauge
-	upTimeGauge     meter.Gauge
-	diskStateGauge  meter.Gauge
-	diskMap         = sync.Map{}
+	SystemScope      = RootScope.SubScope("system")
+	cpuStateGauge    meter.Gauge
+	cpuNumGauge      meter.Gauge
+	memoryStateGauge meter.Gauge
+	netStateGauge    meter.Gauge
+	upTimeGauge      meter.Gauge
+	diskStateGauge   meter.Gauge
+	diskMap          = sync.Map{}
 )
 
 // UpdatePath updates a path to monitoring its disk usage.
@@ -82,7 +82,7 @@ func (p *metricService) initMetrics() {
 	factory := p.With(SystemScope)
 	cpuStateGauge = factory.NewGauge("cpu_state", "kind")
 	cpuNumGauge = factory.NewGauge("cpu_num")
-	memorySateGauge = factory.NewGauge("memory_state", "kind")
+	memoryStateGauge = factory.NewGauge("memory_state", "kind")
 	netStateGauge = factory.NewGauge("net_state", "kind", "name")
 	upTimeGauge = factory.NewGauge("up_time")
 	diskStateGauge = factory.NewGauge("disk", "path", "kind")
@@ -118,16 +118,16 @@ func collectCPU() {
 }
 
 func collectMemory() {
-	if memorySateGauge == nil {
-		log.Error().Msg("memorySateGauge is not registered")
+	if memoryStateGauge == nil {
+		log.Error().Msg("memoryStateGauge is not registered")
 	}
 	m, err := mem.VirtualMemory()
 	if err != nil {
 		log.Error().Err(err).Msg("cannot get memory stat")
 	}
-	memorySateGauge.Set(m.UsedPercent/100, "used_percent")
-	memorySateGauge.Set(float64(m.Used), "used")
-	memorySateGauge.Set(float64(m.Total), "total")
+	memoryStateGauge.Set(m.UsedPercent/100, "used_percent")
+	memoryStateGauge.Set(float64(m.Used), "used")
+	memoryStateGauge.Set(float64(m.Total), "total")
 }
 
 func collectNet() {