From 646a995f8980acd3cce1247fc04fe4967f8ff767 Mon Sep 17 00:00:00 2001 From: Takeshi NAMAO Date: Fri, 29 Mar 2024 17:02:02 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E3=83=AA=E3=83=AC=E3=83=BC=E3=81=AE?= =?UTF-8?q?=E3=83=A1=E3=83=88=E3=83=AA=E3=82=AF=E3=82=B9=E5=90=8D=E3=82=92?= =?UTF-8?q?=20Prometheus=20=E3=81=AE=E5=91=BD=E5=90=8D=E8=A6=8F=E5=89=87?= =?UTF-8?q?=E3=81=AB=E5=BE=93=E3=81=86=E3=82=88=E3=81=86=E5=A4=89=E6=9B=B4?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- collector/cluster_node.go | 32 +++++++++++------------ test/maximum.metrics | 32 +++++++++++------------ test/sora_cluster_metrics_enabled.metrics | 32 +++++++++++------------ 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/collector/cluster_node.go b/collector/cluster_node.go index 05c8a6f..fb01b5e 100644 --- a/collector/cluster_node.go +++ b/collector/cluster_node.go @@ -11,10 +11,10 @@ var ( raftTerm: newDesc("cluster_raft_term", "The current Raft term."), raftCommitIndex: newDesc("cluster_raft_commit_index", "The latest committed Raft log index."), - clusterRelayReceivedBytes: newDescWithLabel("cluster_relay_received_bytes", "The total number of bytes received by the cluster relay.", []string{"node_name"}), - clusterRelaySentBytes: newDescWithLabel("cluster_relay_sent_bytes", "The total number of bytes sent by the cluster relay.", []string{"node_name"}), - clusterRelayReceivedPackets: newDescWithLabel("cluster_relay_received_packets", "The total number of packets received by the cluster relay.", []string{"node_name"}), - clusterRelaySentPackets: newDescWithLabel("cluster_relay_sent_packets", "The total number of packets sent by the cluster relay.", []string{"node_name"}), + clusterRelayReceivedBytesTotal: newDescWithLabel("cluster_relay_received_bytes_total", "The total number of bytes received by the cluster relay.", []string{"node_name"}), + clusterRelaySentBytesTotal: newDescWithLabel("cluster_relay_sent_bytes_total", "The total number of bytes sent by the cluster relay.", []string{"node_name"}), + clusterRelayReceivedPacketsTotal: newDescWithLabel("cluster_relay_received_packets_total", "The total number of packets received by the cluster relay.", []string{"node_name"}), + clusterRelaySentPacketsTotal: newDescWithLabel("cluster_relay_sent_packets_total", "The total number of packets sent by the cluster relay.", []string{"node_name"}), } ) @@ -24,10 +24,10 @@ type SoraClusterMetrics struct { raftTerm *prometheus.Desc raftCommitIndex *prometheus.Desc - clusterRelayReceivedBytes *prometheus.Desc - clusterRelaySentBytes *prometheus.Desc - clusterRelayReceivedPackets *prometheus.Desc - clusterRelaySentPackets *prometheus.Desc + clusterRelayReceivedBytesTotal *prometheus.Desc + clusterRelaySentBytesTotal *prometheus.Desc + clusterRelayReceivedPacketsTotal *prometheus.Desc + clusterRelaySentPacketsTotal *prometheus.Desc } func (m *SoraClusterMetrics) Describe(ch chan<- *prometheus.Desc) { @@ -35,10 +35,10 @@ func (m *SoraClusterMetrics) Describe(ch chan<- *prometheus.Desc) { ch <- m.raftState ch <- m.raftTerm ch <- m.raftCommitIndex - ch <- m.clusterRelayReceivedBytes - ch <- m.clusterRelaySentBytes - ch <- m.clusterRelayReceivedPackets - ch <- m.clusterRelaySentPackets + ch <- m.clusterRelayReceivedBytesTotal + ch <- m.clusterRelaySentBytesTotal + ch <- m.clusterRelayReceivedPacketsTotal + ch <- m.clusterRelaySentPacketsTotal } func (m *SoraClusterMetrics) Collect(ch chan<- prometheus.Metric, nodeList []soraClusterNode, report soraClusterReport, clusterRelaies []soraClusterRelay) { @@ -58,9 +58,9 @@ func (m *SoraClusterMetrics) Collect(ch chan<- prometheus.Metric, nodeList []sor ch <- newCounter(m.raftCommitIndex, float64(report.RaftCommitIndex)) for _, relayNode := range clusterRelaies { - ch <- newCounter(m.clusterRelayReceivedBytes, float64(relayNode.TotalReceivedByteSize), relayNode.NodeName) - ch <- newCounter(m.clusterRelaySentBytes, float64(relayNode.TotalSentByteSize), relayNode.NodeName) - ch <- newCounter(m.clusterRelayReceivedPackets, float64(relayNode.TotalReceived), relayNode.NodeName) - ch <- newCounter(m.clusterRelaySentPackets, float64(relayNode.TotalSent), relayNode.NodeName) + ch <- newCounter(m.clusterRelayReceivedBytesTotal, float64(relayNode.TotalReceivedByteSize), relayNode.NodeName) + ch <- newCounter(m.clusterRelaySentBytesTotal, float64(relayNode.TotalSentByteSize), relayNode.NodeName) + ch <- newCounter(m.clusterRelayReceivedPacketsTotal, float64(relayNode.TotalReceived), relayNode.NodeName) + ch <- newCounter(m.clusterRelaySentPacketsTotal, float64(relayNode.TotalSent), relayNode.NodeName) } } diff --git a/test/maximum.metrics b/test/maximum.metrics index 49da237..e7330ef 100644 --- a/test/maximum.metrics +++ b/test/maximum.metrics @@ -22,22 +22,22 @@ sora_cluster_raft_state{state="follower"} 1 # HELP sora_cluster_raft_term The current Raft term. # TYPE sora_cluster_raft_term counter sora_cluster_raft_term 3 -# HELP sora_cluster_relay_received_bytes The total number of bytes received by the cluster relay. -# TYPE sora_cluster_relay_received_bytes counter -sora_cluster_relay_received_bytes{node_name="node-01"} 11 -sora_cluster_relay_received_bytes{node_name="node-02"} 21 -# HELP sora_cluster_relay_received_packets The total number of packets received by the cluster relay. -# TYPE sora_cluster_relay_received_packets counter -sora_cluster_relay_received_packets{node_name="node-01"} 13 -sora_cluster_relay_received_packets{node_name="node-02"} 23 -# HELP sora_cluster_relay_sent_bytes The total number of bytes sent by the cluster relay. -# TYPE sora_cluster_relay_sent_bytes counter -sora_cluster_relay_sent_bytes{node_name="node-01"} 12 -sora_cluster_relay_sent_bytes{node_name="node-02"} 22 -# HELP sora_cluster_relay_sent_packets The total number of packets sent by the cluster relay. -# TYPE sora_cluster_relay_sent_packets counter -sora_cluster_relay_sent_packets{node_name="node-01"} 14 -sora_cluster_relay_sent_packets{node_name="node-02"} 24 +# HELP sora_cluster_relay_received_bytes_total The total number of bytes received by the cluster relay. +# TYPE sora_cluster_relay_received_bytes_total counter +sora_cluster_relay_received_bytes_total{node_name="node-01"} 11 +sora_cluster_relay_received_bytes_total{node_name="node-02"} 21 +# HELP sora_cluster_relay_received_packets_total The total number of packets received by the cluster relay. +# TYPE sora_cluster_relay_received_packets_total counter +sora_cluster_relay_received_packets_total{node_name="node-01"} 13 +sora_cluster_relay_received_packets_total{node_name="node-02"} 23 +# HELP sora_cluster_relay_sent_bytes_total The total number of bytes sent by the cluster relay. +# TYPE sora_cluster_relay_sent_bytes_total counter +sora_cluster_relay_sent_bytes_total{node_name="node-01"} 12 +sora_cluster_relay_sent_bytes_total{node_name="node-02"} 22 +# HELP sora_cluster_relay_sent_packets_total The total number of packets sent by the cluster relay. +# TYPE sora_cluster_relay_sent_packets_total counter +sora_cluster_relay_sent_packets_total{node_name="node-01"} 14 +sora_cluster_relay_sent_packets_total{node_name="node-02"} 24 # HELP sora_client_type_total The total number of connections by Sora client types # TYPE sora_client_type_total counter sora_client_type_total{client="android_sdk",state="failed"} 1 diff --git a/test/sora_cluster_metrics_enabled.metrics b/test/sora_cluster_metrics_enabled.metrics index 2d633bd..15648b5 100644 --- a/test/sora_cluster_metrics_enabled.metrics +++ b/test/sora_cluster_metrics_enabled.metrics @@ -22,22 +22,22 @@ sora_cluster_raft_state{state="follower"} 1 # HELP sora_cluster_raft_term The current Raft term. # TYPE sora_cluster_raft_term counter sora_cluster_raft_term 3 -# HELP sora_cluster_relay_received_bytes The total number of bytes received by the cluster relay. -# TYPE sora_cluster_relay_received_bytes counter -sora_cluster_relay_received_bytes{node_name="node-01"} 11 -sora_cluster_relay_received_bytes{node_name="node-02"} 21 -# HELP sora_cluster_relay_received_packets The total number of packets received by the cluster relay. -# TYPE sora_cluster_relay_received_packets counter -sora_cluster_relay_received_packets{node_name="node-01"} 13 -sora_cluster_relay_received_packets{node_name="node-02"} 23 -# HELP sora_cluster_relay_sent_bytes The total number of bytes sent by the cluster relay. -# TYPE sora_cluster_relay_sent_bytes counter -sora_cluster_relay_sent_bytes{node_name="node-01"} 12 -sora_cluster_relay_sent_bytes{node_name="node-02"} 22 -# HELP sora_cluster_relay_sent_packets The total number of packets sent by the cluster relay. -# TYPE sora_cluster_relay_sent_packets counter -sora_cluster_relay_sent_packets{node_name="node-01"} 14 -sora_cluster_relay_sent_packets{node_name="node-02"} 24 +# HELP sora_cluster_relay_received_bytes_total The total number of bytes received by the cluster relay. +# TYPE sora_cluster_relay_received_bytes_total counter +sora_cluster_relay_received_bytes_total{node_name="node-01"} 11 +sora_cluster_relay_received_bytes_total{node_name="node-02"} 21 +# HELP sora_cluster_relay_received_packets_total The total number of packets received by the cluster relay. +# TYPE sora_cluster_relay_received_packets_total counter +sora_cluster_relay_received_packets_total{node_name="node-01"} 13 +sora_cluster_relay_received_packets_total{node_name="node-02"} 23 +# HELP sora_cluster_relay_sent_bytes_total The total number of bytes sent by the cluster relay. +# TYPE sora_cluster_relay_sent_bytes_total counter +sora_cluster_relay_sent_bytes_total{node_name="node-01"} 12 +sora_cluster_relay_sent_bytes_total{node_name="node-02"} 22 +# HELP sora_cluster_relay_sent_packets_total The total number of packets sent by the cluster relay. +# TYPE sora_cluster_relay_sent_packets_total counter +sora_cluster_relay_sent_packets_total{node_name="node-01"} 14 +sora_cluster_relay_sent_packets_total{node_name="node-02"} 24 # HELP sora_connections_total The total number of connections created. # TYPE sora_connections_total counter sora_connections_total{state="created"} 2 From 2e2a02bb63bbd03f10b45320df353e9f722c679b Mon Sep 17 00:00:00 2001 From: Takeshi NAMAO Date: Fri, 29 Mar 2024 17:04:01 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A4=89=E6=9B=B4=E5=B1=A5=E6=AD=B4?= =?UTF-8?q?=E3=81=AB=E8=BF=BD=E8=A8=98=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 768a0e5..5bb6a78 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,15 @@ # CHANGES +- [CHANGE] クラスターリレーのメトリクス名を変更する + - Prometheus メトリクスの命名規則に沿った名前に変更する + - 送受信バイト数 + - `sora_cluster_relay_received_bytes` を `sora_cluster_relay_recived_bytes_total` に変更する + - `sora_cluster_relay_sent_bytes` を `sora_cluster_relay_sent_bytes_total` に変更する + - 送受信パケット数 + - `sora_cluster_relay_received_packets` を `sora_cluster_relay_recived_packets_total` に変更する + - `sora_cluster_relay_sent_packets` を `sora_cluster_relay_sent_packets_total` に変更する + @tnamao + ## 2024.3.0 - [UPDATE] Go を 1.22 に上げる From 9e66137d58e66fe2accaf88c0999bedefcf64d0d Mon Sep 17 00:00:00 2001 From: Takeshi NAMAO Date: Fri, 29 Mar 2024 17:04:45 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E5=A4=89=E6=9B=B4=E5=B1=A5=E6=AD=B4?= =?UTF-8?q?=E3=81=AB=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=92?= =?UTF-8?q?=E5=8F=8D=E6=98=A0=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 5bb6a78..be1dd1b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,7 @@ # CHANGES +## 2024.4.0 + - [CHANGE] クラスターリレーのメトリクス名を変更する - Prometheus メトリクスの命名規則に沿った名前に変更する - 送受信バイト数