Skip to content

Commit

Permalink
gerge branch 'release/2024.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
tnamao committed Mar 29, 2024
2 parents 9f78142 + 9e66137 commit e463cba
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 48 deletions.
12 changes: 12 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# CHANGES

## 2024.4.0

- [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 に上げる
Expand Down
32 changes: 16 additions & 16 deletions collector/cluster_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}),
}
)

Expand All @@ -24,21 +24,21 @@ 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) {
ch <- m.clusterNode
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) {
Expand All @@ -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)
}
}
32 changes: 16 additions & 16 deletions test/maximum.metrics
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 16 additions & 16 deletions test/sora_cluster_metrics_enabled.metrics
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e463cba

Please sign in to comment.