mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-11 08:47:46 +02:00
admin: scrape the metrics ports the cluster advertises
Replaces scraping each node's service port with the dedicated Prometheus listener each node now advertises. Nodes started without -metricsPort advertise 0 and are skipped, so nothing is ever fetched from a client-facing port. Endpoints are deduplicated by address because a combined "weed server" advertises one listener for all of its components; series are attributed by metric name, which already identifies the component.
This commit is contained in:
1 parent
51831d6850
commit
a6e07181b2
5 files changed
+109
-7
No files matched your search
@@ -146,6 +146,8 @@ type FilerNode struct {
|
||||
DataCenter string `json:"datacenter"`
|
||||
Rack string `json:"rack"`
|
||||
LastUpdated time.Time `json:"last_updated"`
|
||||
// MetricsPort is the node's advertised Prometheus port, 0 when disabled.
|
||||
MetricsPort uint32 `json:"metrics_port"`
|
||||
}
|
||||
|
||||
type MessageBrokerNode struct {
|
||||
@@ -159,6 +161,8 @@ type S3Node struct {
|
||||
Address string `json:"address"`
|
||||
DataCenter string `json:"datacenter"`
|
||||
LastUpdated time.Time `json:"last_updated"`
|
||||
// MetricsPort is the node's advertised Prometheus port, 0 when disabled.
|
||||
MetricsPort uint32 `json:"metrics_port"`
|
||||
}
|
||||
|
||||
// GetAdminData retrieves admin data as a struct (for reuse by both JSON and HTML handlers)
|
||||
@@ -356,6 +360,7 @@ func (s *AdminServer) getFilerNodesStatus() []FilerNode {
|
||||
DataCenter: node.DataCenter,
|
||||
Rack: node.Rack,
|
||||
LastUpdated: time.Now(),
|
||||
MetricsPort: node.MetricsPort,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -433,6 +438,7 @@ func (s *AdminServer) getS3NodesStatus() []S3Node {
|
||||
Address: pb.ServerAddress(node.Address).ToHttpAddress(),
|
||||
DataCenter: node.DataCenter,
|
||||
LastUpdated: time.Now(),
|
||||
MetricsPort: node.MetricsPort,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user